/* ============================================================
   CrystaLogistics — Customer Portal Stylesheet
   ============================================================ */

/* Layout */
.customer-portal {
    display: flex;
    min-height: calc(100vh - 72px);
    background: #f1f5f9;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.customer-sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--white);
    border-right: 1px solid var(--border);
    position: sticky;
    top: 72px;
    height: calc(100vh - 72px);
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.customer-sidebar::-webkit-scrollbar { width: 4px; }
.customer-sidebar::-webkit-scrollbar-track { background: transparent; }
.customer-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Sidebar user card */
.csidebar-user {
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    flex-shrink: 0;
}
.csidebar-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 17px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(30,58,95,.25);
}
.csidebar-name {
    font-weight: 700; font-size: 14px; color: var(--primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.csidebar-email {
    font-size: 11px; color: var(--text-light);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-bottom: 10px;
}
.csidebar-balance-pill {
    display: inline-flex; align-items: center; gap: 5px;
    background: white;
    border: 1px solid rgba(34,197,94,.3);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 700;
    color: #16a34a;
}
.csidebar-balance-pill i { font-size: 10px; }

/* Sidebar nav */
.csidebar-nav { padding: 12px 8px; flex: 1; }

.csidebar-nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--text);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none !important;
    transition: var(--transition);
    margin-bottom: 2px;
    position: relative;
}
.csidebar-nav-item i {
    width: 18px; text-align: center;
    color: var(--text-light); font-size: 14px;
    transition: var(--transition);
}
.csidebar-nav-item:hover { background: var(--bg-light); color: var(--primary); }
.csidebar-nav-item:hover i { color: var(--primary); }
.csidebar-nav-item.active {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: var(--primary);
    font-weight: 600;
}
.csidebar-nav-item.active i { color: var(--primary); }
.csidebar-nav-item .badge {
    margin-left: auto;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
}

.csidebar-section-label {
    font-size: 10px; font-weight: 700;
    letter-spacing: 1px; text-transform: uppercase;
    color: var(--text-light);
    padding: 10px 12px 4px;
}

.csidebar-divider {
    height: 1px; background: var(--border);
    margin: 6px 12px;
}

