/* =============================================
   Customer Portal Styles
   ============================================= */

.portal-body {
    background-color: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Branded Header ───────────────────────────── */
.portal-header-brand {
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}

.portal-banner {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.portal-banner-overlay {
    background: var(--portal-theme-overlay, rgba(26, 26, 46, 0.5));
}

.portal-solid-header {
    background: var(--portal-theme, #1a1a2e);
}

.portal-header-logo {
    max-height: 64px;
    max-width: 180px;
    object-fit: contain;
    border-radius: 8px;
    flex-shrink: 0;
}

.portal-header-biz-name {
    color: #fff;
    font-weight: 700;
    font-size: 1.6rem;
    margin: 0;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
    line-height: 1.2;
}

.portal-header-biz-name-centered {
    font-size: 2rem;
    letter-spacing: -0.01em;
    padding: 0.5rem 0;
}

/* ── Main & Footer ────────────────────────────── */
.portal-main {
    flex: 1;
    padding: 2rem 0;
}

.portal-footer {
    border-top: 1px solid #e0e0e0;
    background: #fff;
}

/* ── Portal Card ───────────────────────────────── */
.portal-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    border: 1px solid #e8e8e8;
}

.portal-card .card-body {
    padding: 2.5rem;
}

/* ── Business Selection Cards ──────────────────── */
.portal-biz-card {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.portal-biz-card:hover {
    border-color: var(--bs-primary);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.portal-biz-logo {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
    color: #666;
}

.portal-biz-name {
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
    color: #1a1a2e;
}

.portal-biz-location {
    font-size: 0.85rem;
    color: #666;
}

/* ── OTP Input (reused from main app) ──────────── */
.portal-otp-input {
    width: 48px;
    height: 54px;
    font-size: 22px;
    font-weight: bold;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    text-align: center;
}

.portal-otp-input:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    outline: none;
}

/* ── Portal Home ───────────────────────────────── */
.portal-welcome {
    text-align: center;
    padding: 2rem 0;
}

.portal-welcome h2 {
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.portal-welcome p {
    color: #666;
    font-size: 1.05rem;
}

.portal-nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.portal-nav-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    text-decoration: none;
    color: #1a1a2e;
    transition: all 0.15s ease;
}

.portal-nav-card:hover {
    border-color: var(--bs-primary);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    transform: translateY(-2px);
    color: #1a1a2e;
    text-decoration: none;
}

.portal-nav-card i {
    font-size: 2rem;
    color: var(--bs-primary);
    margin-bottom: 0.75rem;
    display: block;
}

.portal-nav-card span {
    font-weight: 600;
    font-size: 1rem;
}

/* ── Page Title ───────────────────────────────── */
.portal-page-title {
    font-weight: 700;
    font-size: 1.5rem;
    color: #1a1a2e;
}

/* ── Empty State ──────────────────────────────── */
.portal-empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #999;
}

.portal-empty-state i {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

/* ── Invoice List ─────────────────────────────── */
.portal-invoice-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.portal-invoice-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 1.25rem;
    transition: box-shadow 0.15s ease;
}

.portal-invoice-card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.portal-invoice-card-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.portal-invoice-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.portal-invoice-number {
    font-weight: 600;
    font-size: 1.05rem;
    color: #1a1a2e;
}

.portal-invoice-date {
    font-size: 0.85rem;
    color: #888;
}

.portal-invoice-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.portal-invoice-total {
    font-weight: 700;
    font-size: 1.1rem;
    color: #1a1a2e;
}

.portal-invoice-total-lg {
    font-weight: 700;
    font-size: 1.35rem;
    color: #1a1a2e;
}

.portal-invoice-due {
    font-size: 0.82rem;
    color: #888;
    margin-top: 0.35rem;
}

.portal-invoice-actions {
    margin-top: 0.75rem;
    display: flex;
    justify-content: flex-end;
}

/* ── Invoice Status Badges ────────────────────── */
.portal-invoice-status {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.portal-status-paid {
    background: #d4edda;
    color: #155724;
}

.portal-status-unpaid {
    background: #fff3cd;
    color: #856404;
}

.portal-status-overdue {
    background: #f8d7da;
    color: #721c24;
}

.portal-status-partial {
    background: #d1ecf1;
    color: #0c5460;
}

.portal-status-draft {
    background: #e2e3e5;
    color: #383d41;
}

.portal-status-sent {
    background: #fff3cd;
    color: #856404;
}

.portal-status-accepted {
    background: #d4edda;
    color: #155724;
}

.portal-status-rejected {
    background: #f8d7da;
    color: #721c24;
}

.portal-status-expired {
    background: #f8d7da;
    color: #721c24;
}

.portal-status-reviewed {
    background: #cfe2ff;
    color: #084298;
}

.portal-status-converted {
    background: #cfe2ff;
    color: #084298;
}

/* ── Accept / Reject Buttons ────────────── */

.portal-btn-accept {
    background: #198754;
    color: #fff;
    border: none;
    font-weight: 600;
}

.portal-btn-accept:hover {
    background: #157347;
    color: #fff;
}

.portal-btn-reject {
    background: transparent;
    color: #dc3545;
    border: 2px solid #dc3545;
    font-weight: 600;
}

.portal-btn-reject:hover {
    background: #dc3545;
    color: #fff;
}

/* ── Pay Button (uses theme color) ────────────── */
.portal-btn-pay {
    --bs-btn-bg: var(--portal-theme, #1a1a2e);
    --bs-btn-color: #fff;
    --bs-btn-border-color: var(--portal-theme, #1a1a2e);
    --bs-btn-hover-bg: var(--portal-theme, #1a1a2e);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-border-color: var(--portal-theme, #1a1a2e);
    --bs-btn-active-bg: var(--portal-theme, #1a1a2e);
    --bs-btn-active-color: #fff;
    --bs-btn-active-border-color: var(--portal-theme, #1a1a2e);
    background-color: var(--portal-theme, #1a1a2e) !important;
    color: #fff !important;
    border: none;
    border-radius: 8px;
    font-weight: 600;
}

.portal-btn-pay:hover,
.portal-btn-pay:focus {
    background-color: var(--portal-theme, #1a1a2e) !important;
    color: #fff !important;
    filter: brightness(1.15);
}

/* ── Invoice Detail ───────────────────────────── */
.portal-invoice-header-row {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}

.portal-invoice-meta-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #888;
    margin-bottom: 0.2rem;
}

.portal-invoice-meta-value {
    font-weight: 600;
    color: #1a1a2e;
}

/* ── Line Items Table ─────────────────────────── */
.portal-line-items-table {
    margin: 0;
}

.portal-line-items-table thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #e8e8e8;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #666;
    padding: 0.85rem 1.25rem;
    font-weight: 600;
}

.portal-line-items-table tbody td {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.portal-line-items-total td {
    padding: 1rem 1.25rem;
    border-top: 2px solid #e0e0e0;
    background: #fafafa;
}

/* ── Payment Confirmation ─────────────────────── */
.portal-payment-details {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.portal-ref-number {
    font-family: monospace;
    font-size: 0.85rem;
    word-break: break-all;
}

/* ── Alert Styles ──────────────────────────────── */
.portal-alert-info {
    background: #e8f4fd;
    border: 1px solid #b6d9f2;
    color: #0c5a8a;
    border-radius: 8px;
    padding: 1rem;
}

.portal-alert-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.portal-alert-muted {
    background: #f0f0f0;
    border: 1px solid #e0e0e0;
    color: #555;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Responsive ────────────────────────────────── */
@media (max-width: 576px) {
    .portal-card .card-body {
        padding: 1.5rem;
    }

    .portal-otp-input {
        width: 40px;
        height: 46px;
        font-size: 18px;
    }

    .portal-nav-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .portal-header-logo {
        max-height: 48px;
        max-width: 120px;
    }

    .portal-header-biz-name {
        font-size: 1.2rem;
    }

    .portal-header-biz-name-centered {
        font-size: 1.5rem;
    }

    .portal-invoice-card-main {
        flex-direction: column;
        align-items: flex-start;
    }

    .portal-invoice-right {
        align-items: flex-start;
        flex-direction: row;
        gap: 0.75rem;
    }

    .portal-invoice-header-row {
        gap: 1rem;
    }

    .portal-line-items-table thead th,
    .portal-line-items-table tbody td {
        padding: 0.65rem 0.75rem;
        font-size: 0.88rem;
    }

    .portal-payment-details {
        grid-template-columns: 1fr 1fr;
    }
}
