/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #0a0a0a;
    background: #fafafa;
    min-height: 100vh;
    padding: 40px 20px;
    position: relative;
}

/* Subtle grid pattern background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

/* Container - Clean Minimalist Card */
.container {
    max-width: 580px;
    margin: 0 auto;
    background: #ffffff;
    padding: 48px 40px;
    border-radius: 16px;
    border: 1px solid #e5e5e5;
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.05),
        0 20px 40px rgba(0, 0, 0, 0.03);
    position: relative;
    z-index: 1;
    animation: fadeIn 0.4s ease-out;
}

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

/* Heading */
h1 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #0a0a0a;
    text-align: center;
    letter-spacing: -0.5px;
}

h1::before {
    content: '▶';
    color: #FF0000;
    margin-right: 8px;
    font-size: 28px;
}

/* Subtitle */
h1::after {
    content: 'Extract transcripts from any YouTube playlist';
    display: block;
    font-size: 14px;
    font-weight: 400;
    color: #737373;
    margin-top: 8px;
    letter-spacing: 0;
}

/* Form Styles */
#playlistForm {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 32px 0 24px 0;
}

#playlistUrl {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    border: 1.5px solid #e5e5e5;
    border-radius: 10px;
    transition: all 0.2s ease;
    background: #fafafa;
    font-family: inherit;
}

#playlistUrl:hover {
    border-color: #d4d4d4;
    background: #ffffff;
}

#playlistUrl:focus {
    outline: none;
    border-color: #0a0a0a;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

#playlistUrl::placeholder {
    color: #a3a3a3;
}

button[type="submit"] {
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 500;
    color: #ffffff;
    background: #0a0a0a;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

button[type="submit"]:hover {
    background: #171717;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

button[type="submit"]:active {
    transform: translateY(0);
}

button[type="submit"]:disabled {
    background: #e5e5e5;
    color: #a3a3a3;
    cursor: not-allowed;
    transform: none;
}

/* Status Display */
#status {
    padding: 14px 16px;
    margin-bottom: 16px;
    border-radius: 10px;
    font-size: 14px;
    animation: slideDown 0.3s ease;
    border: 1.5px solid;
}

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

#status.error {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

#status.error::before {
    content: '⚠ ';
}

#status.success {
    background: #f0fdf4;
    color: #16a34a;
    border-color: #bbf7d0;
}

#status.success::before {
    content: '✓ ';
}

#status.info {
    background: #fafafa;
    color: #525252;
    border-color: #e5e5e5;
}

/* Progress Display */
#progress {
    padding: 18px;
    margin-bottom: 20px;
    background: #fafafa;
    border: 1.5px solid #e5e5e5;
    border-radius: 10px;
    font-size: 14px;
    animation: slideDown 0.3s ease;
}

#progress .progress-text {
    margin-bottom: 12px;
    color: #0a0a0a;
    font-weight: 500;
}

#progress .progress-bar-container {
    width: 100%;
    height: 6px;
    background: #e5e5e5;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
}

#progress .progress-bar {
    height: 100%;
    background: #0a0a0a;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 6px;
}

#progress .video-status {
    font-size: 13px;
    color: #737373;
    margin-top: 6px;
}

/* Loading Spinner Animation */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #e5e5e5;
    border-top-color: #0a0a0a;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* Download Button */
#downloadBtn {
    width: 100%;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 500;
    color: #ffffff;
    background: #FF0000;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    animation: slideDown 0.3s ease;
    font-family: inherit;
}

#downloadBtn::before {
    content: '↓ ';
    font-size: 16px;
    margin-right: 4px;
}

#downloadBtn:hover {
    background: #cc0000;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.25);
}

#downloadBtn:active {
    transform: translateY(0);
}

/* Hidden Utility Class */
.hidden {
    display: none !important;
}

/* Footer credit */
.container::after {
    content: 'Made with ♥ for YouTube creators';
    display: block;
    text-align: center;
    font-size: 12px;
    color: #a3a3a3;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #f5f5f5;
}

/* Mobile Responsive Styles (≤768px) */
@media screen and (max-width: 768px) {
    body {
        padding: 20px 16px;
    }

    .container {
        padding: 36px 24px;
        border-radius: 12px;
    }

    h1 {
        font-size: 28px;
    }

    h1::after {
        font-size: 13px;
    }

    #playlistUrl {
        padding: 13px 14px;
        font-size: 16px; /* Prevents iOS zoom */
    }

    button[type="submit"],
    #downloadBtn {
        padding: 13px 20px;
        font-size: 16px;
        min-height: 48px;
    }

    #status,
    #progress {
        padding: 12px 14px;
        font-size: 13px;
    }
}

/* Extra small screens (≤480px) */
@media screen and (max-width: 480px) {
    .container {
        padding: 32px 20px;
    }

    h1 {
        font-size: 24px;
    }

    h1::before {
        font-size: 22px;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    body {
        background: #0a0a0a;
        color: #fafafa;
    }

    body::before {
        background-image: 
            linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
            linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    }

    .container {
        background: #171717;
        border-color: #262626;
    }

    h1 {
        color: #fafafa;
    }

    h1::after {
        color: #a3a3a3;
    }

    #playlistUrl {
        background: #0a0a0a;
        border-color: #262626;
        color: #fafafa;
    }

    #playlistUrl:hover {
        border-color: #404040;
        background: #171717;
    }

    #playlistUrl:focus {
        border-color: #fafafa;
        background: #171717;
        box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
    }

    #playlistUrl::placeholder {
        color: #737373;
    }

    button[type="submit"] {
        background: #fafafa;
        color: #0a0a0a;
    }

    button[type="submit"]:hover {
        background: #ffffff;
    }

    button[type="submit"]:disabled {
        background: #262626;
        color: #737373;
    }

    #status.info {
        background: #171717;
        color: #d4d4d4;
        border-color: #262626;
    }

    #progress {
        background: #171717;
        border-color: #262626;
    }

    #progress .progress-text {
        color: #fafafa;
    }

    #progress .progress-bar-container {
        background: #262626;
    }

    #progress .progress-bar {
        background: #fafafa;
    }

    #progress .video-status {
        color: #a3a3a3;
    }

    .spinner {
        border-color: #262626;
        border-top-color: #fafafa;
    }

    .container::after {
        color: #737373;
        border-top-color: #262626;
    }
}

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

/* Print styles */
@media print {
    body {
        background: #fff;
    }

    body::before {
        display: none;
    }

    .container {
        box-shadow: none;
        border: 1px solid #e5e5e5;
    }

    .container::after {
        display: none;
    }

    button,
    #downloadBtn {
        display: none;
    }
}
