/* ============================================
   Live Chat Downloader - Let's Go Live Branding
   ============================================ */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&family=Lato:wght@400;500;600&display=swap');

/* CSS Variables for LGL theming */
:root {
    --primary-color: #F34568;
    --primary-hover: #DF4798;
    --accent-orange: #FFA535;
    --accent-purple: #7567F8;
    --success-color: #0DD290;
    --error-color: #ef4444;
    --text-primary: #2E323C;
    --text-secondary: #5D6371;
    --bg-primary: #f9fafb;
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --font-heading: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --bg-primary: #111827;
        --bg-card: #1f2937;
        --border-color: #374151;
    }
}

/* ============================================
   Base Styles
   ============================================ */

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

body {
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
}

/* ============================================
   Container & Card
   ============================================ */

.container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    position: relative;
}

/* ============================================
   Home Page Styles
   ============================================ */

.icon-wrapper {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--accent-orange) 0%, var(--primary-color) 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.icon {
    width: 36px;
    height: 36px;
    color: white;
}

.title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.subtitle {
    font-size: 1rem;
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.powered-by {
    font-size: 0.875rem;
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.powered-by a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.powered-by a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ============================================
   Input Styles
   ============================================ */

.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.url-input {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-family: var(--font-body);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    transition: all 0.2s ease;
    background: var(--bg-card);
    color: var(--text-primary);
}

.url-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(243, 69, 104, 0.15);
}

.input-label {
    position: absolute;
    left: 1rem;
    top: 1rem;
    color: var(--text-secondary);
    pointer-events: none;
    transition: all 0.2s ease;
    background: var(--bg-card);
    padding: 0 0.25rem;
}

.input-group.focused .input-label,
.input-group.filled .input-label {
    top: -0.5rem;
    left: 0.75rem;
    font-size: 0.75rem;
    color: var(--primary-color);
}

/* ============================================
   Button Styles
   ============================================ */

.download-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-family: var(--font-heading);
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--accent-orange) 0%, var(--primary-color) 100%);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

.download-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
}

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

.download-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-icon {
    width: 20px;
    height: 20px;
}

.success-btn {
    background: linear-gradient(135deg, var(--success-color) 0%, #0AAF78 100%);
}

.success-btn:hover {
    background: linear-gradient(135deg, #0AAF78 0%, #089968 100%);
}

.error-btn {
    background: linear-gradient(135deg, var(--error-color) 0%, #dc2626 100%);
}

.error-btn:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

/* ============================================
   Info Box
   ============================================ */

.info-box {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.info-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    line-height: 1.6;
}

.info-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

/* ============================================
   Status Page Styles
   ============================================ */

.status-card {
    max-width: 560px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--primary-color);
}

.back-link svg {
    width: 16px;
    height: 16px;
}

.video-info {
    margin-bottom: 2rem;
}

.video-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

/* ============================================
   Status States
   ============================================ */

.status-section {
    margin-bottom: 2rem;
}

.status-state {
    text-align: center;
    padding: 2rem 1rem;
}

.status-state.hidden {
    display: none;
}

.status-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.status-icon svg {
    width: 36px;
    height: 36px;
}

.status-icon.spinner {
    background: linear-gradient(135deg, var(--accent-purple) 0%, #5B4CD9 100%);
    animation: pulse 2s ease-in-out infinite;
}

.status-icon.spinner svg {
    color: white;
    animation: spin 1s linear infinite;
}

.status-icon.success {
    background: linear-gradient(135deg, var(--success-color) 0%, #0AAF78 100%);
}

.status-icon.success svg {
    color: white;
    animation: scaleIn 0.3s ease-out;
}

.status-icon.error {
    background: linear-gradient(135deg, var(--error-color) 0%, #dc2626 100%);
}

.status-icon.error svg {
    color: white;
    animation: shake 0.5s ease-out;
}

.status-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.status-message {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.error-message {
    color: var(--error-color);
}

/* ============================================
   Progress Bar
   ============================================ */

.progress-wrapper {
    margin-top: 2rem;
}

.progress-wrapper.hidden {
    display: none;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-primary);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-orange) 0%, var(--primary-color) 100%);
    border-radius: 999px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

.progress-text {
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ============================================
   Animations
   ============================================ */

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

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

@keyframes scaleIn {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 640px) {
    .card {
        padding: 2rem 1.5rem;
    }

    .title {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 0.875rem;
    }

    .status-title {
        font-size: 1.25rem;
    }

    .icon-wrapper {
        width: 56px;
        height: 56px;
    }

    .icon {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 400px) {
    body {
        padding: 0.5rem;
    }

    .card {
        padding: 1.5rem 1rem;
    }
}

/* ============================================
   Accessibility
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid var(--text-primary);
    }

    .download-btn {
        border: 2px solid transparent;
    }
}

/* ============================================
   Additional Styles
   ============================================ */

/* Error box on index page */
.error-box {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.error-text {
    color: var(--error-color);
    font-size: 0.9rem;
    margin: 0;
}

/* Cached badge */
.cached-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--success-color), #0AAF78);
    color: white;
    font-size: 0.75rem;
    font-family: var(--font-heading);
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    margin-left: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Video info container */
.video-info {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

/* Footer */
.footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.footer-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.footer-text a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer-text a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}