.csidebar-nav-item.logout { color: #ef4444; }
.csidebar-nav-item.logout i { color: #ef4444; }
.csidebar-nav-item.logout:hover { background: #fee2e2; color: #dc2626; }

/* ── Main content ─────────────────────────────────────────── */
.customer-main {
    flex: 1;
    padding: 24px;
    min-width: 0;
}

/* Portal page title */
.cportal-title {
    margin-bottom: 20px;
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
}
.cportal-title-text h2 {
    font-size: 20px; color: var(--primary);
    margin: 0; font-weight: 800;
}
.cportal-title-text p {
    color: var(--text-light); font-size: 13px;
    margin: 3px 0 0;
}

/* ── Stat cards ───────────────────────────────────────────── */
.cstat-card {
    background: var(--white);
    border-radius: 12px;
    padding: 18px 16px;
    display: flex; align-items: center; gap: 14px;
    border: 1px solid var(--border);
    transition: var(--transition);
    text-decoration: none !important;
    color: inherit !important;
    height: 100%;
}
.cstat-card:hover {
    box-shadow: 0 6px 24px rgba(30,58,95,.1);
    transform: translateY(-2px);
    border-color: transparent;
}
.cstat-icon {
    width: 48px; height: 48px; min-width: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px;
}
.cstat-icon.blue   { background: linear-gradient(135deg,#dbeafe,#bfdbfe); color: #1d4ed8; }
.cstat-icon.sky    { background: linear-gradient(135deg,#e0f2fe,#bae6fd); color: #0284c7; }
.cstat-icon.green  { background: linear-gradient(135deg,#dcfce7,#bbf7d0); color: #16a34a; }
.cstat-icon.orange { background: linear-gradient(135deg,#fff3e0,#ffe0b2); color: #ea580c; }
.cstat-icon.amber  { background: linear-gradient(135deg,#fef9c3,#fef08a); color: #b45309; }
.cstat-icon.purple { background: linear-gradient(135deg,#f3e8ff,#e9d5ff); color: #7c3aed; }
.cstat-icon.red    { background: linear-gradient(135deg,#fee2e2,#fecaca); color: #dc2626; }
.cstat-icon.slate  { background: linear-gradient(135deg,#f1f5f9,#e2e8f0); color: #475569; }

.cstat-value {
    font-size: 24px; font-weight: 800;
    line-height: 1; color: var(--text);
}
.cstat-label {
    font-size: 12px; color: var(--text-light);
    margin-top: 2px;
}

/* ── Wallet card ──────────────────────────────────────────── */
.cwallet-hero {
    background: linear-gradient(135deg, var(--primary) 0%, #163060 100%);
    border-radius: 16px;
    padding: 28px 28px 24px;
    color: white;
    position: relative;
    overflow: hidden;
}
.cwallet-hero::before {
    content: ''; position: absolute;
    top: -40px; right: -40px;
    width: 160px; height: 160px;
    border-radius: 50%;
    background: rgba(255,255,255,.05);
}
.cwallet-hero::after {
    content: ''; position: absolute;
    bottom: -60px; right: 60px;
    width: 220px; height: 220px;
    border-radius: 50%;
    background: rgba(255,255,255,.03);
}
.cwallet-icon {
    width: 48px; height: 48px;
    border-radius: 14px;
    background: rgba(255,255,255,.12);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; margin-bottom: 16px;
    position: relative; z-index: 1;
}
.cwallet-label {
    font-size: 13px; opacity: .75;
    position: relative; z-index: 1;
    margin-bottom: 6px;
}
.cwallet-balance {
    font-size: 38px; font-weight: 800;
    letter-spacing: -1.5px; line-height: 1;
    position: relative; z-index: 1;
    margin-bottom: 6px;
}
.cwallet-sub {
    font-size: 12px; opacity: .55;
    position: relative; z-index: 1;
}
.cwallet-actions {
    display: flex; gap: 8px; flex-wrap: wrap;
    margin-top: 20px; position: relative; z-index: 1;
}
.cwallet-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px; font-weight: 600;
    border: none; cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}
.cwallet-btn-primary {
    background: var(--secondary);
    color: white;
}
.cwallet-btn-primary:hover {
    background: var(--secondary-dark);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(249,115,22,.4);
}
.cwallet-btn-outline {
    background: rgba(255,255,255,.12);
    color: white;
    border: 1px solid rgba(255,255,255,.25);
}
.cwallet-btn-outline:hover {
    background: rgba(255,255,255,.2);
    color: white;
}

/* Wallet stat pills */
.cwallet-stats {
    display: flex; gap: 12px; flex-wrap: wrap;
    margin-top: 20px; position: relative; z-index: 1;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,.1);
}
.cwallet-stat { flex: 1; min-width: 90px; }
.cwallet-stat-val { font-size: 16px; font-weight: 700; }
.cwallet-stat-lbl { font-size: 11px; opacity: .6; margin-top: 1px; }

/* ── Alert cards ──────────────────────────────────────────── */
.cportal-alert-card {
    background: var(--white);
    border-radius: 12px;
    padding: 16px;
    display: flex; align-items: center; gap: 14px;
    border: 1px solid var(--border);
    text-decoration: none !important;
    transition: var(--transition);
    height: 100%;
}
.cportal-alert-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.cportal-alert-card.wallet { border-left: 4px solid var(--primary) !important; }
.cportal-alert-card.warning { border-left: 4px solid #f59e0b !important; }
.cportal-alert-card.danger  { border-left: 4px solid #ef4444 !important; }

.cportal-alert-icon {
    width: 40px; height: 40px; min-width: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; color: white;
}
.cportal-alert-val {
    font-size: 18px; font-weight: 800; line-height: 1;
    color: var(--text);
}
.cportal-alert-lbl { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* ── Quick links ──────────────────────────────────────────── */
.cquick-link {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    border: 1px solid var(--border);
    text-decoration: none !important;
    transition: var(--transition);
    display: block;
}
.cquick-link:hover {
    box-shadow: var(--shadow);
    transform: translateY(-3px);
    border-color: var(--accent);
}
.cquick-link i { font-size: 26px; display: block; margin-bottom: 10px; }
.cquick-link strong { font-size: 13px; color: var(--text); display: block; }
.cquick-link span { font-size: 11px; color: var(--text-light); margin-top: 2px; display: block; }

/* ── Recharge widget ──────────────────────────────────────── */
.recharge-widget {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border);
}
.recharge-widget h6 {
    font-size: 14px; font-weight: 700;
    color: var(--primary); margin-bottom: 12px;
}
.preset-chips {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-bottom: 14px;
}
.preset-chip {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    background: var(--bg-light);
    font-size: 13px; font-weight: 600;
    color: var(--text); cursor: pointer;
    transition: var(--transition);
}
.preset-chip:hover, .preset-chip.active {
    border-color: var(--primary);
    background: #dbeafe;
    color: var(--primary);
}

/* ── Mobile sidebar overlay ───────────────────────────────── */
.csidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1049;
}
.csidebar-overlay.show { display: block; }

.csidebar-toggle {
    display: none;
    position: fixed;
    bottom: 84px; right: 16px;
    width: 46px; height: 46px;
    border-radius: 50%;
    background: var(--primary);
    color: white; border: none;
    font-size: 17px;
    z-index: 9999;
    align-items: center; justify-content: center;
    box-shadow: 0 4px 20px rgba(30,58,95,.4);
    cursor: pointer;
}

/* Utility classes */
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }
.fw-800 { font-weight: 800 !important; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .customer-sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        height: 100vh;
        transform: translateX(-100%);
        z-index: 1050;
        transition: transform .3s ease;
        top: 0 !important;
    }
    .customer-sidebar.open { transform: translateX(0); }
    .customer-main { padding: 16px 12px; }
    .csidebar-toggle { display: flex; }
    .cwallet-balance { font-size: 28px; }
}
@media (max-width: 575.98px) {
    .cstat-value { font-size: 20px; }
    .cportal-title-text h2 { font-size: 18px; }
}

/* ── Table improvements in portal ────────────────────────── */
.customer-main .table-card { border-radius: 12px; }
.customer-main .table th { font-size: 11px; }
.customer-main .table td { font-size: 13px; }

/* ── Ticker ───────────────────────────────────────────────── */
.cust-ticker {
    background: linear-gradient(90deg, #0f2340 0%, #1e3a5f 100%);
    padding: 9px 0;
    display: flex; align-items: center;
    gap: 0; overflow: hidden;
    position: relative;
}
.cust-ticker-badge {
    background: var(--secondary);
    color: white; font-size: 10px; font-weight: 800;
    letter-spacing: 1px; text-transform: uppercase;
    padding: 4px 14px;
    white-space: nowrap;
    flex-shrink: 0;
    z-index: 2;
    border-radius: 0 4px 4px 0;
}
.cust-ticker-track {
    display: flex; align-items: center; gap: 0;
    white-space: nowrap;
    animation: tickerScroll 40s linear infinite;
    padding-left: 20px;
}
.cust-ticker.paused .cust-ticker-track { animation-play-state: paused; }
@keyframes tickerScroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.cust-ticker-event {
    display: inline-flex; align-items: center; gap: 4px;
    color: rgba(255,255,255,.85); font-size: 12px;
    padding: 0 24px;
    border-right: 1px solid rgba(255,255,255,.1);
}
.cust-ticker-time {
    color: rgba(255,255,255,.4);
    font-size: 10px; margin-left: 6px;
}
.cust-ticker-pause {
    background: transparent; border: none;
    color: rgba(255,255,255,.5); font-size: 12px;
    margin-left: auto; padding: 0 14px;
    cursor: pointer; flex-shrink: 0;
}
.cust-ticker-pause:hover { color: white; }

/* ── Transaction history in wallet ───────────────────────── */
.txn-item {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.txn-item:last-child { border-bottom: none; }
.txn-icon {
    width: 38px; height: 38px; min-width: 38px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
}
.txn-icon.credit { background: #dcfce7; color: #16a34a; }
.txn-icon.debit  { background: #fee2e2; color: #dc2626; }
.txn-desc { flex: 1; min-width: 0; }
.txn-desc-main { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txn-desc-sub  { font-size: 11px; color: var(--text-light); }
.txn-amount { font-size: 15px; font-weight: 700; white-space: nowrap; }
.txn-amount.credit { color: #16a34a; }
.txn-amount.debit  { color: #dc2626; }
.txn-balance { font-size: 11px; color: var(--text-light); white-space: nowrap; text-align: right; }
