/* AniWorld Downloader Web Interface Styles */

/* Authentication Styles */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    z-index: 10;
    position: relative;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    color: var(--text-primary);
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.auth-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.auth-form label {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
}

.auth-form input {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.auth-form input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.auth-form small {
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

.auth-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.875rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.auth-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

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

.error-message {
    background: #fee;
    color: #c53030;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid #feb2b2;
    font-size: 0.9rem;
    text-align: center;
}

.success-message {
    background: #f0fff4;
    color: #38a169;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid #9ae6b4;
    font-size: 0.9rem;
    text-align: center;
}

/* User Dropdown Styles */
.user-dropdown {
    position: relative;
    display: inline-block;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    height: 40px;
    /* Ensure consistent height */
    box-sizing: border-box;
}

.user-btn:hover {
    background: var(--bg-tertiary);
}

.username {
    font-size: 0.9rem;
    font-weight: 500;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    margin-top: 0.5rem;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.dropdown-item:hover {
    background: var(--bg-tertiary);
}

.dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

/* Settings Page Styles */
.settings-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.settings-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.settings-section h2 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.user-info p {
    color: var(--text-secondary);
}

.add-user-form {
    margin-bottom: 2rem;
}

.add-user-form h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: end;
}

.form-row-password {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
}

.password-form {
    margin-top: 1rem;
}

.form-group.checkbox-group {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    /* Match button height (padding + content) */
}

.form-row .form-group:nth-child(1),
.form-row .form-group:nth-child(2) {
    width: 250px;
    /* Fixed width for input groups */
}

.form-row .form-group.checkbox-group {
    width: 120px;
    /* Fixed width for checkbox */
}

.form-row .form-group.button-group {
    margin-left: auto;
    /* Push button to the right */
    width: auto;
    /* Auto width for button */
}

.form-group.button-group .btn {
    width: auto;
    /* Don't stretch the button */
    white-space: nowrap;
    /* Keep text on one line */
}

.form-group.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    cursor: pointer;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 1rem;
    width: 100%;
    /* Use full width of grid column */
}

/* Custom styled checkbox */
.form-group input[type="checkbox"] {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: var(--input-bg);
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    margin: 0;
}

.form-group input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
}

.form-group input[type="checkbox"]:checked::before {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.form-group input[type="checkbox"]:hover {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input[type="checkbox"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

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

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-danger {
    background: #e53e3e;
    color: white;
}

.btn-danger:hover {
    background: #c53030;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
}

.table-container {
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.users-table th,
.users-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.users-table th {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 600;
}

.users-table td {
    color: var(--text-secondary);
}

.role-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.role-badge.admin {
    background: #e6fffa;
    color: #234e52;
}

.role-badge.user {
    background: #f7fafc;
    color: #4a5568;
}

.role-badge.original-admin {
    background: #fef5e7;
    color: #d69e2e;
    border: 1px solid #ed8936;
}

body[data-theme="dark"] .role-badge.admin {
    background: #234e52;
    color: #81e6d9;
}

body[data-theme="dark"] .role-badge.user {
    background: #2d3748;
    color: #a0aec0;
}

body[data-theme="dark"] .role-badge.original-admin {
    background: #744210;
    color: #f6e05e;
    border: 1px solid #d69e2e;
}

.text-muted {
    color: var(--text-tertiary);
    font-style: italic;
}

/* Message notifications */
.message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
}

.message {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

.message.success {
    border-color: #38a169;
    background: #f0fff4;
    color: #38a169;
}

.message.error {
    border-color: #e53e3e;
    background: #fee;
    color: #c53030;
}

.message-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: inherit;
    margin-left: 1rem;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive design for auth and settings */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .auth-container {
        padding: 1rem;
    }

    .settings-container {
        padding: 1rem;
    }

    .settings-section {
        padding: 1rem;
    }

    .users-table {
        font-size: 0.8rem;
    }
}

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


/* Default light theme variables directly on body */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    transition: color 0.3s ease;
    position: relative;
    overflow-x: hidden;

    /* Light theme as default */
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-tertiary: #e2e8f0;
    --navbar-bg: rgba(255, 255, 255, 0.95);
    --navbar-text: #4a5568;
    --navbar-secondary: #718096;
    --text-primary: #333;
    --text-secondary: #4a5568;
    --text-tertiary: #718096;
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-border: #e2e8f0;
    --modal-bg: white;
    --modal-bg-rgb: 255, 255, 255;
    --input-bg: white;
    --tree-bg: #f9fafb;
    --tree-header-bg: #f7fafc;
    --tree-hover: #edf2f7;
    --button-secondary-bg: #e2e8f0;
    --button-secondary-text: #4a5568;
    --border-color: #e2e8f0;
    --progress-bg: #e2e8f0;
}

/* Dark mode override */
body[data-theme="dark"] {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --navbar-bg: rgba(26, 32, 44, 0.95);
    --navbar-text: #e2e8f0;
    --navbar-secondary: #a0aec0;
    --text-primary: #e2e8f0;
    --text-secondary: #cbd5e0;
    --text-tertiary: #a0aec0;
    --card-bg: rgba(45, 55, 72, 0.95);
    --card-border: #4a5568;
    --modal-bg: #2d3748;
    --modal-bg-rgb: 45, 55, 72;
    --input-bg: #4a5568;
    --tree-bg: #1a202c;
    --tree-header-bg: #2d3748;
    --tree-hover: #4a5568;
    --button-secondary-bg: #4a5568;
    --button-secondary-text: #e2e8f0;
    --border-color: #4a5568;
    --progress-bg: #2d3748;
}

/* Animated Background */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

body {
    background: transparent;
}

.background-container {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-tertiary) 100%);
}

