/**
 * Scroll Time Unlock - Mobile-First Professional UI
 * Clean, modern engagement panel optimized for mobile
 */

/* ============================================
   CSS Variables (Design Tokens)
   ============================================ */
:root {
    --stu-bg: #ffffff;
    --stu-bg-card: #f8fafc;
    --stu-primary: #3b82f6;
    --stu-primary-hover: #2563eb;
    --stu-success: #22c55e;
    --stu-success-hover: #16a34a;
    --stu-text: #111827;
    --stu-text-secondary: #4b5563;
    --stu-text-muted: #9ca3af;
    --stu-border: #e5e7eb;
    --stu-shadow: 0 -2px 16px rgba(0, 0, 0, 0.06);
    --stu-radius: 16px;
    --stu-radius-sm: 10px;
    --stu-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ============================================
   Base Panel - Mobile First
   ============================================ */
.stu-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: var(--stu-bg);
    box-shadow: var(--stu-shadow);
    border-top: 1px solid var(--stu-border);
    font-family: var(--stu-font);
}

.stu-panel-inner {
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    max-width: 480px;
    margin: 0 auto;
}

/* ============================================
   Article Counter - Compact Badge
   ============================================ */
.stu-article-counter {
    text-align: center;
    margin-bottom: 14px;
}

.stu-counter-text {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    color: var(--stu-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    background: var(--stu-bg-card);
    padding: 6px 14px;
    border-radius: 100px;
    border: 1px solid var(--stu-border);
}

/* ============================================
   Progress Bars - Clean & Uniform
   ============================================ */
.stu-timer-display,
.stu-scroll-display {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 8px;
    padding: 12px 14px;
    background: var(--stu-bg-card);
    border-radius: var(--stu-radius-sm);
    border: 1px solid var(--stu-border);
}

.stu-timer-bar,
.stu-scroll-bar {
    flex: 1;
    height: 6px;
    background: #e2e8f0;
    border-radius: 100px;
    overflow: hidden;
    position: relative;
}

.stu-timer-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: var(--stu-primary);
    border-radius: 100px;
    transition: width 0.15s ease-out;
}

.stu-scroll-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: var(--stu-success);
    border-radius: 100px;
    transition: width 0.15s ease-out;
}

.stu-timer-text,
.stu-scroll-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--stu-text-muted);
    min-width: 48px;
    text-align: right;
    white-space: nowrap;
}

.stu-timer-text {
    font-family: 'SF Mono', Menlo, Monaco, monospace;
    font-weight: 700;
    font-size: 13px;
    color: var(--stu-text);
}

/* Timer Complete State */
.stu-timer-display.stu-timer-complete {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.stu-timer-display.stu-timer-complete .stu-timer-fill {
    background: var(--stu-success);
}

.stu-timer-display.stu-timer-complete .stu-timer-text {
    color: var(--stu-success);
}

/* ============================================
   Instruction Text
   ============================================ */
.stu-instruction {
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--stu-text-secondary);
    margin: 14px 0;
    line-height: 1.5;
    min-height: 20px;
}

/* ============================================
   CTA Button - Large Touch Target
   ============================================ */
.stu-cta {
    display: block;
    width: 100%;
    padding: 16px 24px;
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    background: var(--stu-primary);
    border: none;
    border-radius: var(--stu-radius-sm);
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 52px;
}

.stu-cta:hover {
    background: var(--stu-primary-hover);
}

.stu-cta:active {
    transform: scale(0.98);
}

.stu-cta.stu-cta-success {
    background: var(--stu-success);
}

.stu-cta.stu-cta-success:hover {
    background: var(--stu-success-hover);
}

/* ============================================
   Completion Code Panel
   ============================================ */
.stu-code-panel {
    text-align: center;
    padding: 20px 16px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--stu-radius-sm);
}

.stu-code-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--stu-success);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.stu-code-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--stu-text);
    font-family: 'SF Mono', Menlo, Monaco, monospace;
    letter-spacing: 1px;
    padding: 14px 16px;
    background: #ffffff;
    border-radius: 8px;
    margin-bottom: 14px;
    word-break: break-all;
    user-select: all;
    -webkit-user-select: all;
    border: 1px solid #d1fae5;
}

.stu-copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    color: var(--stu-success);
    background: #ffffff;
    border: 2px solid var(--stu-success);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    min-height: 48px;
}

.stu-copy-btn:hover,
.stu-copy-btn.stu-copied {
    background: var(--stu-success);
    color: #ffffff;
}

/* ============================================
   Desktop Styles (768px+)
   ============================================ */
@media (min-width: 768px) {
    .stu-panel {
        bottom: 24px;
        right: 24px;
        left: auto;
        width: 360px;
        border-radius: var(--stu-radius);
        border: 1px solid var(--stu-border);
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    }

    .stu-panel-inner {
        padding: 20px;
    }

    .stu-counter-text {
        font-size: 10px;
    }

    .stu-timer-display,
    .stu-scroll-display {
        padding: 14px 16px;
    }

    .stu-instruction {
        font-size: 14px;
    }
}

/* ============================================
   Large Desktop (1200px+)
   ============================================ */
@media (min-width: 1200px) {
    .stu-panel {
        width: 380px;
        right: 32px;
        bottom: 32px;
    }
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {

    .stu-panel,
    .stu-timer-fill,
    .stu-scroll-fill,
    .stu-cta {
        transition: none;
    }
}

/* ============================================
   Dark Mode
   ============================================ */
@media (prefers-color-scheme: dark) {
    :root {
        --stu-bg: #1f2937;
        --stu-bg-card: #374151;
        --stu-text: #f9fafb;
        --stu-text-secondary: #d1d5db;
        --stu-text-muted: #9ca3af;
        --stu-border: #4b5563;
        --stu-shadow: 0 -2px 16px rgba(0, 0, 0, 0.3);
    }

    .stu-counter-text {
        background: var(--stu-bg-card);
        border-color: var(--stu-border);
    }

    .stu-timer-bar,
    .stu-scroll-bar {
        background: #4b5563;
    }

    .stu-timer-display,
    .stu-scroll-display {
        background: var(--stu-bg-card);
        border-color: var(--stu-border);
    }

    .stu-timer-display.stu-timer-complete {
        background: #064e3b;
        border-color: #065f46;
    }

    .stu-code-panel {
        background: #064e3b;
        border-color: #065f46;
    }

    .stu-code-value {
        background: #1f2937;
        border-color: #065f46;
        color: #f9fafb;
    }

    .stu-copy-btn {
        background: #1f2937;
    }
}