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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #10b981;
    --danger: #ef4444;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --border: #475569;
}

html {
background-color: #1a1a2e;	
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1a1a2e 100%); 
    color: var(--text-primary);
    overflow-x: hidden;
}

/* App Container */
.app-container {
    display: flex;
    position: relative;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1002;
    background: var(--bg-secondary);
    border: none;
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
}

.mobile-menu-toggle span {
    width: 24px;
    height: 3px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
}

/* User Info */
.user-info {
    position: fixed;
    top: 1.5rem;
    right: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-secondary);
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    z-index: 100;
    border: 1px solid var(--border);
}

#userWelcome {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.logout-btn {
    background: var(--danger);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

/* Only apply logout button hover on non-touch devices */
@media (hover: hover) and (pointer: fine) {
    .logout-btn:hover {
        background: #dc2626;
        transform: translateY(-1px);
    }
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 2rem 1.5rem;
    position: fixed;
    height: 100vh;
    height: 100dvh; /* Use dynamic viewport height for iOS */
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 1000;
    -webkit-overflow-scrolling: touch;
}

.logo {
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.logo h2 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

/* Only apply nav item hover on non-touch devices */
@media (hover: hover) and (pointer: fine) {
    .nav-item:hover {
        background: var(--bg-tertiary);
        color: var(--text-primary);
    }
    
    .nav-item.active:hover {
        background: var(--primary);
        color: white;
    }
}

.nav-icon {
    font-size: 1.25rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem 3rem;
    padding-top: 5rem;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.section-header {
    margin-bottom: 2.5rem;
}

.section-header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* Collection Stats */
.collection-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 1.75rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

/* Carousel */
.collection-carousel {
    position: relative;
    margin-bottom: 2rem;
}

.carousel-container {
    overflow: hidden;
    padding: 1rem 0;
}

.carousel-track {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Only apply carousel button hover on non-touch devices */
@media (hover: hover) and (pointer: fine) {
    .carousel-btn:hover:not(:disabled) {
        background: var(--primary);
        border-color: var(--primary);
    }
}

.carousel-prev {
    left: -24px;
}

.carousel-next {
    right: -24px;
}

/* Content Card */
.content-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    /* Fix for mobile/tablet rendering issues */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.content-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
    border-color: var(--primary);
}

.card-poster {
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.card-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

/* Mobile/Tablet specific image fixes */
@media (max-width: 1024px) {
    .card-poster {
        contain: layout;
    }
}

.no-image {
    font-size: 4rem;
    opacity: 0.5;
}

.card-content {
    padding: 1.25rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-author {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    margin-bottom: 0.25rem;
}

.card-price {
    font-size: 0.9rem;
    color: var(--secondary);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.card-rating {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    text-align: center;
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.action-btn {
    flex: 1;
    min-width: 100px;
    padding: 0.65rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.add-btn {
    background: var(--secondary);
    color: white;
}

.add-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.rate-btn {
    background: var(--primary);
    color: white;
}

.remove-btn {
    background: var(--danger);
    color: white;
}

.view-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Only apply button hover effects on non-touch devices */
@media (hover: hover) and (pointer: fine) {
    .add-btn:hover:not(:disabled) {
        background: #059669;
    }
    
    .rate-btn:hover {
        background: var(--primary-dark);
    }
    
    .remove-btn:hover {
        background: #dc2626;
    }
    
    .view-btn:hover {
        background: var(--border);
    }
}

/* Search Section */
.search-container {
    max-width: 1400px;
}

.search-box {
    position: relative;
    margin-bottom: 2rem;
    max-width: 600px;
}

.search-box input {
    width: 100%;
    padding: 1rem 3.5rem 1rem 3.5rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.15rem; /* MODIFIED: Increased font size */
    transition: all 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    pointer-events: none;
}

.search-clear {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.search-clear:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Pagination */
.pagination-info {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1; /* Span all columns in grid */
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-tertiary);
    font-size: 1.1rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.loading {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.error {
    text-align: center;
    padding: 2rem;
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    border-radius: 12px;
    margin: 1rem 0;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border);
}

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

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
}

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

.close-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 2rem;
}

/* Auth Section */
.auth-section {
    text-align: center;
}

.auth-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

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

.form-group {
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1.15rem; /* MODIFIED: Increased font size */
    transition: all 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.submit-btn:hover:not(:disabled) {
    background: var(--primary-dark);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-error {
    padding: 0.875rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    border-radius: 8px;
    color: var(--danger);
    font-size: 0.9rem;
}

/* Rating Modal */
.content-preview {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.modal-poster {
    width: 120px;
    height: 120px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.no-poster {
    font-size: 3rem;
    opacity: 0.5;
}

.content-details {
    flex: 1;
}

.content-details h4 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.content-details p {
    color: var(--text-tertiary);
    margin-bottom: 0.5rem;
}

.content-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.rating-section {
    text-align: center;
}

.rating-label {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.star-rating {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.star {
    font-size: 2.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.3;
    user-select: none;
    position: relative;
}

.star.active {
    opacity: 1;
    transform: scale(1.1);
}

.star.half {
    opacity: 1;
    transform: scale(1.1);
}

.star.half::after {
    content: '⭐';
    position: absolute;
    left: 0;
    top: 0;
    width: 50%;
    overflow: hidden;
    opacity: 0.5;
}

/* Only apply hover effects on non-touch devices */
@media (hover: hover) and (pointer: fine) {
    .star:hover {
        transform: scale(1.2);
    }
}

.rating-value {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

/* Confirm Modal */
.confirm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 2001;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.confirm-modal-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    max-width: 450px;
    width: 100%;
    border: 1px solid var(--border);
}

.confirm-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.confirm-modal-icon {
    font-size: 2rem;
}

.confirm-modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.confirm-modal-body {
    padding: 1.5rem;
}

.confirm-modal-message {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

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

.confirm-btn {
    flex: 1;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.confirm-btn-cancel {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.confirm-btn-cancel:hover {
    background: var(--border);
}

.confirm-btn-confirm {
    background: var(--danger);
    color: white;
}

.confirm-btn-confirm:hover {
    background: #dc2626;
}

/* Notification */
.notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-secondary);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    z-index: 3000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

.notification.success {
    border-color: var(--secondary);
    color: var(--secondary);
}

.notification.error {
    border-color: var(--danger);
    color: var(--danger);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        margin-left: 280px;
        padding: 2rem 1.5rem;
        padding-top: 5rem;
    }
    
    .carousel-track,
    .content-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .mobile-overlay.active {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
        padding: 1.5rem 1rem;
        padding-top: 4.5rem;
    }
    
    .user-info {
        top: 1rem;
        right: 1rem;
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .section-header h1 {
        font-size: 1.75rem;
    }
    
    .collection-stats {
        grid-template-columns: 1fr;
    }
    
    .carousel-btn {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    .carousel-prev {
        left: -20px;
    }
    
    .carousel-next {
        right: -20px;
    }
    
    .carousel-track,
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .content-preview {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    body:has(.sidebar.active) .mobile-menu-toggle {
        display: none;
    }
}
/* Auth Sections */
.auth-section {
    animation: fadeIn 0.3s ease;
}

.auth-subtitle {
    text-align: center;
    color: #aaa;
    margin-bottom: 30px;
    font-size: 14px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.form-group label {
    font-weight: 500;
    color: #fff;
    font-size: 14px;
}

.form-group input {
    padding: 12px 16px;
    border: 2px solid #2d3561;
    border-radius: 8px;
    background-color: #1a1a2e;
    color: #fff;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #4ecdc4;
    background-color: #16213e;
}

.form-group small {
    color: #888;
    font-size: 12px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #2d3561;
}

.auth-footer p {
    color: #aaa;
    font-size: 14px;
}

.auth-footer a {
    color: #4ecdc4;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.auth-footer a:hover {
    color: #3ba89f;
    text-decoration: underline;
}

/* Verification Section */
.verification-message {
    text-align: center;
    color: #aaa;
    margin-bottom: 20px;
    line-height: 1.6;
}

.verification-message strong {
    color: #4ecdc4;
}

.verification-timer {
    text-align: center;
    margin-top: 20px;
    padding: 12px;
    background-color: #16213e;
    border-radius: 8px;
    color: #4ecdc4;
    font-weight: 500;
    font-size: 14px;
}

#verificationCode {
    text-align: center;
    font-size: 28px; /* MODIFIED: Increased font size from 24px */
    letter-spacing: 8px;
    font-weight: 600;
}

/* Loading animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* --- Price Filter Card Styling (using the simple structure) --- */

.stat-card {
    cursor: pointer; /* Makes them feel like buttons */
    transition: all 0.2s ease;
}

/* Active Price Card Styling */
.stat-card.active {
    background: var(--primary); /* Primary color when active */
    border-color: var(--primary);
}

.stat-card.active .stat-number {
    color: white; /* White number when active */
}

@media (hover: hover) and (pointer: fine) {
    .stat-card:hover {
        background: var(--bg-tertiary);
        transform: translateY(-2px);
    }
}


/* --- A-Z Filter Bar Styling --- */

.az-filter-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    /* This adds the requested space between letters */
    gap: 0.25rem 0.5rem; 
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.az-link {
    /* Adds spacing and defines the button shape */
    padding: 0.25rem 0.65rem; 
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

/* Active A-Z link */
.az-link.active {
    background: var(--primary);
    color: white;
    font-weight: 600;
}