/* ── WiFi Captive Portal ────────────────────────────────────────────── */

:root {
    --primary: #10b981;
    --primary-hover: #059669;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.04);
}

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

.portal-body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

/* ── Top bar ───────────────────────────────────────────────────── */

.top-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    z-index: 50;
}

.top-bar-brand {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.top-bar-nav {
    display: flex;
    gap: 12px;
    align-items: center;
}

.top-bar-nav a {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: color .15s;
}

.top-bar-nav a:hover {
    color: var(--text);
}

.top-bar-cta {
    padding: 5px 12px;
    background: var(--primary);
    color: #fff !important;
    border-radius: 6px;
    font-weight: 600 !important;
}

.top-bar-cta:hover {
    background: var(--primary-hover);
}

/* Push content below the fixed top bar */
.portal-body { padding-top: 64px; }

.portal-container {
    width: 100%;
    max-width: 420px;
}

.portal-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px 24px;
    margin-bottom: 16px;
}

/* ── Header ─────────────────────────────────────────────────────── */

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

.portal-header h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
}

.portal-header p {
    font-size: 14px;
    color: var(--text-muted);
}

.wifi-symbol {
    font-size: 40px;
    display: block;
    margin-bottom: 12px;
}

/* ── Device info ────────────────────────────────────────────────── */

.device-info {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
    padding: 8px 14px;
    background: #f1f5f9;
    border-radius: 8px;
}

/* ── Plan selector ──────────────────────────────────────────────── */

.time-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.time-option {
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 14px 10px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    user-select: none;
}

.time-option:hover {
    border-color: var(--primary);
}

.time-option.selected {
    border-color: var(--primary);
    background: #ecfdf5;
}

.time-option .duration {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.time-option .price {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
}

/* ── Price display ──────────────────────────────────────────────── */

.price-display {
    text-align: center;
    margin-bottom: 20px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 12px;
}

.price-display .label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.price-display .amount {
    font-size: 28px;
    font-weight: 700;
}

.price-display .amount small {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-muted);
}

/* ── Pay button ─────────────────────────────────────────────────── */

.btn-pay {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background .15s;
}

.btn-pay:hover { background: var(--primary-hover); }
.btn-pay:disabled { opacity: .5; cursor: not-allowed; }

/* ── Footer ─────────────────────────────────────────────────────── */