body[data-theme="dark"] .background-container {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #0f0f23 100%);
}

/* Dynamic clouds */
.cloud {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.3;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    animation-direction: alternate;
}

/* Light theme clouds */
.cloud:nth-child(1) {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, rgba(147, 51, 234, 0.1) 50%, transparent 70%);
    top: 20%;
    left: 10%;
    animation: float1 8s ease-in-out infinite;
}

.cloud:nth-child(2) {
    width: 300px;
    height: 150px;
    background: radial-gradient(ellipse, rgba(236, 72, 153, 0.12) 0%, rgba(59, 130, 246, 0.08) 50%, transparent 70%);
    top: 60%;
    right: 15%;
    animation: float2 12s ease-in-out infinite;
}

.cloud:nth-child(3) {
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, rgba(59, 130, 246, 0.08) 50%, transparent 70%);
    top: 40%;
    left: 60%;
    animation: float3 10s ease-in-out infinite;
}

.cloud:nth-child(4) {
    width: 250px;
    height: 120px;
    background: radial-gradient(ellipse, rgba(245, 158, 11, 0.1) 0%, rgba(236, 72, 153, 0.06) 50%, transparent 70%);
    top: 80%;
    left: 30%;
    animation: float4 15s ease-in-out infinite;
}

.cloud:nth-child(5) {
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.12) 0%, rgba(16, 185, 129, 0.08) 50%, transparent 70%);
    top: 10%;
    right: 35%;
    animation: float5 9s ease-in-out infinite;
}

/* Dark theme clouds */
body[data-theme="dark"] .cloud:nth-child(1) {
    background: radial-gradient(circle, rgba(59, 130, 246, 0.3) 0%, rgba(147, 51, 234, 0.2) 50%, transparent 70%);
}

body[data-theme="dark"] .cloud:nth-child(2) {
    background: radial-gradient(ellipse, rgba(236, 72, 153, 0.25) 0%, rgba(59, 130, 246, 0.15) 50%, transparent 70%);
}

body[data-theme="dark"] .cloud:nth-child(3) {
    background: radial-gradient(circle, rgba(16, 185, 129, 0.2) 0%, rgba(59, 130, 246, 0.15) 50%, transparent 70%);
}

body[data-theme="dark"] .cloud:nth-child(4) {
    background: radial-gradient(ellipse, rgba(245, 158, 11, 0.2) 0%, rgba(236, 72, 153, 0.1) 50%, transparent 70%);
}

body[data-theme="dark"] .cloud:nth-child(5) {
    background: radial-gradient(circle, rgba(139, 92, 246, 0.25) 0%, rgba(16, 185, 129, 0.15) 50%, transparent 70%);
}

/* Particle System */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(59, 130, 246, 0.4);
    border-radius: 50%;
    box-shadow: 0 0 3px rgba(59, 130, 246, 0.4);
    animation: floatParticle 8s infinite linear;
}

