/*
 * HICL HSIA - Captive Portal Styling
 * Full captive portal CSS with CSS custom properties for theme support
 */

/* ── CSS Custom Properties (Theme Defaults) ── */
:root {
    /* Primary colors */
    --hicl-primary: #1a73e8;
    --hicl-secondary: #5f6368;
    --hicl-accent: #fbbc04;
    --hicl-text: #202124;
    --hicl-bg: #f8f9fa;

    /* Card properties */
    --hicl-card-bg: rgba(255, 255, 255, 0.95);
    --hicl-card-radius: 16px;
    --hicl-card-blur: 20px;
    --hicl-card-opacity: 0.95;

    /* Typography */
    --hicl-heading-font: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --hicl-body-font: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --hicl-font-size: 16px;

    /* Derived colors */
    --hicl-primary-hover: color-mix(in srgb, var(--hicl-primary) 85%, black);
    --hicl-primary-light: color-mix(in srgb, var(--hicl-primary) 15%, white);
    --hicl-border: #dadce0;
    --hicl-input-bg: #ffffff;
    --hicl-input-border: #dadce0;
    --hicl-error: #d93025;
    --hicl-success: #1e8e3e;
    --hicl-text-secondary: #5f6368;
    --hicl-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* ── Reset & Base ── */
.hicl-portal *,
.hicl-portal *::before,
.hicl-portal *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Full-Screen Portal Container ── */
.hicl-portal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--hicl-body-font);
    font-size: var(--hicl-font-size);
    color: var(--hicl-text);
    background-color: var(--hicl-bg);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: auto;
    z-index: 9999;
}

/* Dark overlay on background image */
.hicl-portal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 0;
}

.hicl-portal.no-overlay::before {
    display: none;
}

/* ── Login Card (Glassmorphism) ── */
.hicl-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 32px;
    background: var(--hicl-card-bg);
    backdrop-filter: blur(var(--hicl-card-blur));
    -webkit-backdrop-filter: blur(var(--hicl-card-blur));
    border-radius: var(--hicl-card-radius);
    box-shadow: var(--hicl-shadow);
    border: 1px solid rgba(255, 255, 255, 0.18);
    opacity: var(--hicl-card-opacity);
    animation: hicl-fade-in 0.4s ease-out;
}

@keyframes hicl-fade-in {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Logo ── */
.hicl-logo {
    display: block;
    margin: 0 auto 24px auto;
    max-width: 180px;
    max-height: 80px;
    object-fit: contain;
}

/* ── Headings ── */
.hicl-card h1,
.hicl-card h2,
.hicl-card h3 {
    font-family: var(--hicl-heading-font);
    text-align: center;
    margin-bottom: 8px;
}

.hicl-card h1 {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--hicl-text);
}

.hicl-card h2 {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--hicl-text);
}

.hicl-card .subtitle {
    text-align: center;
    color: var(--hicl-text-secondary);
    font-size: 0.9em;
    margin-bottom: 24px;
}

/* ── Tab Navigation ── */
.hicl-tabs {
    display: flex;
    border-bottom: 2px solid var(--hicl-border);
    margin-bottom: 24px;
    gap: 0;
}

.hicl-tabs .hicl-tab {
    flex: 1;
    padding: 10px 8px;
    text-align: center;
    font-size: 0.9em;
    font-weight: 500;
    color: var(--hicl-text-secondary);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
}

.hicl-tabs .hicl-tab:hover {
    color: var(--hicl-primary);
}

.hicl-tabs .hicl-tab.active {
    color: var(--hicl-primary);
    border-bottom-color: var(--hicl-primary);
    font-weight: 600;
}

.hicl-tab-content {
    display: none;
}

.hicl-tab-content.active {
    display: block;
    animation: hicl-fade-in 0.3s ease-out;
}

/* ── Form Inputs ── */
.hicl-input-group {
    margin-bottom: 16px;
}

.hicl-input-group label {
    display: block;
    font-size: 0.85em;
    font-weight: 500;
    color: var(--hicl-text);
    margin-bottom: 6px;
}

.hicl-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 1em;
    font-family: var(--hicl-body-font);
    color: var(--hicl-text);
    background: var(--hicl-input-bg);
    border: 1px solid var(--hicl-input-border);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.hicl-input:focus {
    border-color: var(--hicl-primary);
    box-shadow: 0 0 0 3px var(--hicl-primary-light);
}

.hicl-input::placeholder {
    color: var(--hicl-text-secondary);
    opacity: 0.6;
}

.hicl-input.error {
    border-color: var(--hicl-error);
}

.hicl-input-error {
    font-size: 0.8em;
    color: var(--hicl-error);
    margin-top: 4px;
}

/* ── Buttons ── */
.hicl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 24px;
    font-size: 1em;
    font-weight: 600;
    font-family: var(--hicl-body-font);
    border: 1px solid var(--hicl-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    background: var(--hicl-input-bg);
    color: var(--hicl-text);
}

