/**
 * Marketplace Customer Portal Design System
 * Adheres to Morata & UI-01 Tokens
 * 
 * Supports all CUST-0001 through CUST-1045 presentation, accessibility & responsive specifications.
 */

:root {
    --cp-primary: #1d4ed8;
    --cp-primary-hover: #1e40af;
    --cp-primary-light: #eff6ff;
    --cp-navy: #161c35;
    --cp-text: #1e293b;
    --cp-muted: #64748b;
    --cp-border: #e2e8f0;
    --cp-card: #ffffff;
    --cp-bg: #f8fafc;
    --cp-success: #10b981;
    --cp-warning: #f59e0b;
    --cp-danger: #ef4444;
}

/* Container */
.mp-customer-portal {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--cp-text);
    background: var(--cp-bg);
    border-radius: 14px;
    border: 1px solid var(--cp-border);
    overflow: hidden;
    margin-block: 20px 40px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
}

/* Header & Welcome Strip */
.cp-welcome-bar {
    background: linear-gradient(135deg, #161c35 0%, #1e293b 100%);
    color: #ffffff;
    padding: 24px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.cp-user-profile {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cp-avatar-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #2563eb;
    color: #ffffff;
    font-size: 22px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.cp-user-name {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.cp-tier-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    margin-top: 4px;
}

.cp-welcome-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Grid Layout: Sidebar Navigation + Main Portal Body */
.cp-layout-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 640px;
    background: #ffffff;
}

/* Sidebar Nav */
.cp-sidebar-nav {
    background: #f8fafc;
    border-right: 1px solid var(--cp-border);
    padding: 16px 12px;
}

.cp-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cp-nav-item a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    color: #475569;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.cp-nav-item a:hover {
    background: #eff6ff;
    color: var(--cp-primary);
}

.cp-nav-item.active a {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.cp-nav-item .cp-nav-icon {
    font-size: 16px;
    margin-right: 8px;
    display: inline-block;
}

.cp-nav-pill-count {
    background: #ef4444;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 10px;
}

.cp-nav-item.active .cp-nav-pill-count {
    background: #ffffff;
    color: #2563eb;
}

/* Main Content Area */
.cp-content-panel {
    padding: 28px 32px;
    background: #ffffff;
    min-height: 500px;
}

/* Stat Cards Strip */
.cp-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.cp-stat-card {
    background: #ffffff;
    border: 1px solid var(--cp-border);
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform 0.15s ease;
}

.cp-stat-card:hover {
    transform: translateY(-2px);
}

.cp-stat-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.cp-stat-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--cp-text);
    margin: 0;
    line-height: 1.1;
}

.cp-stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--cp-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 2px;
}

/* Quick Action Buttons */
.cp-quick-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--cp-border);
}

.cp-action-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    color: #334155;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.15s ease;
}

.cp-action-pill:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* Tables & Lists */
.cp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 10px;
}

.cp-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    text-align: left;
    padding: 12px 14px;
    border-bottom: 2px solid var(--cp-border);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cp-table td {
    padding: 14px;
    border-bottom: 1px solid var(--cp-border);
    color: var(--cp-text);
    vertical-align: middle;
}

.cp-table tr:hover td {
    background: #f8fafc;
}

/* Badges */
.cp-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cp-badge-success { background: #dcfce7; color: #15803d; }
.cp-badge-warning { background: #fef3c7; color: #b45309; }
.cp-badge-danger { background: #fee2e2; color: #b91c1c; }
.cp-badge-info { background: #dbeafe; color: #1d4ed8; }

/* Empty States */
.cp-empty-state {
    text-align: center;
    padding: 48px 24px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px dashed #cbd5e1;
    margin-block: 16px;
}

.cp-empty-icon {
    font-size: 42px;
    margin-bottom: 12px;
}

.cp-empty-title {
    font-size: 18px;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 6px;
}

.cp-empty-desc {
    font-size: 13px;
    color: #64748b;
    max-width: 420px;
    margin: 0 auto 16px;
}

/* Forms */
.cp-form-group {
    margin-bottom: 16px;
}

.cp-form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 6px;
}

.cp-form-input,
.cp-form-select,
.cp-form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    color: #1e293b;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease;
}

.cp-form-input:focus,
.cp-form-select:focus,
.cp-form-textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Tracking Timeline */
.cp-tracking-timeline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    margin: 28px 0;
}

.cp-tracking-timeline::before {
    content: '';
    position: absolute;
    top: 18px;
    left: 20px;
    right: 20px;
    height: 4px;
    background: #e2e8f0;
    z-index: 1;
}

.cp-track-step {
    position: relative;
    z-index: 2;
    text-align: center;
    flex: 1;
}

.cp-track-icon-dot {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-size: 14px;
    font-weight: 700;
    border: 3px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.cp-track-step.done .cp-track-icon-dot {
    background: #10b981;
    color: #ffffff;
}

.cp-track-step.active .cp-track-icon-dot {
    background: #2563eb;
    color: #ffffff;
}

.cp-track-label {
    font-size: 11px;
    font-weight: 700;
    color: #475569;
}

/* Responsive */
@media (max-width: 900px) {
    .cp-layout-grid {
        grid-template-columns: 1fr;
    }
    .cp-sidebar-nav {
        border-right: none;
        border-bottom: 1px solid var(--cp-border);
        overflow-x: auto;
    }
    .cp-nav-list {
        flex-direction: row;
        white-space: nowrap;
    }
    .cp-content-panel {
        padding: 20px 16px;
    }
}
