* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #ff8c42 0%, #d2691e 50%, #a0522d 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.search-box {
    background: #1a1a1a;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    margin-bottom: 30px;
}

.search-input-group {
    display: flex;
    gap: 10px;
}

#searchInput {
    flex: 1;
    padding: 15px 20px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s;
}

#searchInput:focus {
    border-color: #667eea;
}

#searchBtn {
    padding: 15px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

#searchBtn:hover {
    transform: translateY(-2px);
}

#searchBtn:active {
    transform: translateY(0);
}

/* API 키 입력란 숨김 - 서버에서 자동으로 로드됨 */
.api-key-toggle {
    display: none;
}

.api-key-section {
    display: none;
}

.api-key-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}

.api-key-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.api-key-section input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: monospace;
}

.api-key-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.toggle-visibility-btn {
    background: #e9ecef;
    color: #495057;
}

.toggle-visibility-btn:hover {
    background: #dee2e6;
}

.save-btn {
    background: #28a745;
    color: white;
}

.save-btn:hover {
    background: #218838;
}

.save-btn.saved {
    background: #6c757d;
    cursor: not-allowed;
}

.api-key-section small {
    display: block;
    margin-top: 5px;
    color: #666;
}

.results {
    width: 100%;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    width: 100%;
}

.video-card {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.thumbnail-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #f0f0f0;
}

.thumbnail-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.duration {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.vpd-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75em;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.4);
    letter-spacing: 0.3px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.video-info {
    padding: 12px;
}

.video-title {
    font-size: 0.95em;
    font-weight: 700;
    margin-bottom: 6px;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
}

.channel-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.channel-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.channel-name {
    font-weight: 600;
    color: #555;
    font-size: 0.85em;
}

.stats {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    font-size: 0.8em;
    color: #666;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.stat-item:hover {
    color: #333;
}

.stat-unavailable {
    color: #999 !important;
    opacity: 0.7;
}

/* velocity-info styles removed - now using thumbnail overlay for vpd-badge */

.stat-unavailable:hover {
    opacity: 1;
    color: #666 !important;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.7em;
    color: #495057;
}

