/* ========================
   StreamHub — Main Stylesheet
   Netflix-inspired dark theme
   ======================== */

/* ========================
   RESET & BASE
   ======================== */

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

:root {
    --bg-primary: #141414;
    --bg-secondary: #1a1a1a;
    --bg-card: rgba(20, 20, 20, 0.95);
    --bg-card-hover: rgba(30, 30, 30, 0.95);
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #666666;
    --accent: #e50914;
    --accent-hover: #b20710;
    --accent-glow: rgba(229, 9, 20, 0.35);
    --success: #22c55e;
    --warning: #facc15;
    --error: #ef4444;
    --info: #3b82f6;
    --border: rgba(255, 255, 255, 0.08);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.65);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background:
        linear-gradient(rgba(0, 0, 0, 0.84), rgba(0, 0, 0, 0.95)),
        url("https://images.unsplash.com/photo-1489599849927-2ee91cede3ba?q=80&w=1974&auto=format&fit=crop");
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    color: var(--text-primary);
    padding: 40px 20px;
    line-height: 1.6;
}

/* ========================
   CONTAINER
   ======================== */

.container {
    max-width: 720px;
    margin: 0 auto;
}

/* ========================
   HEADER
   ======================== */

.header {
    text-align: center;
    margin-bottom: 36px;
}

.header h1 {
    font-size: 52px;
    font-weight: 900;
    letter-spacing: 3px;
    color: var(--accent);
    text-shadow: 0 0 10px rgba(229, 9, 20, 0.45), 0 0 35px rgba(229, 9, 20, 0.35);
    margin-bottom: 8px;
}

.subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* ========================
   CARDS
   ======================== */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    margin-bottom: 24px;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.card-header {
    padding: 20px 24px 0;
}

.card-header h2,
.card-header h3 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.card-body {
    padding: 20px 24px 24px;
}

/* ========================
   INPUT
   ======================== */

.input-group {
    margin-bottom: 16px;
}

textarea {
    width: 100%;
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
    resize: none;
    transition: var(--transition);
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(229, 9, 20, 0.15);
}

textarea::placeholder {
    color: var(--text-muted);
}

/* ========================
   BUTTONS
   ======================== */

.btn-primary {
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 1px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 10px 30px var(--accent-glow);
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgba(229, 9, 20, 0.45);
}

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

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

.btn-retry {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid var(--accent);
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--accent);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 12px;
}

.btn-retry:hover {
    background: var(--accent);
    color: white;
}

.btn-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    transition: var(--transition);
    box-shadow: 0 8px 25px var(--accent-glow);
}

.btn-link:hover {
    transform: translateY(-2px);
    opacity: 0.92;
}

/* ========================
   STATUS
   ======================== */

.status-display {
    text-align: center;
    font-size: 32px;
    font-weight: 900;
    letter-spacing: 2px;
    margin-bottom: 24px;
    transition: var(--transition);
}

.status-display.success {
    color: var(--success);
    text-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
}

