/* --- CSS VARIABLES (PREMIUM THEME SYSTEM) --- */
:root {
    /* Premium Dark Mode (Default) */
    --bg-color: #09090b; /* Zinc 950 */
    --surface-color: #18181b; /* Zinc 900 */
    --surface-hover: #27272a; /* Zinc 800 */
    --surface-glass: rgba(24, 24, 27, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    
    /* Brand Colors */
    --hero-blue: #38bdf8;
    --hero-blue-glow: rgba(56, 189, 248, 0.15);
    --hero-purple: #c084fc;
    --success-color: #10b981;
    --shadow-color: rgba(0, 0, 0, 0.6);
    --shadow-card: 0 10px 30px -10px rgba(0,0,0,0.5);

    /* Radii & Transitions */
    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    /* Refined Light Mode */
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --surface-hover: #f1f5f9;
    --surface-glass: rgba(255, 255, 255, 0.8);
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --hero-blue: #2563eb;
    --hero-blue-glow: rgba(37, 99, 235, 0.1);
    --hero-purple: #9333ea;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --shadow-card: 0 10px 30px -10px rgba(0,0,0,0.1);
}

/* --- GLOBAL RESET & TYPOGRAPHY --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Quicksand', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

button {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

/* --- HEADER --- */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background-color: var(--surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
    transition: background-color 0.3s, border-color 0.3s;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: block;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background-color: transparent;
    transition: var(--transition);
    border: 1px solid transparent;
}

@media (hover: hover) {
    .icon-btn:hover {
        background-color: var(--surface-hover);
        border-color: var(--border-color);
    }
}

.icon-btn:active {
    transform: scale(0.95);
}

.icon-btn svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* --- THEME TOGGLE ANIMATION --- */
#theme-toggle {
    position: relative;
}

