/* ── SudSeguros Procurement System ── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --primary: #1a3a5c;
    --primary-light: #2c5f8a;
    --primary-dark: #0f2440;
    --accent: #e8913a;
    --accent-light: #f4a855;
    --success: #2d8659;
    --danger: #c0392b;
    --warning: #d4a017;
    --info: #2980b9;
    --bg: #f0f2f5;
    --surface: #ffffff;
    --surface-alt: #f8f9fa;
    --text: #2c3e50;
    --text-muted: #7f8c8d;
    --border: #dfe6e9;
    --sidebar-width: 260px;
    --radius: 10px;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'DM Sans', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-brand i {
    font-size: 28px;
    color: var(--accent);
    margin-bottom: 4px;
}

.sidebar-brand span {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.3px;
}

.sidebar-brand small {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav {
    list-style: none;
    padding: 16px 12px;
    flex: 1;
}

.sidebar-nav li { margin-bottom: 2px; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.sidebar-nav a.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(232,145,58,0.3);
}

.sidebar-nav a i { font-size: 18px; width: 22px; text-align: center; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info i { font-size: 24px; color: var(--accent-light); }
.user-info strong { display: block; font-size: 13px; color: #fff; }
.user-info small { font-size: 11px; color: rgba(255,255,255,0.5); }

.btn-logout {
    color: rgba(255,255,255,0.5);
    font-size: 20px;
    transition: color 0.2s;
    text-decoration: none;
}

.btn-logout:hover { color: var(--danger); }

/* ── Main Content ── */
#main-content {
    margin-left: var(--sidebar-width);
    padding: 28px 32px;
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
}

.flash-messages { margin-bottom: 20px; }
.flash-messages .alert { border: none; border-radius: var(--radius); font-size: 14px; }
.flash-messages .alert i { margin-right: 8px; }

/* ── Cards ── */
.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: var(--surface);
    overflow: hidden;
}

.card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body { padding: 20px; }

/* ── Page Header ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-dark);
    letter-spacing: -0.5px;
}

.page-header h1 i { color: var(--accent); margin-right: 8px; }

/* ── Stat Cards ── */
.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.blue { background: #dbeafe; color: #1d4ed8; }
.stat-icon.orange { background: #ffedd5; color: #c2410c; }
.stat-icon.green { background: #dcfce7; color: #15803d; }
.stat-icon.yellow { background: #fef9c3; color: #a16207; }
.stat-icon.purple { background: #f3e8ff; color: #7c3aed; }
.stat-icon.teal { background: #ccfbf1; color: #0f766e; }

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-dark);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-info p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
    font-weight: 500;
}

/* ── Tables ── */
.table { font-size: 13px; margin: 0; }
.table th {
    background: var(--surface-alt);
    font-weight: 600;
    color: var(--primary);
    border-bottom: 2px solid var(--border);
    padding: 12px 16px;
    white-space: nowrap;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}

.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

/* ── Badges ── */
.badge {
    font-weight: 600;
    font-size: 11px;
    padding: 5px 10px;
    border-radius: 6px;
    letter-spacing: 0.3px;
}

.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ── Buttons ── */
.btn {
    font-weight: 600;
    font-size: 13px;
    border-radius: 8px;
    padding: 8px 16px;
    transition: all 0.2s;
}

.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-light); border-color: var(--primary-light); }

.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-light); border-color: var(--accent-light); color: #fff; }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }

.btn-outline-secondary { border-color: var(--border); color: var(--text-muted); }
.btn-outline-secondary:hover { background: var(--surface-alt); color: var(--text); }

/* ── Forms ── */
.form-control, .form-select {
    border-radius: 8px;
    border-color: var(--border);
    font-size: 14px;
    padding: 9px 14px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(26,58,92,0.1);
}

.form-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--primary);
    margin-bottom: 6px;
}

/* ── Status Flow ── */
.status-flow {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    padding: 16px 0;
}

.status-step {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: var(--surface-alt);
    color: var(--text-muted);
    border: 2px solid var(--border);
}

.status-step.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.status-step.completed {
    background: #dcfce7;
    color: #15803d;
    border-color: #86efac;
}

.status-step.rejected {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}

.status-arrow {
    color: var(--border);
    font-size: 16px;
}

/* ── Detail Section ── */
.detail-section {
    margin-bottom: 24px;
}

.detail-section h5 {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.detail-item label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.detail-item span {
    font-size: 15px;
    font-weight: 500;
}

/* ── Activity Log ── */
.activity-list {
    list-style: none;
    padding: 0;
    position: relative;
}

.activity-list::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.activity-item {
    position: relative;
    padding-left: 36px;
    padding-bottom: 16px;
}

.activity-item::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-light);
    border: 2px solid var(--surface);
}

.activity-item .time {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.activity-item .action { font-weight: 600; font-size: 13px; }
.activity-item .details { font-size: 12px; color: var(--text-muted); }

/* ── Score Inputs ── */
.score-input {
    width: 70px;
    text-align: center;
    font-weight: 700;
    font-size: 16px;
}

.score-total {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

/* ── Items Table (dynamic) ── */
.items-container .item-row {
    background: var(--surface-alt);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
}

/* ── Login ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
}

.login-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.login-card .brand {
    text-align: center;
    margin-bottom: 32px;
}

.login-card .brand i {
    font-size: 48px;
    color: var(--accent);
}

.login-card .brand h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-top: 8px;
}

.login-card .brand p {
    font-size: 13px;
    color: var(--text-muted);
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    #main-content {
        margin-left: 0;
        width: 100%;
        padding: 16px;
    }
    .sidebar-toggle {
        display: block;
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 999;
        background: var(--primary);
        color: #fff;
        border: none;
        border-radius: 8px;
        width: 40px;
        height: 40px;
        font-size: 20px;
        cursor: pointer;
    }
    .page-header h1 { font-size: 20px; }
    .stat-card { padding: 14px; }
    .stat-info h3 { font-size: 22px; }
    .detail-grid { grid-template-columns: 1fr; }
}

@media (min-width: 769px) {
    .sidebar-toggle { display: none; }
}

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    opacity: 0.3;
    margin-bottom: 12px;
}

.empty-state p { margin-top: 8px; }

/* ── Comparison table highlight ── */
.winner-row { background: #dcfce7 !important; }
.winner-badge {
    background: var(--success);
    color: #fff;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
}
