/* ==========================================================================
   NetBora Portal — Stylesheet
   Mobile-first. Matches the JOSABAHOTSPOT reference design.
   ========================================================================== */

:root {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #273449;
    --border: #334155;
    --border-accent: #475569;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --accent: #10b981;
    --accent-dark: #059669;
    --danger: #ef4444;
    --radius: 14px;
    --radius-lg: 20px;
    --transition: 150ms ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    min-height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.hidden { display: none !important; }

/* ==========================================================================
   Loading state
   ========================================================================== */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 16px;
    color: var(--text-muted);
}
.spinner {
    width: 42px;
    height: 42px;
    border: 3px solid rgba(16, 185, 129, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Error state
   ========================================================================== */
.error-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}
.error-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    max-width: 400px;
    width: 100%;
    text-align: center;
}
.error-icon { font-size: 40px; margin-bottom: 12px; }
.error-card h2 { font-size: 20px; margin-bottom: 8px; }
.error-card p { color: var(--text-muted); margin-bottom: 20px; font-size: 14px; }

/* ==========================================================================
   Portal layout
   ========================================================================== */
.portal {
    max-width: 520px;
    margin: 0 auto;
    padding: 0 16px 32px;
    min-height: 100vh;
}

/* Header -------------------------------------------------------------- */
.portal-header {
    padding: 24px 0 20px;
    text-align: center;
}
.brand {
    width: 56px;
    height: 56px;
    background: var(--accent);
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 14px;
    overflow: hidden;
}
.brand img { width: 100%; height: 100%; object-fit: cover; }
.portal-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
    word-break: break-word;
}

/* Sections ------------------------------------------------------------ */
.packages-section { margin-top: 8px; }

.section-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.section-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 18px;
    line-height: 1.5;
}

/* Package grid -------------------------------------------------------- */
.packages-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.package-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 12px;
    text-align: center;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), transform var(--transition);
    user-select: none;
    -webkit-user-select: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 120px;
}
.package-card:hover,
.package-card:active {
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
    transform: translateY(-1px);
}
.package-card:active {
    transform: translateY(0);
}

.package-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    line-height: 1.2;
    word-break: break-word;
}
.package-speed {
    font-size: 13px;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 10px;
}
.package-price {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}
.package-price-amount {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    margin-left: 4px;
    letter-spacing: -0.5px;
}

/* Featured badge ------------------------------------------------------ */
.package-card.featured {
    border-color: var(--accent);
    position: relative;
}
.package-card.featured::before {
    content: 'POPULAR';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: #0f172a;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.8px;
    padding: 3px 10px;
    border-radius: 999px;
}

/* Voucher section ----------------------------------------------------- */
.voucher-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
.voucher-input-group {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.voucher-input {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 15px;
    color: var(--text);
    font-family: inherit;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: border-color var(--transition);
    min-width: 0;
}
.voucher-input:focus {
    outline: none;
    border-color: var(--accent);
}
.voucher-input::placeholder {
    color: var(--text-dim);
    letter-spacing: 0;
    text-transform: none;
}
.btn-voucher {
    background: var(--accent);
    color: #0f172a;
    border: none;
    border-radius: 10px;
    padding: 12px 20px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: background var(--transition);
    white-space: nowrap;
}
.btn-voucher:hover { background: var(--accent-dark); }
.btn-voucher:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.voucher-hint {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 8px;
    min-height: 16px;
}
.voucher-hint.error { color: var(--danger); }
.voucher-hint.success { color: var(--accent); }

/* Footer -------------------------------------------------------------- */
.portal-footer {
    text-align: center;
    padding: 32px 0 8px;
    color: var(--text-dim);
    font-size: 12px;
    line-height: 1.6;
}
.footer-brand strong { color: var(--text-muted); }
.footer-contact { margin-top: 4px; }

/* ==========================================================================
   Modal (payment/confirmation dialogs)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}
.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 22px;
    max-width: 400px;
    width: 100%;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}
.modal-close:hover { color: var(--text); background: rgba(255,255,255,0.05); }

/* Button styles for modal -------------------------------------------- */
.btn-primary {
    background: var(--accent);
    color: #0f172a;
    border: none;
    border-radius: 10px;
    padding: 14px 20px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    width: 100%;
    font-family: inherit;
    margin-top: 12px;
    transition: background var(--transition);
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 20px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    width: 100%;
    font-family: inherit;
    margin-top: 8px;
}
.btn-secondary:hover { color: var(--text); border-color: var(--border-accent); }

.btn-retry {
    background: var(--accent);
    color: #0f172a;
    border: none;
    border-radius: 10px;
    padding: 12px 24px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}

/* Utility ------------------------------------------------------------- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }

/* Small phones -------------------------------------------------------- */
@media (max-width: 360px) {
    .packages-grid { gap: 8px; }
    .package-card { padding: 14px 8px; min-height: 110px; }
    .package-price-amount { font-size: 20px; }
    .package-name { font-size: 14px; }
}
/* ==========================================================================
   Payment Modal Styles
   ========================================================================== */

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    text-align: center;
}
.modal-subtitle {
    font-size: 14px;
    margin-bottom: 16px;
    text-align: center;
}
.modal-price {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--text);
    text-align: center;
    margin: 16px 0;
}

/* ---- Form ---- */
.payment-form {
    padding-top: 4px;
}
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.form-input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 16px;
    color: var(--text);
    font-family: inherit;
    letter-spacing: 1px;
    transition: border-color var(--transition);
}
.form-input:focus {
    outline: none;
    border-color: var(--accent);
}
.form-input::placeholder {
    color: var(--text-dim);
    letter-spacing: 0;
}
.form-hint {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 6px;
    margin-bottom: 16px;
}
.form-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 12px;
}

/* ---- Waiting ---- */
.payment-waiting {
    text-align: center;
    padding-top: 8px;
}
.spinner-large {
    width: 56px;
    height: 56px;
    border-width: 4px;
    margin: 0 auto 20px;
}
.payment-progress {
    width: 100%;
    height: 4px;
    background: var(--bg);
    border-radius: 2px;
    margin: 24px 0 8px;
    overflow: hidden;
}
.payment-progress-bar {
    height: 100%;
    background: var(--accent);
    width: 0%;
    animation: progress 60s linear forwards;
}
@keyframes progress {
    from { width: 0%; }
    to   { width: 100%; }
}

/* ---- Success ---- */
.success-icon {
    width: 64px;
    height: 64px;
    background: var(--accent);
    color: #0f172a;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 800;
    margin: 0 auto 16px;
}
.receipt-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin: 20px 0;
}
.receipt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
}
.receipt-row:not(:last-child) {
    border-bottom: 1px solid var(--border);
}
.receipt-row span { color: var(--text-muted); }
.receipt-row strong { color: var(--text); font-weight: 700; }

/* ---- Failure ---- */
.error-icon-large {
    width: 64px;
    height: 64px;
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 800;
    margin: 0 auto 16px;
}