.moon-icon {
    transform-origin: top center;
    animation: moonSwing 3s ease-in-out infinite;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.sun-icon {
    position: absolute;
    top: 9px; 
    left: 9px;
    transform-origin: center;
    opacity: 0;
    transform: scale(0) rotate(0deg);
}

[data-theme="light"] .moon-icon {
    animation: none;
    transform: scale(0);
    opacity: 0;
}

[data-theme="light"] .sun-icon {
    animation: sunEntrance 0.6s ease-out forwards, sunSpinSlow 15s linear 0.6s infinite;
}

@keyframes moonSwing {
    0%, 100% { transform: rotate(-10deg); }
    50% { transform: rotate(10deg); }
}

@keyframes sunEntrance {
    0% { transform: scale(0) rotate(0deg); opacity: 0; }
    100% { transform: scale(1) rotate(360deg); opacity: 1; }
}

@keyframes sunSpinSlow {
    from { transform: scale(1) rotate(0deg); }
    to { transform: scale(1) rotate(360deg); }
}

/* --- TRANSLATE DROPDOWN --- */
.lang-dropdown-wrapper {
    position: relative;
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    width: 150px;
    box-shadow: var(--shadow-card);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 101;
    animation: dropdownFade 0.2s ease;
}

@keyframes dropdownFade {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.lang-dropdown.show {
    display: flex;
}

.lang-option {
    padding: 14px 16px;
    text-align: left;
    width: 100%;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
}

.lang-option:hover, .lang-option.active {
    background-color: var(--surface-hover);
    color: var(--hero-blue);
}

/* --- SIDEBAR --- */
.sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 280px;
    height: 100vh;
    background-color: var(--surface-color);
    border-right: 1px solid var(--border-color);
    z-index: 1000;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    padding-top: 80px;
}

.sidebar.open {
    transform: translateX(320px);
}

.sidebar-menu {
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-weight: 600;
    transition: var(--transition);
}

.menu-item:hover {
    background-color: var(--surface-hover);
    color: var(--hero-blue);
}

.menu-item svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.8;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.overlay.show {
    opacity: 1;
    pointer-events: auto;
}

/* --- MAIN CONTENT & LAYOUT --- */
main {
    padding-top: 90px; /* Offset + spacing */
    flex-grow: 1;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

/* --- ANIMATIONS --- */
.fade-in-up {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(20px);
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- HERO CARD (NEW) --- */
.hero-card {
    background: linear-gradient(145deg, var(--surface-hover), var(--surface-color));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 32px 24px;
    text-align: center;
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.hero-card::before {
    content: '';
    position: absolute;
    top: -50px;
    left: -50px;
    width: 150px;
    height: 150px;
    background: var(--hero-blue);
    filter: blur(80px);
    opacity: 0.15;
    border-radius: 50%;
    pointer-events: none;
}

.hero-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.hero-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.hero-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.badge svg {
    width: 14px;
    height: 14px;
    stroke: var(--hero-blue);
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* --- TOP BUTTONS SECTION --- */
.top-buttons-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 32px;
}

@media (min-width: 600px) {
    .top-buttons-section {
        grid-template-columns: repeat(3, 1fr);
    }
}

.top-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
    box-shadow: 0 2px 8px var(--shadow-color);
}

@media (hover: hover) {
    .top-btn:hover {
        transform: translateY(-2px);
        background-color: var(--surface-hover);
        border-color: var(--hero-blue);
        color: var(--hero-blue);
        box-shadow: 0 8px 16px var(--hero-blue-glow);
    }
}

.top-btn:active {
    transform: scale(0.98);
}

/* --- LIST CARDS (PREMIUM COMPACT) --- */
.list-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.list-card {
    background-color: var(--surface-color);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: var(--transition);
    box-shadow: 0 4px 12px var(--shadow-color);
}

@media (hover: hover) {
    .list-card:hover {
        border-color: var(--border-hover);
        box-shadow: var(--shadow-card);
    }
}

.list-card-header {
    display: flex;
    align-items: center;
    padding: 16px;
    gap: 16px;
    cursor: pointer;
    user-select: none;
}

.list-card-img {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    object-fit: cover;
    flex-shrink: 0;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
}

.list-card-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.list-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.list-card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease;
    max-height: 40px;
    opacity: 1;
    overflow: hidden;
    line-height: 1.4;
}

.list-card.expanded .list-card-desc {
    max-height: 0;
    opacity: 0;
    margin: 0;
}

.dropdown-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.list-card-header:hover .dropdown-toggle {
    background-color: var(--surface-hover);
}

.dropdown-toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: var(--text-secondary);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), stroke 0.3s;
}

.list-card.expanded .dropdown-toggle {
    background-color: var(--hero-blue-glow);
    border-color: var(--hero-blue);
}

.list-card.expanded .dropdown-toggle svg {
    transform: rotate(180deg);
    stroke: var(--hero-blue);
}

.dropdown-content {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border-top: 1px solid transparent;
}

.list-card.expanded .dropdown-content {
    grid-template-rows: 1fr;
    border-top-color: var(--border-color);
    background-color: var(--bg-color);
}

.dropdown-inner {
    overflow: hidden;
}

.dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
    font-size: 0.95rem;
    font-weight: 500;
}

.dropdown-item:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

@media (hover: hover) {
    .dropdown-item:hover {
        background-color: var(--surface-color);
        color: var(--hero-blue);
        padding-left: 24px;
    }
}

.dropdown-item-arrow {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition);
}

.dropdown-item:hover .dropdown-item-arrow {
    color: var(--hero-blue);
    transform: translateX(4px);
}

.dropdown-item-arrow svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* --- PAGE CONTENT & DETAILS --- */
.page-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 32px 24px;
    box-shadow: var(--shadow-card);
    margin-bottom: 32px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 24px;
    transition: var(--transition);
    padding: 8px 16px;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
}

.back-btn:hover {
    color: var(--text-primary);
    background-color: var(--surface-hover);
    border-color: var(--border-hover);
}