.status-display.error {
    color: var(--error);
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.status-display.pending {
    color: var(--warning);
    text-shadow: 0 0 20px rgba(250, 204, 21, 0.3);
}

.status-display.processing {
    color: var(--info);
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

/* ========================
   RESULTS
   ======================== */

.results {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(145deg, rgba(28, 28, 28, 0.95), rgba(12, 12, 12, 0.95));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    transition: var(--transition);
}

.result-item:hover {
    transform: translateY(-2px);
    border-color: rgba(229, 9, 20, 0.35);
    box-shadow: 0 10px 30px rgba(229, 9, 20, 0.18);
}

.result-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.result-info {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.result-label {
    font-size: 16px;
    font-weight: 600;
}

/* ========================
   SPINNER
   ======================== */

.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

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

/* ========================
   TUTORIAL
   ======================== */

.tutorial-card .card-header {
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
}

.tutorial-card .card-header h3 {
    color: var(--warning);
}

.steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 15px;
    line-height: 1.6;
}

.step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.step-text {
    color: var(--text-secondary);
    padding-top: 3px;
}

.step-text strong {
    color: var(--text-primary);
}

.warning-box {
    background: rgba(250, 204, 21, 0.08);
    border: 1px solid rgba(250, 204, 21, 0.2);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    font-size: 14px;
    color: #ffb84d;
    line-height: 1.6;
}

/* ========================
   FOOTER
   ======================== */

.footer {
    text-align: center;
    margin-top: 32px;
    padding: 16px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ========================
   LOADING OVERLAY
   ======================== */

.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ========================
   RESPONSIVE — MOBILE FIRST
   ======================== */

/* Tablet */
@media (max-width: 768px) {
    body {
        padding: 16px 10px;
    }

    .container {
        max-width: 100%;
    }

    .header {
        margin-bottom: 24px;
    }

    .header h1 {
        font-size: 32px;
        letter-spacing: 1px;
    }

    .subtitle {
        font-size: 13px;
        letter-spacing: 1px;
    }

    .card {
        border-radius: 16px;
        margin-bottom: 16px;
    }

    .card-header {
        padding: 16px 18px 0;
    }

    .card-header h2,
    .card-header h3 {
        font-size: 17px;
    }

    .card-body {
        padding: 16px 18px 18px;
    }

    textarea {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 14px 16px;
        height: 80px;
    }

    .btn-primary {
        padding: 14px 20px;
        font-size: 15px;
    }

    .status-display {
        font-size: 24px;
        margin-bottom: 16px;
    }

    .result-item {
        padding: 14px 16px;
        gap: 12px;
    }

    .result-icon {
        font-size: 28px;
    }

    .result-label {
        font-size: 14px;
    }

    .result-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .btn-link {
        width: 100%;
        text-align: center;
        padding: 12px 16px;
        font-size: 13px;
    }

    .steps {
        gap: 10px;
    }

    .step {
        font-size: 14px;
        gap: 10px;
    }

    .step-num {
        width: 26px;
        height: 26px;
        font-size: 13px;
    }

    .warning-box {
        font-size: 13px;
        padding: 12px 14px;
    }
}

/* Small Phone */
@media (max-width: 480px) {
    body {
        padding: 12px 8px;
    }

    .header {
        margin-bottom: 20px;
    }

    .header h1 {
        font-size: 26px;
        letter-spacing: 0.5px;
    }

    .subtitle {
        font-size: 12px;
    }

    .card {
        border-radius: 14px;
        margin-bottom: 12px;
    }

    .card-header {
        padding: 14px 14px 0;
    }

    .card-header h2,
    .card-header h3 {
        font-size: 16px;
    }

    .card-body {
        padding: 14px 14px 16px;
    }

    textarea {
        font-size: 16px;
        padding: 12px 14px;
        height: 70px;
        border-radius: 14px;
    }

    .btn-primary {
        padding: 14px 16px;
        font-size: 14px;
        border-radius: 14px;
    }

    .status-display {
        font-size: 22px;
    }

    .result-item {
        padding: 12px 14px;
        border-radius: 14px;
    }

    .result-icon {
        font-size: 24px;
    }

    .result-label {
        font-size: 13px;
    }

    .btn-link {
        padding: 11px 14px;
        font-size: 13px;
        border-radius: 12px;
    }

    .step {
        font-size: 13px;
    }

    .step-num {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .warning-box {
        font-size: 12px;
        border-radius: 10px;
    }

    .footer {
        font-size: 11px;
        margin-top: 24px;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .header h1 {
        font-size: 22px;
    }

    .status-display {
        font-size: 18px;
    }
}

/* ========================
   ANIMATIONS
   ======================== */

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

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

.card {
    animation: fadeIn 0.5s ease-out;
}

#status_card {
    animation: slideUp 0.4s ease-out;
}