.particle:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
    animation-duration: 12s;
}

.particle:nth-child(2) {
    background: rgba(236, 72, 153, 0.4);
    box-shadow: 0 0 3px rgba(236, 72, 153, 0.4);
    left: 20%;
    animation-delay: -2s;
    animation-duration: 10s;
}

.particle:nth-child(3) {
    background: rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 3px rgba(16, 185, 129, 0.4);
    left: 30%;
    animation-delay: -4s;
    animation-duration: 14s;
}

.particle:nth-child(4) {
    background: rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 3px rgba(245, 158, 11, 0.4);
    left: 40%;
    animation-delay: -6s;
    animation-duration: 11s;
}

.particle:nth-child(5) {
    background: rgba(139, 92, 246, 0.4);
    box-shadow: 0 0 3px rgba(139, 92, 246, 0.4);
    left: 50%;
    animation-delay: -8s;
    animation-duration: 13s;
}

.particle:nth-child(6) {
    background: rgba(59, 130, 246, 0.3);
    box-shadow: 0 0 2px rgba(59, 130, 246, 0.3);
    left: 60%;
    animation-delay: -1s;
    animation-duration: 9s;
    width: 3px;
    height: 3px;
}

.particle:nth-child(7) {
    background: rgba(236, 72, 153, 0.3);
    box-shadow: 0 0 2px rgba(236, 72, 153, 0.3);
    left: 70%;
    animation-delay: -3s;
    animation-duration: 15s;
    width: 3px;
    height: 3px;
}

.particle:nth-child(8) {
    background: rgba(16, 185, 129, 0.3);
    box-shadow: 0 0 2px rgba(16, 185, 129, 0.3);
    left: 80%;
    animation-delay: -5s;
    animation-duration: 8s;
    width: 2px;
    height: 2px;
}

.particle:nth-child(9) {
    background: rgba(245, 158, 11, 0.3);
    box-shadow: 0 0 2px rgba(245, 158, 11, 0.3);
    left: 90%;
    animation-delay: -7s;
    animation-duration: 16s;
    width: 2px;
    height: 2px;
}

.particle:nth-child(10) {
    background: rgba(139, 92, 246, 0.3);
    box-shadow: 0 0 2px rgba(139, 92, 246, 0.3);
    left: 5%;
    animation-delay: -9s;
    animation-duration: 7s;
    width: 2px;
    height: 2px;
}

/* Dark theme particles */
body[data-theme="dark"] .particle:nth-child(1) {
    background: rgba(59, 130, 246, 0.8);
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.8);
}

body[data-theme="dark"] .particle:nth-child(2) {
    background: rgba(236, 72, 153, 0.8);
    box-shadow: 0 0 6px rgba(236, 72, 153, 0.8);
}

body[data-theme="dark"] .particle:nth-child(3) {
    background: rgba(16, 185, 129, 0.8);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.8);
}

body[data-theme="dark"] .particle:nth-child(4) {
    background: rgba(245, 158, 11, 0.8);
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.8);
}

body[data-theme="dark"] .particle:nth-child(5) {
    background: rgba(139, 92, 246, 0.8);
    box-shadow: 0 0 6px rgba(139, 92, 246, 0.8);
}

body[data-theme="dark"] .particle:nth-child(6) {
    background: rgba(59, 130, 246, 0.6);
    box-shadow: 0 0 4px rgba(59, 130, 246, 0.6);
}

body[data-theme="dark"] .particle:nth-child(7) {
    background: rgba(236, 72, 153, 0.6);
    box-shadow: 0 0 4px rgba(236, 72, 153, 0.6);
}

body[data-theme="dark"] .particle:nth-child(8) {
    background: rgba(16, 185, 129, 0.6);
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.6);
}

body[data-theme="dark"] .particle:nth-child(9) {
    background: rgba(245, 158, 11, 0.6);
    box-shadow: 0 0 4px rgba(245, 158, 11, 0.6);
}

body[data-theme="dark"] .particle:nth-child(10) {
    background: rgba(139, 92, 246, 0.6);
    box-shadow: 0 0 4px rgba(139, 92, 246, 0.6);
}