.portal-footer {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Alerts ─────────────────────────────────────────────────────── */

.alert {
    padding: 12px;
    border-radius: 10px;
    font-size: 14px;
    margin-top: 12px;
    text-align: center;
}

.alert-danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* ── Waiting / spinner ──────────────────────────────────────────── */

.waiting-icon {
    text-align: center;
    margin: 28px 0;
}

.spinner {
    width: 56px;
    height: 56px;
    border: 4px solid #e2e8f0;
    border-top-color: var(--primary);
    border-right-color: var(--primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin: 0 auto;
    box-shadow: 0 0 16px rgba(16,185,129,.15);
}

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

.waiting-status {
    text-align: center;
    font-size: 15px;
    color: var(--text);
    margin-bottom: 20px;
    font-weight: 500;
    line-height: 1.5;
}

/* ── Payment method modal ────────────────────────────────────────── */

.pay-modal {
    position: fixed; inset: 0;
    align-items: center; justify-content: center;
    z-index: 200;
}

.pay-modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(15,23,42,.5);
}

.pay-modal-card {
    position: relative;
    background: #fff; border-radius: 16px;
    padding: 28px 24px; width: 90%; max-width: 340px;
    text-align: center;
}

.pay-modal-card h3 {
    font-size: 18px; font-weight: 700; margin: 0 0 4px;
}

.pay-method-btn {
    width: 100%; display: flex; align-items: center; gap: 14px;
    padding: 14px 16px; margin-bottom: 10px;
    border: 2px solid #e2e8f0; border-radius: 12px;
    background: #fff; cursor: pointer;
    text-align: left; font-family: inherit;
    transition: border-color .15s, background .15s;
}

.pay-method-btn:hover {
    border-color: var(--primary);
    background: #f0fdf4;
}

.pay-method-icon {
    font-size: 28px; flex-shrink: 0;
}

.pay-method-text strong {
    display: block; font-size: 14px; color: var(--text); margin-bottom: 2px;
}

.pay-method-text small {
    font-size: 12px; color: var(--text-muted);
}

.pay-modal-cancel {
    margin-top: 6px;
    background: none; border: none;
    font-size: 13px; color: var(--text-muted);
    cursor: pointer; font-family: inherit;
    padding: 6px 12px;
}

.pay-modal-cancel:hover { color: var(--text); }

/* ── Success ────────────────────────────────────────────────────── */

.success-icon {
    width: 56px;
    height: 56px;
    background: #ecfdf5;
    color: var(--primary);
    font-size: 28px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin: 0 auto 16px;
}

.success-details {
    text-align: center;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.8;
}

/* ── Supported Hardware section ─────────────────────────────────── */

.supported-hardware {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.supported-hardware h2 {
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 4px;
}

.supported-hardware .subtitle {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 16px;
}

.hw-category {
    margin-bottom: 14px;
}

.hw-category h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.hw-category h3 .badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
    background: #ecfdf5;
    color: var(--primary);
}

.hw-models {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}

.hw-models code {
    font-size: 11px;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

/* ── Details / summary ──────────────────────────────────────────── */

.hw-details {
    margin-top: 8px;
}

.hw-details summary {
    font-size: 12px;
    color: var(--primary);
    cursor: pointer;
    font-weight: 500;
    padding: 4px 0;
}

.hw-details summary:hover { text-decoration: underline; }

/* ── Setup button ───────────────────────────────────────────────── */

.btn-setup {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    background: #ecfdf5;
    border: 1.5px solid var(--primary);
    border-radius: 12px;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.btn-setup:hover {
    background: var(--primary);
    color: #fff;
}

/* ── Landing page ───────────────────────────────────────────────── */

.landing-section {
    margin-bottom: 24px;
    text-align: left;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.landing-section h2 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
}

.landing-steps {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.landing-step {
    display: grid;
    grid-template-columns: 32px 1fr;
    grid-template-rows: auto auto;
    gap: 2px 12px;
}

.landing-step-num {
    grid-row: 1 / 3;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: var(--primary);
    border-radius: 50%;
}

.landing-step strong {
    font-size: 14px;
    align-self: end;
}

.landing-step p {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

.feature-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.feature-list li {
    font-size: 13px;
    line-height: 1.5;
}

.feature-list li strong {
    display: block;
    margin-bottom: 1px;
}

.text-muted {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

/* ── Setup guide ────────────────────────────────────────────────── */

.setup-section {
    margin-bottom: 20px;
    text-align: left;
}

.setup-step {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.setup-body {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text);
    padding-left: 36px;
}

.setup-body p {
    margin-bottom: 8px;
}

.setup-body ul,
.setup-body ol {
    margin-bottom: 10px;
    padding-left: 20px;
}

.setup-body li {
    margin-bottom: 6px;
}

.setup-code {
    display: block;
    margin: 8px 0 12px;
    padding: 12px 14px;
    font-size: 12px;
    font-family: "SF Mono", "Cascadia Code", "Fira Code", Menlo, monospace;
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 8px;
    overflow-x: auto;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ── Auth forms ─────────────────────────────────────────────────── */

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.form-group input {
    padding: 10px 12px;
    font-size: 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    outline: none;
    transition: border-color .15s;
}

.form-group input:focus {
    border-color: var(--primary);
}

.form-error {
    font-size: 12px;
    color: #dc2626;
}

/* ── Dashboard stats ────────────────────────────────────────────── */

.dash-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.dash-stat {
    text-align: center;
    padding: 14px 8px;
    background: #f8fafc;
    border-radius: 10px;
}

.dash-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.dash-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-top: 2px;
}

/* ── Dashboard sections ─────────────────────────────────────────── */

.dash-section {
    margin-bottom: 16px;
}

.dash-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.dash-section-header h2 {
    font-size: 15px;
    font-weight: 700;
}

/* ── Site cards ─────────────────────────────────────────────────── */

.site-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.site-card {
    display: block;
    padding: 14px;
    background: #f8fafc;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    color: var(--text);
    transition: border-color .15s;
}

.site-card:hover {
    border-color: var(--primary);
}

.site-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.site-card-info {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-top: 2px;
}

.site-card-info code {
    font-size: 11px;
    background: #e2e8f0;
    padding: 1px 5px;
    border-radius: 3px;
    word-break: break-all;
}

.site-card-url-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
    padding: 8px 10px;
    background: #f1f5f9;
    border-radius: 6px;
}

.site-card-url {
    font-size: 11px;
    font-family: "SF Mono", "Cascadia Code", "Fira Code", Menlo, monospace;
    color: var(--text);
    word-break: break-all;
    flex: 1;
    background: none;
    padding: 0;
}

/* ── Badges ─────────────────────────────────────────────────────── */

.badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.badge-active   { background: #ecfdf5; color: #059669; }
.badge-inactive { background: #f1f5f9; color: #64748b; }
.badge-pending  { background: #fffbeb; color: #d97706; }
.badge-expired  { background: #f1f5f9; color: #94a3b8; }
.badge-blocked  { background: #fef2f2; color: #dc2626; }

/* ── Tabs ───────────────────────────────────────────────────────── */

.dash-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.dash-tab {
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-muted);
    background: #f1f5f9;
    transition: background .15s, color .15s;
}

.dash-tab:hover,
.dash-tab.active {
    background: var(--primary);
    color: #fff;
}

/* ── Session table ──────────────────────────────────────────────── */

.session-table {
    border: 1.5px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.session-row {
    display: grid;
    grid-template-columns: 1fr .8fr .8fr 1fr .5fr;
    gap: 6px;
    align-items: center;
    padding: 10px 12px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

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

.session-header {
    background: #f8fafc;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: var(--text-muted);
}

.session-row code {
    font-size: 11px;
    background: #f1f5f9;
    padding: 1px 4px;
    border-radius: 3px;
}

/* ── Buttons (small variants) ───────────────────────────────────── */

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    background: var(--primary);
    color: #fff;
    transition: background .15s;
}

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

.btn-outline {
    background: transparent;
    color: var(--text-muted);
    border: 1.5px solid var(--border);
}

.btn-outline:hover {
    background: #f1f5f9;
    color: var(--text);
}

.btn-xs {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    cursor: pointer;
}

.btn-danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.btn-danger:hover {
    background: #dc2626;
    color: #fff;
}

/* ── Plan editor ────────────────────────────────────────────────── */

.plan-editor {
    border: 1.5px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.plan-row {
    display: grid;
    grid-template-columns: 1fr 80px 90px 90px 90px 40px;
    gap: 6px;
    align-items: center;
    padding: 8px 10px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

.plan-row:last-child { border-bottom: none; }

.plan-row-header {
    background: #f8fafc;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: var(--text-muted);
    padding: 9px 10px;
}

.plan-row-new {
    background: #fef3c7;
    box-shadow: inset 3px 0 0 #f59e0b;
}

.plan-key {
    font-size: 12px;
    background: #e2e8f0;
    padding: 3px 7px;
    border-radius: 4px;
    display: inline-block;
}

.plan-input {
    width: 100%;
    padding: 6px 8px;
    font-size: 12px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    outline: none;
    font-family: inherit;
    transition: border-color .15s;
    background: #fff;
}

.plan-input:focus {
    border-color: var(--primary);
}

.plan-input-sm {
    width: 100%;
}

/* ── Toggle switch ──────────────────────────────────────────────── */

.plan-toggle {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    cursor: pointer;
}

.plan-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.plan-toggle-slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 20px;
    transition: background .2s;
}

.plan-toggle-slider::before {
    content: "";
    position: absolute;
    top: 2px; left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
}

.plan-toggle input:checked + .plan-toggle-slider {
    background: var(--primary);
}

/* State word next to the toggle — makes the switch self-explanatory */
.plan-state {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    margin-left: 6px;
}

.plan-state-on {
    color: #059669;
    font-weight: 600;
}

.plan-toggle input:checked + .plan-toggle-slider::before {
    transform: translateX(16px);
}

.plan-remove,
.plan-undo {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background .15s;
}

.plan-remove:hover { background: #fef2f2; }

/* ── Modal ──────────────────────────────────────────────────────── */

.modal {
    position: fixed;
    inset: 0;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.4);
}

.modal-content {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h3 {
    font-size: 16px;
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* ── Responsive ─────────────────────────────────────────────────── */

@media (max-width: 600px) {
    /* The plan editor's mobile layout lives in dashboard.css (loaded after
       this file) — keep it out of here to avoid conflicting flex rules. */
    .session-row {
        grid-template-columns: 1fr .8fr .8fr;
        font-size: 11px;
        gap: 4px;
    }
    .session-row span:nth-child(4),
    .session-row span:nth-child(5) { display: none; }
}

@media (max-width: 400px) {
    .portal-card { padding: 24px 16px; }
    .time-selector { gap: 8px; }
}

/* Hide raw Vue template tags until Vue mounts (waiting page) */
[v-cloak] { display: none !important; }
