/* Custom styles for Letterboxd Telegram Mini App */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

body {
    font-family: 'Inter', sans-serif;
    background-color: #f3f4f6;
    transition: background-color 0.3s ease;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

.dark body {
    background-color: #111827;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c7d2fe;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a5b4fc;
}

.dark ::-webkit-scrollbar-track {
    background: #1f2937;
}

.dark ::-webkit-scrollbar-thumb {
    background: #4b5563;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Animation classes */
.animate-fadeIn {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-slideUp {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}

.animate-bounce {
    animation: bounce 1s infinite;
}

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

/* Card hover effect */
.card-hover {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Rating badge styles */
.rating-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: bold;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Gradient backgrounds */
.gradient-bg {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
}

.gradient-text {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Custom button styles */
.btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.3), 0 4px 6px -2px rgba(99, 102, 241, 0.1);
}

/* Movie card specific styles */
.movie-card {
    transition: all 0.3s ease;
    overflow: hidden;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    min-height: 200px;
}

.movie-card:hover {
    transform: scale(1.03);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Tag styles */
.tag {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background-color: #e0e7ff;
    color: #4f46e5;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

.dark .tag {
    background-color: #3730a3;
    color: #c7d2fe;
}

/* Loading spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.dark .spinner {
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: #818cf8;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive adjustments for mobile devices */
.container {
    width: 100%;
    max-width: 100%;
    padding: 0.5rem;
    margin: 0 auto;
}

@media (min-width: 640px) {
    .container {
        max-width: 640px;
        padding: 0 1rem;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 768px;
        padding: 0 1rem;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 1024px;
        padding: 0 1rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0.5rem;
    }

    .grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-cols-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .flex-md-column {
        flex-direction: column;
    }

    .text-md-center {
        text-align: center;
    }

    /* Mobile-specific navigation */
    .mobile-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #e5e7eb;
        z-index: 50;
        padding: 0.5rem 0;
        box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
    }

    .dark .mobile-nav {
        background: #1f2937;
        border-top-color: #374151;
    }

    /* Mobile-friendly button sizes */
    .btn-mobile {
        padding: 0.75rem 1rem;
        font-size: 1rem;
        min-height: 48px;
    }

    /* Mobile-friendly input fields */
    input, textarea, select {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Mobile-friendly header */
    .mobile-header {
        padding: 0.75rem 1rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: white;
        border-bottom: 1px solid #e5e7eb;
        position: sticky;
        top: 0;
        z-index: 40;
    }

    .dark .mobile-header {
        background: #1f2937;
        border-bottom-color: #374151;
    }

    /* Mobile-friendly navigation tabs */
    .mobile-tabs {
        display: flex;
        overflow-x: auto;
        -ms-overflow-style: none;
        scrollbar-width: none;
        padding: 0.5rem 0;
        background: white;
        border-bottom: 1px solid #e5e7eb;
    }

    .dark .mobile-tabs {
        background: #1f2937;
        border-bottom-color: #374151;
    }

    .mobile-tabs::-webkit-scrollbar {
        display: none;
    }

    .mobile-tab {
        flex: 0 0 auto;
        padding: 0.75rem 1rem;
        white-space: nowrap;
        font-weight: 500;
        color: #6b7280;
        border-bottom: 2px solid transparent;
    }

    .dark .mobile-tab {
        color: #9ca3af;
    }

    .mobile-tab.active {
        color: #4f46e5;
        border-bottom-color: #4f46e5;
    }

    .dark .mobile-tab.active {
        color: #818cf8;
        border-bottom-color: #818cf8;
    }
}

@media (max-width: 640px) {
    .grid-cols-2 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }

    .grid-cols-3 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }

    .text-sm-center {
        text-align: center;
    }

    /* Mobile-specific styles */
    .mobile-full-width {
        width: 100%;
        max-width: 100%;
    }

    /* Larger touch targets for mobile */
    .touch-target {
        min-height: 44px;
        min-width: 44px;
        padding: 0.5rem;
    }

    /* Mobile-friendly card layout */
    .mobile-card {
        margin: 0.5rem;
        border-radius: 0.75rem;
    }

    /* Mobile-friendly form elements */
    .mobile-input {
        padding: 0.75rem;
        border-radius: 0.5rem;
        border: 1px solid #d1d5db;
        font-size: 1rem;
        width: 100%;
    }

    .dark .mobile-input {
        background: #1f2937;
        border-color: #374151;
        color: white;
    }

    /* Mobile-friendly modal */
    .mobile-modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 100;
        display: flex;
        align-items: flex-end;
        justify-content: center;
    }

    .mobile-modal-content {
        width: 100%;
        max-height: 80vh;
        overflow-y: auto;
        background: white;
        border-top-left-radius: 1rem;
        border-top-right-radius: 1rem;
        padding: 1.5rem;
        box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
    }

    .dark .mobile-modal-content {
        background: #1f2937;
    }
}

@media (min-width: 641px) {
    .desktop-nav {
        position: sticky;
        top: 0;
        z-index: 40;
    }

    /* Desktop-specific styles */
    .desktop-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1rem;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus styles for accessibility */
.focus-outline:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* Transitions for theme switching */
.theme-transition {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Ripple effect for buttons */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.ripple:active::after {
    animation: ripple 0.6s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0) translate(-50%, -50%);
        opacity: 0.5;
    }
    100% {
        transform: scale(20, 20) translate(-50%, -50%);
        opacity: 0;
    }
}

/* Mobile-specific improvements for movie cards */
@media (max-width: 640px) {
    .movie-card {
        min-height: auto;
    }

    .movie-card img {
        height: 200px;
        object-fit: cover;
    }

    .movie-info {
        padding: 0.75rem;
    }

    .movie-title {
        font-size: 0.9rem;
        font-weight: 600;
    }

    .movie-year {
        font-size: 0.8rem;
    }
}

/* Improve touch targets for mobile */
button, [role="button"] {
    min-height: 44px;
    min-width: 44px;
}

/* Better spacing for mobile */
.mobile-spaced {
    margin: 0.5rem 0;
}

/* Mobile-friendly navigation buttons */
.nav-button {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Footer for mobile */
.mobile-footer {
    padding: 1rem;
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
}

.dark .mobile-footer {
    color: #9ca3af;
}