.hicl-btn:hover {
    background: var(--hicl-bg);
}

.hicl-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.hicl-btn-primary {
    background: var(--hicl-primary);
    color: #ffffff;
    border-color: var(--hicl-primary);
}

.hicl-btn-primary:hover {
    background: var(--hicl-primary-hover);
    border-color: var(--hicl-primary-hover);
}

.hicl-btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 16px;
    margin-bottom: 10px;
    font-size: 0.95em;
    font-weight: 500;
    background: #ffffff;
    border: 1px solid var(--hicl-border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.hicl-btn-social:hover {
    background: #f1f3f4;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.hicl-btn-social img,
.hicl-btn-social svg {
    width: 20px;
    height: 20px;
}

.hicl-btn-social.facebook {
    border-color: #1877f2;
    color: #1877f2;
}

.hicl-btn-social.google {
    border-color: #4285f4;
}

.hicl-btn-social.twitter {
    border-color: #1da1f2;
    color: #1da1f2;
}

.hicl-btn-social.instagram {
    border-color: #e4405f;
    color: #e4405f;
}

/* ── Splash / Fullscreen Ad Overlay ── */
.hicl-splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    animation: hicl-fade-in 0.3s ease-out;
}

.hicl-splash-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    text-align: center;
}

.hicl-splash-content img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
    object-fit: contain;
}

.hicl-splash-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ffffff;
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.hicl-splash-timer {
    margin-top: 12px;
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.7);
}

/* ── Ad Banner Containers ── */
.hicl-ad-banner {
    width: 100%;
    text-align: center;
    margin: 16px 0;
    min-height: 50px;
}

.hicl-ad-banner img {
    max-width: 100%;
    border-radius: 8px;
    cursor: pointer;
}

.hicl-ad-banner.top {
    margin-bottom: 16px;
}

.hicl-ad-banner.bottom {
    margin-top: 16px;
}

.hicl-ad-banner.sidebar {
    max-width: 300px;
    margin: 16px auto;
}

/* ── Session Info Layout ── */
.hicl-session-info {
    padding: 20px 0;
}

.hicl-session-info .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--hicl-border);
}

.hicl-session-info .info-row:last-child {
    border-bottom: none;
}

.hicl-session-info .info-label {
    font-size: 0.85em;
    color: var(--hicl-text-secondary);
    font-weight: 500;
}

.hicl-session-info .info-value {
    font-size: 0.95em;
    font-weight: 600;
    color: var(--hicl-text);
}

.hicl-session-info .data-usage {
    text-align: center;
    padding: 20px 0;
}

.hicl-session-info .data-usage .usage-value {
    font-size: 2em;
    font-weight: 700;
    color: var(--hicl-primary);
}

.hicl-session-info .data-usage .usage-label {
    font-size: 0.85em;
    color: var(--hicl-text-secondary);
}

.hicl-session-info .progress-bar {
    width: 100%;
    height: 8px;
    background: var(--hicl-border);
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}

.hicl-session-info .progress-bar .progress-fill {
    height: 100%;
    background: var(--hicl-primary);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.hicl-session-info .progress-bar .progress-fill.warning {
    background: var(--hicl-accent);
}

.hicl-session-info .progress-bar .progress-fill.danger {
    background: var(--hicl-error);
}

/* ── NPS Survey Styling ── */
.hicl-nps {
    padding: 16px 0;
    text-align: center;
}

.hicl-nps .nps-question {
    font-size: 1em;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--hicl-text);
}

.hicl-nps .nps-scale {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.hicl-nps .nps-score-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--hicl-border);
    background: transparent;
    font-size: 0.85em;
    font-weight: 600;
    color: var(--hicl-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.hicl-nps .nps-score-btn:hover,
.hicl-nps .nps-score-btn.selected {
    background: var(--hicl-primary);
    border-color: var(--hicl-primary);
    color: #ffffff;
}

.hicl-nps .nps-score-btn.detractor.selected {
    background: var(--hicl-error);
    border-color: var(--hicl-error);
}

.hicl-nps .nps-score-btn.passive.selected {
    background: var(--hicl-accent);
    border-color: var(--hicl-accent);
    color: var(--hicl-text);
}

.hicl-nps .nps-score-btn.promoter.selected {
    background: var(--hicl-success);
    border-color: var(--hicl-success);
}

.hicl-nps .nps-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75em;
    color: var(--hicl-text-secondary);
    padding: 0 4px;
}

.hicl-nps .nps-feedback {
    margin-top: 16px;
}

.hicl-nps .nps-feedback textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid var(--hicl-border);
    border-radius: 8px;
    font-family: var(--hicl-body-font);
    font-size: 0.9em;
    resize: vertical;
}

/* ── Language Selector ── */
.hicl-lang-selector {
    position: relative;
    display: inline-block;
}