@keyframes floatParticle {
    0% {
        transform: translateY(100vh) translateX(0px) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(-10vh) translateX(50px) rotate(360deg);
        opacity: 0;
    }
}

/* Cloud animation keyframes */
@keyframes float1 {

    0%,
    100% {
        transform: translate(0px, 0px) rotate(0deg);
    }

    33% {
        transform: translate(30px, -30px) rotate(5deg);
    }

    66% {
        transform: translate(-20px, 20px) rotate(-3deg);
    }
}

@keyframes float2 {

    0%,
    100% {
        transform: translate(0px, 0px) rotate(0deg);
    }

    25% {
        transform: translate(-25px, -15px) rotate(-2deg);
    }

    50% {
        transform: translate(35px, -25px) rotate(4deg);
    }

    75% {
        transform: translate(-15px, 30px) rotate(-6deg);
    }
}

@keyframes float3 {

    0%,
    100% {
        transform: translate(0px, 0px) rotate(0deg);
    }

    50% {
        transform: translate(-40px, -40px) rotate(8deg);
    }
}

@keyframes float4 {

    0%,
    100% {
        transform: translate(0px, 0px) rotate(0deg);
    }

    20% {
        transform: translate(20px, -30px) rotate(3deg);
    }

    40% {
        transform: translate(-30px, -15px) rotate(-4deg);
    }

    60% {
        transform: translate(25px, 25px) rotate(2deg);
    }

    80% {
        transform: translate(-15px, 35px) rotate(-5deg);
    }
}

@keyframes float5 {

    0%,
    100% {
        transform: translate(0px, 0px) rotate(0deg);
    }

    40% {
        transform: translate(-35px, 20px) rotate(-7deg);
    }

    60% {
        transform: translate(20px, -25px) rotate(5deg);
    }
}

/* Navbar Styles */
.navbar {
    background: var(--navbar-bg);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background 0.3s ease;
}

.nav-container {
    width: 100%;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand h1 {
    font-size: 1.5rem;
    color: var(--navbar-text);
    margin: 0;
    transition: color 0.3s ease;
}

.version {
    font-size: 0.9rem;
    color: var(--navbar-secondary);
    font-weight: 400;
    margin-left: 0.5rem;
    transition: color 0.3s ease;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    padding: 0;
}

.theme-toggle:hover {
    transform: translateY(-1px) scale(1.05);
}

.nav-btn {
    background: #4299e1;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    /* Match user-btn height */
    box-sizing: border-box;
}

.nav-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(66, 153, 225, 0.3);
    background: #3182ce;
}

.github-btn {
    background: #333;
    margin-right: 0.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.github-btn:hover {
    background: #555;
    box-shadow: 0 4px 8px rgba(51, 51, 51, 0.3);
    transform: translateY(-1px) scale(1.05);
}

.container {
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
    min-height: calc(100vh - 80px);
}

/* Search Section */
.search-section {
    text-align: center;
    margin-bottom: 2rem;
}

.search-section h2 {
    color: var(--text-primary);
    font-size: 2rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    transition: color 0.3s ease;
}

.site-selection {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.site-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: var(--text-primary);
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    transition: color 0.3s ease;
}

.site-option input[type="radio"] {
    margin-right: 0.5rem;
    width: 18px;
    height: 18px;
    accent-color: #4299e1;
}

.radio-label {
    font-size: 1.1rem;
}

.search-container {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
    gap: 0.5rem;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    background: var(--input-bg);
    color: var(--text-secondary);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.search-input::placeholder {
    color: var(--text-tertiary);
    transition: color 0.3s ease;
}

.search-input:focus {
    outline: none;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
}

.search-btn {
    padding: 12px 24px;
    background: #4299e1;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 120px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(66, 153, 225, 0.2);
}

.search-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.search-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(66, 153, 225, 0.4);
    background: #3182ce;
}

.search-btn:hover::before {
    left: 100%;
}

.search-btn:active {
    transform: translateY(-1px) scale(0.98);
    animation: pulse 0.2s ease-in-out;
}

.search-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Results Section */
.results-section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    padding: 2rem;
    margin: 0 3rem 2rem 3rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: background 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

body[data-theme="dark"] .results-section {
    background: rgba(26, 26, 26, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.results-section h3 {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    transition: color 0.3s ease;
}

.results-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
}

.anime-card {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--card-border);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    min-width: 280px;
    flex: 1 1 320px;
    max-width: 450px;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    animation: slideInUp 0.6s ease-out forwards;
}

.anime-card:nth-child(1) {
    animation-delay: 0.1s;
}

.anime-card:nth-child(2) {
    animation-delay: 0.2s;
}

.anime-card:nth-child(3) {
    animation-delay: 0.3s;
}

.anime-card:nth-child(4) {
    animation-delay: 0.4s;
}

.anime-card:nth-child(5) {
    animation-delay: 0.5s;
}

.anime-card:nth-child(6) {
    animation-delay: 0.6s;
}

.anime-card:nth-child(n+7) {
    animation-delay: 0.7s;
}

.anime-card-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(1.5px);
    opacity: 0.6;
    z-index: 1;
    transition: opacity 0.3s ease;
}

