﻿/* ========================================
   BC Portal - Customer Portal Styles
   ======================================== */

/* Portal Variables - can be overridden by company colors */
.portal-page {
    --primary: #0d9488;
    --secondary: #1e3a5f;
    --dark: #0f172a;
    --light: #f8fafc;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --success: #16a34a;
    --success-bg: #dcfce7;
    --error: #dc2626;
    --error-bg: #fee2e2;
    --radius: 10px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* ========================================
   Portal Login
   ======================================== */
.portal-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    padding: 1rem;
}

.portal-error {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Segoe UI', sans-serif;
    color: #64748b;
}

    .portal-error h1 {
        color: #1e293b;
        margin-bottom: 0.5rem;
    }

.portal-login .login-card {
    background: white;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.portal-login .login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.portal-login .logo-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.portal-login .login-logo h1 {
    color: var(--dark);
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
}

.portal-login .login-logo p {
    color: var(--gray-500);
    margin: 0.25rem 0 0 0;
    font-size: 0.9rem;
}

.portal-login .login-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
    color: var(--gray-400);
    font-size: 0.8rem;
}

/* ========================================
   Portal Layout
   ======================================== */
.portal-layout {
    display: flex;
    min-height: 100vh;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Portal Sidebar */
.portal-sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--secondary) 0%, var(--primary) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
}

.portal-sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

    .portal-sidebar-header h2 {
        margin: 0 0 0.25rem 0;
        font-size: 1.25rem;
        font-weight: 700;
    }

    .portal-sidebar-header .user-info {
        font-size: 0.85rem;
        opacity: 0.8;
    }

    .portal-sidebar-header .user-name {
        display: block;
        font-weight: 500;
    }

    .portal-sidebar-header .customer-no {
        display: block;
        font-size: 0.75rem;
        opacity: 0.7;
        margin-top: 0.25rem;
    }

.portal-nav {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
    flex: 1;
}

.portal-nav-item {
    padding: 0.875rem 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    font-size: 0.95rem;
}

    .portal-nav-item:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    .portal-nav-item.active {
        background: rgba(255, 255, 255, 0.15);
        border-left-color: white;
    }

    .portal-nav-item .icon {
        width: 20px;
        text-align: center;
    }

.portal-sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.portal-btn-logout {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

    .portal-btn-logout:hover {
        background: rgba(255, 255, 255, 0.2);
    }

/* Portal Main Content */
.portal-main {
    flex: 1;
    margin-left: 260px;
    background: var(--gray-100);
    min-height: 100vh;
}

.portal-header {
    background: white;
    padding: 1.25rem 2rem;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 10;
}

    .portal-header h1 {
        margin: 0;
        font-size: 1.5rem;
        color: var(--dark);
        font-weight: 600;
    }

.portal-content {
    padding: 2rem;
}

/* ========================================
   Portal Cards
   ======================================== */
.portal-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.portal-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
}

    .portal-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    }

.portal-card-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--gray-100);
}

.portal-card-info {
    display: flex;
    flex-direction: column;
}

.portal-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
    line-height: 1;
}

.portal-card-label {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* ========================================
   Portal Section
   ======================================== */
.portal-section {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.portal-section-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .portal-section-header h2 {
        margin: 0;
        font-size: 1.1rem;
        color: var(--dark);
        font-weight: 600;
    }

.portal-section-body {
    padding: 1.5rem;
}

/* ========================================
   Portal Table (Invoices)
   ======================================== */
.portal-table {
    width: 100%;
    border-collapse: collapse;
}

    .portal-table th,
    .portal-table td {
        padding: 1rem 1.25rem;
        text-align: left;
    }

    .portal-table th {
        background: var(--gray-50);
        font-weight: 600;
        color: var(--gray-600);
        font-size: 0.85rem;
        text-transform: uppercase;
        letter-spacing: 0.025em;
        border-bottom: 2px solid var(--gray-200);
    }

    .portal-table td {
        border-bottom: 1px solid var(--gray-100);
        color: var(--gray-700);
    }

    .portal-table tr:last-child td {
        border-bottom: none;
    }

    .portal-table tr:hover td {
        background: var(--gray-50);
    }

    .portal-table .amount {
        font-weight: 600;
        text-align: right;
    }

    .portal-table .date {
        color: var(--gray-500);
    }

/* Status badges */
.portal-status {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

    .portal-status.paid {
        background: var(--success-bg);
        color: var(--success);
    }

    .portal-status.unpaid {
        background: #fef3c7;
        color: #d97706;
    }

    .portal-status.overdue {
        background: var(--error-bg);
        color: var(--error);
    }

/* ========================================
   Portal Buttons
   ======================================== */
.portal-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.portal-btn-primary {
    background: var(--primary);
    color: white;
}

    .portal-btn-primary:hover {
        opacity: 0.9;
    }

.portal-btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

    .portal-btn-secondary:hover {
        background: var(--gray-200);
    }

.portal-btn-download {
    background: #dbeafe;
    color: #2563eb;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

    .portal-btn-download:hover {
        background: #bfdbfe;
    }

/* ========================================
   Portal Profile
   ======================================== */
.portal-profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.portal-profile-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.portal-profile-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.portal-profile-value {
    font-size: 1rem;
    color: var(--dark);
    font-weight: 500;
}

/* ========================================
   Portal Empty State
   ======================================== */
.portal-empty {
    text-align: center;
    padding: 3rem;
    color: var(--gray-500);
}

.portal-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.portal-empty p {
    margin: 0;
}

/* ========================================
   Portal Not Logged In
   ======================================== */
.portal-not-logged-in {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--gray-500);
    font-family: 'Segoe UI', sans-serif;
}

    .portal-not-logged-in button {
        padding: 0.75rem 2rem;
        background: var(--primary);
        color: white;
        border: none;
        border-radius: var(--radius);
        cursor: pointer;
        font-weight: 600;
    }

/* ========================================
   Balance Summary
   ======================================== */
.balance-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.balance-item {
    text-align: center;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--radius);
}

    .balance-item.total {
        background: var(--primary);
        color: white;
    }

        .balance-item.total .balance-label {
            color: rgba(255, 255, 255, 0.8);
        }

.balance-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
}

.balance-item.total .balance-amount {
    color: white;
}

.balance-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.portal-header h1 {
    outline: none;
    border: none;
}

h1:focus,
h1:focus-visible,
.portal-header h1 {
    outline: none !important;
    box-shadow: none !important;
}

.apply-link {
    display: block;
    text-align: center;
    color: var(--primary);
    text-decoration: none;
    margin-bottom: 1rem;
    font-weight: 500;
}

    .apply-link:hover {
        text-decoration: underline;
    }