.page-header {
    margin-bottom: 32px;
    text-align: center;
}

.page-title {
    font-size: 1.75rem;
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 12px;
}

.page-desc {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
}

/* --- DETAILED PAGE: VIDEO & AUDIO --- */
.video-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
    padding: 24px;
    background-color: var(--bg-color);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.video-wrapper {
    position: relative;
    width: 100%;
    max-width: 280px; 
    aspect-ratio: 9 / 19.5; 
    border-radius: var(--radius-lg);
    overflow: hidden;
    background-color: #000;
    box-shadow: var(--shadow-card);
    border: 4px solid var(--surface-color);
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

.video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.custom-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    background-color: var(--surface-color);
    padding: 12px 24px;
    border-radius: 40px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.ctrl-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.ctrl-btn:active {
    transform: scale(0.9);
}

@media (hover: hover) {
    .ctrl-btn:hover {
        background-color: var(--hero-blue-glow);
        color: var(--hero-blue);
        border-color: var(--hero-blue);
    }
}

.ctrl-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* --- DETAILED PAGE: STEPS UI --- */
.steps-section {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 40px;
    box-shadow: 0 4px 12px var(--shadow-color);
}

.step-content-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
    min-height: 140px;
}

.step-label {
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--bg-color);
    background-color: var(--hero-blue);
    padding: 4px 12px;
    border-radius: 20px;
    align-self: flex-start;
}

.step-desc {
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.6;
    color: var(--text-primary);
}

.step-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 20px;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
}

.step-btn {
    padding: 10px 16px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

@media (hover: hover) {
    .step-btn:hover:not(:disabled) {
        background-color: var(--hero-blue-glow);
        border-color: var(--hero-blue);
        color: var(--hero-blue);
    }
}

.step-btn.primary {
    background-color: var(--hero-blue);
    color: #fff;
    border-color: var(--hero-blue);
}

@media (hover: hover) {
    .step-btn.primary:hover {
        background-color: #0284c7; /* darker blue */
        color: #fff;
    }
}

.step-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.step-counter {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    background-color: var(--bg-color);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

/* --- DETAILED PAGE: DOWNLOADS --- */
.dl-section {
    margin-top: 40px;
}

.dl-instruction {
    text-align: center;
    color: var(--hero-blue);
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 24px;
    padding: 16px;
    background-color: var(--hero-blue-glow);
    border-radius: var(--radius-md);
    border: 1px solid rgba(56, 189, 248, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.dl-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.dl-badge {
    font-size: 0.75rem;
    padding: 4px 8px;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-weight: 600;
}

.dl-btn-action {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background-color: var(--surface-hover);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.dl-btn-action svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (hover: hover) {
    .dl-btn-action:hover {
        background-color: var(--border-color);
        color: var(--hero-blue);
    }
}

.dl-btn-action.counting {
    background-color: var(--bg-color);
    color: var(--text-muted);
    border-color: var(--border-color);
    cursor: not-allowed;
}

.dl-btn-action.ready {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.dl-btn-action.ready:hover {
    background-color: #059669; /* darker emerald */
    color: #ffffff;
}

/* --- FOOTER & SOCIAL ICONS --- */
.app-footer {
    text-align: center;
    padding: 40px 24px 32px;
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    z-index: 10;
}

.social-icons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

@keyframes floatAnim {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--surface-hover);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    animation: floatAnim 3s ease-in-out infinite;
}

.social-icon:nth-child(1) { animation-delay: 0s; }
.social-icon:nth-child(2) { animation-delay: 0.2s; }
.social-icon:nth-child(3) { animation-delay: 0.4s; }

@media (hover: hover) {
    .social-icon:hover {
        border-color: var(--hero-blue);
        box-shadow: 0 8px 16px var(--hero-blue-glow);
    }
}

.social-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    padding: 2px;
}

.copyright {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 1px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