.hicl-lang-selector select {
    appearance: none;
    -webkit-appearance: none;
    padding: 6px 28px 6px 10px;
    font-size: 0.85em;
    font-family: var(--hicl-body-font);
    border: 1px solid var(--hicl-border);
    border-radius: 6px;
    background: transparent;
    color: var(--hicl-text);
    cursor: pointer;
}

.hicl-lang-selector::after {
    content: '\25BC';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.65em;
    color: var(--hicl-text-secondary);
    pointer-events: none;
}

/* ── Terms & Conditions ── */
.hicl-terms-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 16px 0;
    font-size: 0.85em;
    color: var(--hicl-text-secondary);
}

.hicl-terms-check input[type="checkbox"] {
    margin-top: 2px;
    accent-color: var(--hicl-primary);
}

.hicl-terms-check a {
    color: var(--hicl-primary);
    text-decoration: none;
}

.hicl-terms-check a:hover {
    text-decoration: underline;
}

/* ── Messages ── */
.hicl-message {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9em;
    margin-bottom: 16px;
}

.hicl-message.success {
    background: #e6f4ea;
    color: #1e8e3e;
    border: 1px solid #ceead6;
}

.hicl-message.error {
    background: #fce8e6;
    color: #d93025;
    border: 1px solid #f5c6cb;
}

.hicl-message.info {
    background: #e8f0fe;
    color: #1a73e8;
    border: 1px solid #d2e3fc;
}

/* ── Loading Spinner ── */
.hicl-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: hicl-spin 0.6s linear infinite;
}

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

.hicl-btn .hicl-spinner {
    width: 16px;
    height: 16px;
}

/* ── Divider ── */
.hicl-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: var(--hicl-text-secondary);
    font-size: 0.85em;
}

.hicl-divider::before,
.hicl-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--hicl-border);
}

.hicl-divider span {
    padding: 0 12px;
}

/* ── Footer ── */
.hicl-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.8em;
    color: var(--hicl-text-secondary);
}

.hicl-footer a {
    color: var(--hicl-primary);
    text-decoration: none;
}

/* ── Mobile Responsive ── */
@media screen and (max-width: 480px) {
    .hicl-card {
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 24px 20px;
    }

    .hicl-portal::before {
        display: none;
    }

    .hicl-logo {
        max-width: 140px;
        max-height: 60px;
    }

    .hicl-tabs .hicl-tab {
        font-size: 0.8em;
        padding: 8px 4px;
    }

    .hicl-nps .nps-scale {
        gap: 4px;
    }

    .hicl-nps .nps-score-btn {
        width: 30px;
        height: 30px;
        font-size: 0.75em;
    }

    .hicl-splash-content {
        max-width: 95vw;
    }
}

@media screen and (min-width: 481px) and (max-width: 768px) {
    .hicl-card {
        max-width: 380px;
        padding: 28px 24px;
    }
}

@media screen and (min-width: 769px) {
    .hicl-ad-banner.sidebar {
        position: absolute;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
    }
}

/* ── Dark Mode ── */
@media (prefers-color-scheme: dark) {
    :root {
        --hicl-text: #e8eaed;
        --hicl-bg: #1a1a2e;
        --hicl-card-bg: rgba(30, 30, 50, 0.95);
        --hicl-border: #444;
        --hicl-input-bg: #2a2a3e;
        --hicl-input-border: #555;
        --hicl-text-secondary: #9aa0a6;
        --hicl-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    }

    .hicl-card {
        border-color: rgba(255, 255, 255, 0.08);
    }

    .hicl-input {
        color: var(--hicl-text);
        background: var(--hicl-input-bg);
    }

    .hicl-btn-social {
        background: var(--hicl-input-bg);
        border-color: var(--hicl-border);
        color: var(--hicl-text);
    }

    .hicl-btn-social:hover {
        background: #333350;
    }

    .hicl-message.success {
        background: #1a3a2a;
        color: #6fcf97;
        border-color: #2a5a3a;
    }

    .hicl-message.error {
        background: #3a1a1a;
        color: #f5a5a5;
        border-color: #5a2a2a;
    }

    .hicl-message.info {
        background: #1a2a3a;
        color: #8ab4f8;
        border-color: #2a3a5a;
    }

    .hicl-terms-check {
        color: var(--hicl-text-secondary);
    }

    .hicl-lang-selector select {
        color: var(--hicl-text);
        border-color: var(--hicl-border);
    }

    .hicl-session-info .progress-bar {
        background: var(--hicl-border);
    }

    .hicl-nps .nps-score-btn {
        border-color: var(--hicl-border);
        color: var(--hicl-text-secondary);
        background: transparent;
    }

    .hicl-nps .nps-feedback textarea {
        background: var(--hicl-input-bg);
        color: var(--hicl-text);
        border-color: var(--hicl-border);
    }
}

/* ── Utility Classes ── */
.hicl-hidden {
    display: none !important;
}

.hicl-text-center {
    text-align: center;
}

.hicl-mt-16 {
    margin-top: 16px;
}

.hicl-mb-16 {
    margin-bottom: 16px;
}