.video-description {
    margin-top: 6px;
    font-size: 0.8em;
    color: #666;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.loading {
    text-align: center;
    color: white;
    font-size: 1.2em;
    padding: 50px;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.subscriber-count {
    font-size: 0.85em;
    color: #888;
}

.filters-section {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    margin-bottom: 30px;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-label {
    font-weight: 600;
    color: #333;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.filter-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-radio,
.filter-checkbox {
    display: none;
}

.filter-radio-label,
.filter-checkbox-label {
    display: inline-block;
    padding: 8px 16px;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 20px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.3s;
    user-select: none;
}

.filter-radio-label:hover,
.filter-checkbox-label:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.filter-radio:checked + .filter-radio-label,
.filter-checkbox:checked + .filter-checkbox-label {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Filter Action Buttons */
.filter-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
}

.apply-filters-btn, .reset-filters-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.apply-filters-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.apply-filters-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.reset-filters-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.reset-filters-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

/* SerpAPI specific styles */
.serp-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(0, 123, 255, 0.9);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
}

.serp-stats {
    margin: 6px 0;
    padding: 6px;
    background: rgba(0, 123, 255, 0.1);
    border-radius: 6px;
    font-size: 0.75em;
}

.serp-info {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.serp-date, .serp-duration, .serp-date-diff {
    color: #666;
    font-size: 0.8em;
}

.serp-date {
    color: #007bff;
}

.serp-duration {
    color: #28a745;
}

.serp-date-diff {
    color: #ff6b6b;
    font-weight: bold;
    font-size: 0.75em;
}

/* Filter status indicators */
.filter-status {
    font-size: 0.8em;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
}

.filter-status.available {
    background: #d4edda;
    color: #155724;
}

.filter-status.unavailable {
    background: #f8d7da;
    color: #721c24;
}

.filter-status.partial {
    background: #fff3cd;
    color: #856404;
}

.sort-select {
    padding: 8px 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.9em;
    cursor: pointer;
    background: white;
    transition: border-color 0.3s;
}

.sort-select:focus {
    outline: none;
    border-color: #667eea;
}

.pagination-section {
    text-align: center;
    margin-bottom: 30px;
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin: 18px 0 10px;
}

.page-btn {
    border: none;
    padding: 10px 14px;
    border-radius: 999px;
    font-weight: 700;
    cursor: pointer;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    transition: transform 0.2s, box-shadow 0.2s;
}

.page-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.page-info {
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25);
    font-size: 16px;
}

.result-summary {
    color: white;
    font-size: 0.9em;
    margin-bottom: 15px;
    font-weight: 500;
}

.velocity-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(255, 0, 0, 0.9);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    z-index: 2;
}

.channel-size-badge {
    font-size: 12px;
    margin-left: 4px;
}


.search-mode-indicator {
    text-align: center;
    margin: 10px 0;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    backdrop-filter: blur(10px);
}

.search-mode-indicator.serpapi {
    background: rgba(0, 123, 255, 0.2);
    border: 1px solid rgba(0, 123, 255, 0.3);
}

.search-mode-indicator .mode-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Filter Section Styles */
.filter-section {
    margin: 15px 0;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-group > label:first-child {
    font-weight: 600;
    color: white;
    font-size: 13px;
    white-space: nowrap;
}

.filter-group > label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: 5px;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.filter-group > label:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.filter-group input[type="radio"] {
    cursor: pointer;
    accent-color: #ff8c42;
    margin: 0;
}

/* Custom Range Input */
.custom-range {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.custom-range input[type="number"] {
    padding: 6px 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 12px;
}

.custom-range small {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
}

/* View Filter Optimization */
.filter-group.view-filter {
    display: flex;
    flex-direction: row !important;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-group.view-filter > label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    margin: 0;
}

/* Subscriber Filter Optimization */
.filter-group.sub-filter {
    display: flex;
    flex-direction: row !important;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.filter-group.sub-filter > label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
}

.filter-group.sub-filter > label:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.filter-group.sub-filter input[type="radio"] {
    accent-color: #42a5f5;
    margin: 0;
}

/* Upload Date Filter Optimization */
.filter-group.date-filter {
    display: flex;
    flex-direction: row !important;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.filter-group.date-filter > label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
}

.filter-group.date-filter > label:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.filter-group.date-filter input[type="radio"] {
    accent-color: #00c853;
    margin: 0;
}

/* Desktop: 4 columns (default above 1200px) */

@media (max-width: 1200px) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .search-input-group {
        flex-direction: column;
    }

    #searchBtn {
        width: 100%;
    }

    .filters-grid {
        grid-template-columns: 1fr;
    }

    .filter-options {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-radio-label,
    .filter-checkbox-label {
        width: 100%;
        text-align: center;
    }

    .page-btn {
        width: 100%;
        padding: 15px 40px;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }
}

/* Auth Section Styles */
.auth-section {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    gap: 10px;
}

.auth-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.login-btn {
    background: white;
    color: #667eea;
}

.login-btn:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
}

.signup-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.signup-btn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-2px);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-name {
    font-weight: 600;
    color: #333;
}

.logout-btn {
    padding: 6px 12px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: #d32f2f;
    transform: translateY(-2px);
}

/* Language Toggle Button */
.language-toggle-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    padding: 8px 16px;
    border: 2px solid white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
}

.language-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.language-toggle-btn:active {
    transform: translateY(0);
}

/* Signup Modal Styles */
.signup-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.signup-modal.active {
    display: flex;
}

.signup-form {
    background: white;
    padding: 30px 40px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 400px;
    position: relative;
}

.signup-form h2 {
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

.signup-form .form-group {
    margin-bottom: 15px;
}

.signup-form label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 600;
}

.signup-form input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.signup-form input:focus {
    border-color: #667eea;
}

.signup-form .form-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.signup-form button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.signup-form .submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.signup-form .submit-btn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-2px);
}

.signup-form .cancel-btn {
    background: #e0e0e0;
    color: #333;
}

.signup-form .cancel-btn:hover {
    background: #d0d0d0;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.close-modal:hover {
    color: #333;
}

/* Password toggle button */
.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 14px;
    padding: 5px 10px;
}

.password-toggle:hover {
    color: #333;
}

/* Duration Filter Optimization */
.filter-group.duration-filter {
    display: flex;
    flex-direction: row !important;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.filter-group.duration-filter > label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
}

.filter-group.duration-filter > label:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.filter-group.duration-filter input[type="radio"] {
    accent-color: #ff6b35;
    margin: 0;
}