.anime-card:hover .anime-card-background {
    opacity: 0.4;
}

.anime-card-content {
    position: relative;
    z-index: 2;
    background: rgba(var(--modal-bg-rgb, 45, 55, 72), 0.85);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    backdrop-filter: blur(2px);
    border-radius: 8px;
}

.anime-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.anime-card:hover .anime-card-content {
    backdrop-filter: blur(5px);
}

.anime-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.anime-info {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    margin-bottom: auto;
    line-height: 1.5;
    flex-grow: 1;
    transition: color 0.3s ease;
}

.anime-actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.download-btn {
    background: #4299e1;
    color: white;
    border: none;
    padding: 10px 28px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.2);
    position: relative;
    overflow: hidden;
    min-width: 120px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.download-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.download-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(66, 153, 225, 0.4);
    background: #3182ce;
}

.download-btn:hover::before {
    left: 100%;
}

.download-btn:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

/* Progress Section */
.progress-section {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #48bb78;
    transition: background 0.3s ease;
}

.progress-section h3 {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 1.2rem;
    transition: color 0.3s ease;
}

.progress-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.progress-header span:first-child {
    font-weight: 600;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--progress-bg);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    transition: background 0.3s ease;
}

.progress-fill {
    height: 100%;
    background: #48bb78;
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-percentage {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: right;
    transition: color 0.3s ease;
}

.progress-details {
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    transition: border-color 0.3s ease;
}

.current-episode {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

/* Queue Section */
.queue-section {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 1rem;
    margin: 0 10rem 1.5rem 10rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border-left: 3px solid #4299e1;
    transition: background 0.3s ease;
}

.queue-section h3 {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.active-downloads,
.completed-downloads {
    margin-bottom: 1rem;
}

.active-downloads:last-child,
.completed-downloads:last-child {
    margin-bottom: 0;
}

.active-downloads h4,
.completed-downloads h4 {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: color 0.3s ease;
}

.active-downloads h4 i {
    color: #48bb78;
}

.completed-downloads h4 i {
    color: #4299e1;
}

.queue-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.queue-item {
    background: var(--input-bg);
    border-radius: 6px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.queue-item:hover {
    border-color: #4299e1;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(66, 153, 225, 0.12);
}

.queue-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.queue-item-title {
    font-weight: 600;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.queue-item-status {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.queue-item-status.queued {
    background: rgba(237, 137, 54, 0.2);
    color: #ed8936;
}

.queue-item-status.downloading {
    background: rgba(72, 187, 120, 0.2);
    color: #48bb78;
}

.queue-item-status.completed {
    background: rgba(66, 153, 225, 0.2);
    color: #4299e1;
}

.queue-item-status.failed {
    background: rgba(245, 101, 101, 0.2);
    color: #f56565;
}

.queue-item-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.queue-progress-bar {
    flex: 1;
    /* Take available space */
    max-width: calc(100% - 180px);
    /* Leave space for text, then remove 10% */
    width: 90%;
    /* Use 90% of available width */
    height: 6px;
    background: var(--progress-bg);
    border-radius: 3px;
    overflow: hidden;
    transition: background 0.3s ease;
    border: 1px solid var(--border-color);
}

.queue-progress-fill {
    height: 100%;
    background: #48bb78;
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
    box-shadow: 0 0 4px rgba(72, 187, 120, 0.3);
}

/* Dark mode specific progress bar improvements */
body[data-theme="dark"] .queue-progress-bar {
    background: #1a202c;
    border: 1px solid #4a5568;
}

body[data-theme="dark"] .queue-progress-fill {
    background: #68d391;
    box-shadow: 0 0 6px rgba(104, 211, 145, 0.4);
}

.queue-progress-text {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    min-width: 60px;
    text-align: right;
    transition: color 0.3s ease;
}

/* Episode-specific progress bar styles */
.episode-progress {
    margin-top: 0.5rem;
}

.episode-progress .queue-progress-bar {
    height: 4px;
    background: var(--progress-bg-secondary, #f7fafc);
    flex: 1;
    /* Take available space */
    max-width: calc(100% - 180px);
    /* Leave space for text, then remove 10% - same as main progress bar */
    width: 90%;
    /* Use 90% of available width - same as main progress bar */
}

.episode-progress-fill {
    background: #4299e1 !important;
    box-shadow: 0 0 4px rgba(66, 153, 225, 0.3) !important;
}

.episode-progress-text {
    font-size: 0.8rem !important;
    color: var(--text-quaternary, #a0aec0) !important;
    min-width: 120px !important;
}

/* Dark mode episode progress */
body[data-theme="dark"] .episode-progress .queue-progress-bar {
    background: #0d1117;
    border: 1px solid #30363d;
    flex: 1;
    /* Take available space */
    max-width: calc(100% - 180px);
    /* Leave space for text, then remove 10% - same as main progress bar */
    width: 90%;
    /* Use 90% of available width - same as main progress bar */
}

body[data-theme="dark"] .episode-progress-fill {
    background: #58a6ff !important;
    box-shadow: 0 0 6px rgba(88, 166, 255, 0.4) !important;
}

body[data-theme="dark"] .episode-progress-text {
    color: #8b949e !important;
}

.queue-item-details {
    color: var(--text-tertiary);
    font-size: 0.85rem;
    transition: color 0.3s ease;
}

/* Loading Section */
.loading-section {
    text-align: center;
    padding: 3rem;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--text-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
    transition: border-color 0.3s ease;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    opacity: 0.8;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: var(--modal-bg);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: scaleIn 0.3s ease-out;
    transition: background 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    transition: border-color 0.3s ease;
}

.modal-header h3 {
    color: var(--text-secondary);
    margin: 0;
    transition: color 0.3s ease;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: var(--tree-hover);
    color: var(--text-secondary);
}

.modal-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.download-info p {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    transition: color 0.3s ease;
    word-wrap: break-word;
    word-break: break-all;
    overflow-wrap: break-word;
}

.download-info strong {
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.path-info-icon {
    color: var(--text-tertiary);
    margin-left: 8px;
    font-size: 0.9em;
    cursor: help;
    transition: color 0.3s ease;
}

.path-info-icon:hover {
    color: var(--text-secondary);
}

#download-path {
    word-wrap: break-word;
    word-break: break-all;
    overflow-wrap: break-word;
    display: inline-block;
    max-width: 100%;
}

/* Download Settings Styles */
.download-settings {
    margin: 1.5rem 0;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    transition: border-color 0.3s ease;
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    min-width: 85px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.3s ease;
}

.provider-dropdown,
.language-dropdown {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.provider-dropdown:focus,
.language-dropdown:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.provider-dropdown:hover,
.language-dropdown:hover {
    border-color: var(--text-tertiary);
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.3s ease;
}

.modal-actions {
    display: flex;
    gap: 1rem;
}

.selected-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

/* Episode Selection Styles */
.episode-selection {
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    transition: border-color 0.3s ease;
}

.selection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.selection-header h4 {
    color: var(--text-secondary);
    margin: 0;
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.selection-controls {
    display: flex;
    gap: 0.5rem;
}

.control-btn {
    background: var(--tree-header-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: var(--tree-hover);
    border-color: var(--text-tertiary);
}

.episode-tree-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem;
    color: var(--text-tertiary);
    transition: color 0.3s ease;
}

.loading-spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transition: border-color 0.3s ease;
}

.episode-tree {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--tree-bg);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.season-container {
    border-bottom: 1px solid var(--border-color);
    transition: border-color 0.3s ease;
}

.season-container:last-child {
    border-bottom: none;
}

.season-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--tree-header-bg);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.3s ease;
}

.season-header:hover {
    background: var(--tree-hover);
}

.season-checkbox {
    cursor: pointer;
}

.season-label {
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    flex: 1;
    transition: color 0.3s ease;
}

.episodes-container {
    background: var(--modal-bg);
    transition: background 0.3s ease;
}

.episode-item-tree {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border-bottom: 1px solid var(--tree-header-bg);
    transition: background-color 0.2s ease, border-color 0.3s ease;
}

.episode-item-tree:last-child {
    border-bottom: none;
}

.episode-item-tree:hover {
    background: var(--tree-bg);
}

.episode-checkbox {
    cursor: pointer;
}

.episode-label {
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    flex: 1;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

/* Button Styles */
.primary-btn,
.secondary-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.primary-btn {
    background: #4299e1;
    color: white;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.4);
    background: #3182ce;
}

.secondary-btn {
    background: var(--button-secondary-bg);
    color: var(--button-secondary-text);
    border: 1px solid var(--border-color);
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.secondary-btn:hover {
    background: var(--tree-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Responsive Design */
/* Large screens - more cards per row */
@media (min-width: 1400px) {
    .results-section {
        margin: 0 4rem 2rem 4rem;
    }

    .anime-card {
        flex: 1 1 300px;
        max-width: 400px;
    }
}

/* Medium screens - balanced layout */
@media (max-width: 1200px) {
    .results-section {
        margin: 0 2rem 2rem 2rem;
    }

    .anime-card {
        flex: 1 1 280px;
        max-width: 380px;
    }
}

/* Small screens - fewer cards per row */
@media (max-width: 900px) {
    .results-section {
        margin: 0 1.5rem 2rem 1.5rem;
    }

    .anime-card {
        flex: 1 1 250px;
        max-width: 350px;
    }
}

/* Mobile screens */
@media (max-width: 768px) {
    .nav-container {
        padding: 1rem;
    }

    .nav-brand h1 {
        font-size: 1.2rem;
    }

    .container {
        padding: 1rem;
    }

    .search-container {
        flex-direction: column;
    }

    .search-btn {
        min-width: auto;
    }

    .results-section {
        margin: 0 1rem 2rem 1rem;
    }

    .anime-card {
        min-width: unset;
        max-width: unset;
        flex: 1 1 100%;
    }

    .modal-content {
        margin: 1rem;
        width: calc(100% - 2rem);
        max-height: 90vh;
    }

    .modal-footer {
        flex-direction: column;
    }

    .primary-btn,
    .secondary-btn {
        width: 100%;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

@keyframes bounce {

    0%,
    20%,
    60%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    80% {
        transform: translateY(-5px);
    }
}

.primary-btn:active,
.secondary-btn:active,
.download-btn:active {
    animation: pulse 0.2s ease-in-out;
}

/* Home Content Styles */
.home-content {
    padding: 2rem;
    text-align: center;
}

.anime-section {
    margin-bottom: 3rem;
}

.anime-section h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.anime-section h3 i {
    color: #667eea;
}

.anime-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 1rem;
    justify-content: center;
    max-width: 1400px;
    margin: 0 auto;
}

.home-anime-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.home-anime-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.home-anime-cover {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
}

.home-anime-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.home-anime-card:hover .home-anime-cover img {
    transform: scale(1.05);
}

.home-anime-title {
    padding: 0.6rem 0.4rem;
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    box-sizing: border-box;
}

/* Responsive adjustments for home content */
@media (max-width: 1200px) {
    .anime-grid {
        grid-template-columns: repeat(6, 1fr);
        max-width: 1100px;
        gap: 0.8rem;
    }
}

@media (max-width: 900px) {
    .anime-grid {
        grid-template-columns: repeat(4, 1fr);
        max-width: 800px;
        gap: 0.8rem;
    }
}

@media (max-width: 768px) {
    .home-content {
        padding: 1rem;
    }

    .anime-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 600px;
        gap: 0.8rem;
    }

    .home-anime-cover {
        height: 150px;
    }

    .anime-section h3 {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .anime-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 400px;
        gap: 0.8rem;
    }

    .home-anime-cover {
        height: 140px;
    }

    .home-anime-title {
        font-size: 0.7rem;
        height: 2.5rem;
        padding: 0.4rem 0.3rem;
    }
}