/* TSTech Captive Portal – Support-page inspired styles */

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow-x: hidden;
    max-width: 100%;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --bg-page: #f1f5f9;
    --bg-card: #fff;
    --border: #e2e8f0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --danger: #dc2626;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-page);
    color: var(--text-dark);
    min-height: 100vh;
    line-height: 1.5;
    touch-action: manipulation;
    overflow-x: hidden;
    max-width: 100%;
}

.splash-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Hero header */
.splash-hero {
    background: linear-gradient(160deg, #0f172a 0%, #1e3a5f 100%);
    padding: clamp(18px, 6vw, 44px) 16px clamp(20px, 5vw, 40px);
    text-align: center;
    color: #fff;
}

.splash-hero-inner {
    max-width: 800px;
    margin: 0 auto;
}

.splash-hero h1 {
    font-size: clamp(1.15rem, 4.2vw, 1.75rem);
    font-weight: 700;
    margin-bottom: 12px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.splash-tagline {
    font-size: clamp(0.8rem, 2.8vw, 1rem);
    opacity: 0.95;
}

/* Main content */
.splash-main {
    flex: 1;
    max-width: 640px;
    margin: 0 auto;
    padding: 22px 14px 28px;
    width: 100%;
}

/* Cards – support-page style */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 18px;
    margin-bottom: 24px;
}

.card h2 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 20px;
}

/* Welcome back */
.welcome-back {
    text-align: center;
}

.welcome-back .btn-block {
    max-width: 280px;
    margin: 0 auto 16px;
}

.switch-account {
    font-size: 0.875rem;
    margin-top: 16px;
}

.switch-account a {
    color: var(--primary);
    text-decoration: none;
}

.switch-account a:hover {
    text-decoration: underline;
}

/* Form */
.form-intro {
    margin-bottom: 24px;
}

.form-intro h2 {
    font-size: 1.35rem;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.form-group {
    margin-bottom: 18px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.required {
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    /* 16px minimum prevents iOS captive Safari from zooming the whole page on focus */
    font-size: max(16px, 1rem);
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-control::placeholder {
    color: #bdc3c7;
}

/* Privacy disclaimer – prominent, readable */
.privacy-disclaimer {
    margin-top: 28px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.privacy-disclaimer p {
    font-size: 0.8rem;
    color: var(--text-dark);
    line-height: 1.6;
    margin-bottom: 10px;
}

.privacy-disclaimer p:last-child {
    margin-bottom: 0;
}

.privacy-disclaimer a {
    color: var(--primary);
    text-decoration: none;
}

.privacy-disclaimer a:hover {
    text-decoration: underline;
}

/* Opt-out checkbox */
.opt-out-group {
    margin-top: 18px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-weight: normal;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
    cursor: pointer;
}

.checkbox-label span {
    line-height: 1.4;
}

/* Buttons */
.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
    background: #f1f3f4;
    color: var(--text-dark);
}

.btn-secondary:hover {
    background: #e8eaed;
}

.btn-block {
    width: 100%;
    padding: 14px;
}

.form-actions {
    margin-top: 28px;
}


/* Success page — connected confirmation */
.success-card {
    max-width: min(480px, 100%);
    margin: 16px auto 24px;
    padding: 0 14px;
}

.success-title {
    text-align: center;
    font-size: clamp(1.05rem, 3.8vw, 1.45rem);
    font-weight: 700;
    color: #16a34a;
    margin-bottom: 4px;
}

.success-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 0.875rem;
}

.success-title-neutral {
    color: var(--text-dark);
}

.info-banner {
    margin-bottom: 24px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.info-banner p {
    margin: 0;
    color: #1e3a8a;
    font-size: 0.9rem;
}

.info-banner-success {
    background: #ecfdf5;
    border-color: #bbf7d0;
}

.info-banner-success p {
    color: #166534;
}

.meta-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    margin-bottom: 24px;
}

.meta-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.meta-table td:first-child {
    color: var(--text-muted);
    font-weight: 600;
    width: 45%;
}

.meta-table td:last-child {
    color: var(--text-dark);
}

.session-id {
    font-family: monospace;
    font-size: 0.75rem;
}

.badge-new {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #dcfce7;
    color: #15803d;
}

.badge-return {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #dbeafe;
    color: #1d4ed8;
}

.btn-browse {
    display: block;
    text-align: center;
    padding: 14px;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    margin-top: 8px;
    transition: background 0.2s ease;
}

.btn-browse:hover {
    background: var(--primary-dark);
}

.btn-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.btn-browse-secondary {
    display: block;
    text-align: center;
    padding: 12px 14px;
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.btn-browse-secondary:hover {
    background: #eff6ff;
    color: var(--primary-dark);
}

.callout-important {
    margin-bottom: 20px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #78350f;
    font-size: 0.9rem;
    line-height: 1.5;
}

.callout-important strong {
    color: #451a03;
}

.hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 16px;
}

/* Success page (legacy — splash success section) */
.success-page {
    padding: 48px 24px;
    text-align: center;
}

.success-icon {
    font-size: clamp(1.75rem, 9vw, 2.5rem);
    text-align: center;
    margin-bottom: 12px;
    display: block;
    line-height: 1;
}

.success-page h1 {
    font-size: 1.75rem;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.success-message {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 32px;
}

.connection-info {
    background: var(--bg-page);
    border-radius: var(--radius);
    padding: 20px;
    text-align: left;
    max-width: 320px;
    margin: 0 auto 24px;
}

.connection-info h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.connection-info ul {
    list-style: none;
}

.connection-info li {
    padding: 6px 0;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.redirect-notice .small-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 8px;
}

#countdown {
    font-weight: 700;
    color: var(--primary);
}

.action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

.social-follow {
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.social-follow p {
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.social-links {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.social-link {
    padding: 8px 16px;
    background: #f1f3f4;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-dark);
    font-size: 0.875rem;
    transition: background 0.2s, color 0.2s;
}

.social-link:hover {
    background: var(--primary);
    color: #fff;
}

/* Footer */
.splash-footer {
    background: #0f172a;
    color: rgba(255,255,255,0.6);
    padding: 20px;
    text-align: center;
    font-size: 0.8rem;
}

.splash-footer p {
    margin: 0;
    color: inherit;
}

/* Success page container (legacy) */
.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

/* Visually hidden but accessible to screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Field error (app.js) */
.field-error {
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 4px;
}

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

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.25);
}

/* Respect 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;
    }
}

/* Responsive */
@media (max-width: 640px) {
    .splash-hero h1 {
        font-size: clamp(1.1rem, 4.5vw, 1.45rem);
    }

    .splash-main {
        padding: 20px 12px 22px;
    }

    .card {
        padding: 20px 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn {
        width: 100%;
    }
}