:root {
    --primary: #FF0000;
    --primary-hover: #CC0000;
    --bg-light: #f9f9f9;
    --bg-white: #ffffff;
    --text-dark: #0f0f0f;
    --text-muted: #606060;
    --border-color: #e5e5e5;
    --sidebar-width: 260px;
    --accent: #fef2f2;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

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

body {
    background-color: var(--bg-light);
    color: var(--text-dark);
    font-family: 'Inter', sans-serif;
    display: flex;
    min-height: 100vh;
}

/* Sidebar Layout */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-white);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-logo {
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo img {
    max-height: 45px;
    width: auto;
    object-fit: contain;
}

.nav-menu {
    list-style: none;
    flex-grow: 1;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link.active,
.nav-link:hover {
    background: var(--accent);
    color: var(--primary);
}

/* Main Content Wrapper */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    width: calc(100% - var(--sidebar-width));
}

.top-bar {
    background: var(--bg-white);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1.5rem;
}

.container {
    padding: 2.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Search Interface Redesign */
.search-container {
    background: var(--bg-white);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: var(--shadow);
    text-align: center;
    max-width: 900px;
    margin: 0 auto 3rem;
}

.search-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.search-subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.search-form-premium {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-input-premium {
    width: 100%;
    padding: 1.25rem 4rem 1.25rem 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: 16px;
    font-size: 1.1rem;
    background: #fdfdfd;
}

.search-btn-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Keyword Chips */
.keyword-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.chip {
    background: var(--accent);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chip-remove {
    cursor: pointer;
    opacity: 0.7;
}

/* Video Type Toggles */
.type-toggles {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.toggle-btn {
    padding: 0.6rem 1.5rem;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
}

.toggle-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Result Cards Redesign */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.video-card-premium {
    background: var(--bg-white);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s;
    border: 1px solid var(--border-color);
}

.video-card-premium:hover {
    transform: translateY(-5px);
}

.thumb-container {
    position: relative;
    aspect-ratio: 16/9;
}

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

.duration-badge {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.video-body {
    padding: 1.5rem;
}

.video-title-premium {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.subs-badge {
    color: var(--primary);
    font-weight: 600;
}

.video-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.stat-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
}

.stat-icon {
    opacity: 0.8;
}

.stat-val {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-dark);
}

.stat-lbl {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.viral-progress-container {
    height: 8px;
    background: #f1f5f9;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.viral-progress-bar {
    height: 100%;
    border-radius: 10px;
    transition: width 1s;
}

.btn-view-stats {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--primary);
    background: transparent;
    color: var(--primary);
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-view-stats:hover {
    background: var(--primary);
    color: white;
    white-space: nowrap;
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: flex-start;
    z-index: 2000;
    backdrop-filter: blur(4px);
    overflow-y: auto;
    padding: 2rem 1rem;
}

.modal-content {
    background: var(--bg-white);
    border-radius: 24px;
    width: 90%;
    max-width: 800px;
    max-height: none;
    padding: 2rem;
    position: relative;
    margin: auto;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-muted);
    z-index: 10;
    background: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Filters Modal specifics */
.filter-group {
    margin-bottom: 2rem;
}

.filter-label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.slider-container {
    padding: 0 10px;
}

input[type=range] {
    width: 100%;
    margin: 10px 0;
    accent-color: var(--primary);
}

.btn-apply-filters {
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-weight: 700;
    width: 100%;
    cursor: pointer;
}

/* Auth Pages Redesign (Light) */
.auth-page-premium {
    justify-content: center;
    align-items: center;
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Magic Search AI Styles */
.magic-box {
    background: linear-gradient(135deg, #f0f7ff 0%, #ffffff 100%);
    border: 2px dashed var(--primary);
    padding: 1.5rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    display: none;
    /* Hidden by default */
}

.magic-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.magic-input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 1rem;
}

.btn-magic {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.ai-hint {
    font-size: 0.85rem;
    color: var(--primary);
    cursor: pointer;
    text-decoration: underline;
    display: block;
    margin-top: 1rem;
}

.sparkle-icon {
    animation: sparkle 1.5s infinite;
}

@keyframes sparkle {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

.fav-icon {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.fav-icon:hover {
    transform: scale(1.1);
    color: #f43f5e;
}

.fav-icon.active {
    color: #f43f5e;
    background: white;
}

/* Inline Filters Styling */
.filters-inline {
    background: #fdfdfd;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    margin-top: 1.5rem;
    text-align: left;
}

.filter-row {
    display: flex;
    gap: 2rem;
    align-items: flex-end;
}

.filter-col {
    flex: 1;
}

.filter-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    letter-spacing: 0.5px;
}

.auth-card-premium {
    background: var(--bg-white);
    padding: 3rem;
    border-radius: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 450px;
}

/* User Credits Card */
.user-credits-card {
    background: #0f0f0f;
    color: white;
    padding: 1.25rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Tablet and below */
@media (max-width: 1024px) {
    .modal-content {
        max-width: 95%;
    }

    .modal-content>div[style*="grid-template-columns: 1.5fr"] {
        display: flex !important;
        flex-direction: column !important;
    }
}

/* Mobile */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
    }

    body {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        height: auto;
        width: 100%;
        flex-direction: row;
        padding: 0.5rem;
        justify-content: space-around;
        border-right: none;
        border-top: 1px solid var(--border-color);
        z-index: 1000;
        background: white;
    }

    .sidebar-logo,
    .sidebar-footer,
    .user-credits-card {
        display: none;
    }

    .nav-menu {
        display: flex;
        flex-direction: row;
        justify-content: space-around;
        width: 100%;
        gap: 0;
    }

    .nav-item {
        margin: 0;
    }

    .nav-link {
        flex-direction: column;
        font-size: 0.65rem;
        padding: 0.5rem;
        gap: 0.25rem;
        text-align: center;
    }

    .main-wrapper {
        margin-left: 0;
        width: 100%;
        padding-bottom: 70px;
        /* Space for bottom nav */
    }

    .top-bar {
        padding: 0.75rem 1rem;
    }

    .container {
        padding: 1rem;
    }

    /* Video Cards Grid */
    .video-results {
        grid-template-columns: 1fr !important;
    }

    /* Modal Mobile */
    .modal-overlay {
        padding: 1rem 0.5rem;
    }

    .modal-content {
        padding: 1.5rem;
        border-radius: 16px;
        max-width: 100%;
    }

    .modal-content>div[style*="grid-template-columns"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
    }

    .modal-close {
        top: 0.5rem;
        right: 0.5rem;
        width: 35px;
        height: 35px;
        font-size: 1.5rem;
    }

    /* Filters */
    .filters-inline {
        padding: 1rem;
    }

    .filter-row {
        flex-direction: column;
        gap: 1rem;
    }

    /* Search Hero */
    .search-hero h1 {
        font-size: 1.5rem !important;
    }

    .search-container {
        padding: 0 0.5rem;
    }

    /* Account Page */
    .account-grid {
        grid-template-columns: 1fr !important;
    }

    /* Admin Dashboard */
    .stat-card-admin {
        padding: 1rem;
    }

    /* Pricing Cards */
    .pricing-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Small phones */
@media (max-width: 380px) {
    .nav-link {
        font-size: 0.55rem;
        padding: 0.4rem;
    }

    .container {
        padding: 0.75rem;
    }
}