/* ─── TenderBuild CSS: Premium Blue Theme ─── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-input: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-topbar: rgba(255, 255, 255, 0.9);

    --sidebar-text: #64748b;
    --sidebar-text-hover: #0f172a;
    --sidebar-hover-bg: #f1f5f9;
    --sidebar-border: #e2e8f0;
    --logo-text: #0f172a;

    --border-color: #e2e8f0;
    --border-subtle: #f1f5f9;
    --border-focus: #3b82f6;

    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-accent: #2563eb;

    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.15);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --gradient-1: linear-gradient(135deg, #2563eb, #3b82f6);
    --gradient-2: linear-gradient(135deg, #1e40af, #3b82f6);
    --gradient-card: linear-gradient(135deg, rgba(59,130,246,0.02), rgba(37,99,235,0.02));

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 32px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.1);

    --sidebar-width: 260px;
    --topbar-height: 64px;
    --font: 'Inter', -apple-system, sans-serif;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body:not(.light-theme) {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --bg-input: #0f172a;
    --bg-sidebar: #020617;
    --bg-topbar: rgba(15, 23, 42, 0.9);

    --sidebar-text: #94a3b8;
    --sidebar-text-hover: #f8fafc;
    --sidebar-hover-bg: #1e293b;
    --sidebar-border: #1e293b;
    --logo-text: #f8fafc;

    --border-color: #334155;
    --border-subtle: #1e293b;
    --border-focus: #3b82f6;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
}

/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }
button, input, select, textarea { font-family: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Hide Sidebar scrollbar */
.sidebar::-webkit-scrollbar, .sidebar-nav::-webkit-scrollbar { display: none; }
.sidebar, .sidebar-nav { -ms-overflow-style: none; scrollbar-width: none; }

/* ─── Layout ────────────────────────────────────────────── */
.app-layout { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--sidebar-border);
    display: flex; flex-direction: column;
    transition: all var(--transition);
    z-index: 100;
    flex-shrink: 0;
}

.sidebar-header {
    height: var(--topbar-height);
    padding: 0 20px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--sidebar-border);
}
.logo { display: flex; align-items: center; gap: 12px; }
.logo-img {
    width: 42px; height: 42px; border-radius: var(--radius-md);
    background: white; display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-sm); overflow: hidden; padding: 4px;
}
.logo-text h1 { font-size: 1.15rem; font-weight: 700; color: var(--logo-text); line-height: 1.2; margin: 0; }
.logo-text span { font-size: 0.7rem; color: var(--sidebar-text); text-transform: uppercase; letter-spacing: 1px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 20px 12px; }
.nav-section { margin-bottom: 24px; }
.nav-section-title {
    display: block; padding: 0 12px; margin-bottom: 8px;
    font-size: 0.75rem; font-weight: 700; color: var(--sidebar-text);
    text-transform: uppercase; letter-spacing: 1px;
}
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    color: var(--sidebar-text); font-weight: 500; font-size: 0.95rem;
    transition: all var(--transition); margin-bottom: 4px;
}
.nav-item:hover { background: var(--sidebar-hover-bg); color: var(--sidebar-text-hover); }
.nav-item.active { background: var(--accent); color: white; box-shadow: var(--shadow-glow); }
.nav-item i, .nav-item svg { width: 20px; height: 20px; }
.nav-badge {
    margin-left: auto; background: var(--danger); color: white;
    font-size: 0.7rem; font-weight: 700; padding: 2px 6px; border-radius: 10px;
}

.sidebar-footer { padding: 20px; border-top: 1px solid var(--sidebar-border); }
.sidebar-footer-info {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.75rem; color: var(--sidebar-text);
    white-space: nowrap;
}

/* Sidebar Toggle States */
.sidebar.collapsed { width: 80px; }
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .sidebar-footer-info span { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }
.sidebar.collapsed .nav-item i { margin: 0; }

@media (max-width: 768px) {
    .sidebar { position: fixed; left: -100%; top: 0; bottom: 0; box-shadow: var(--shadow-lg); }
    .sidebar.open { left: 0; }
    .sidebar-close-btn { display: flex; }
}

/* Main Content */
.main-content {
    flex: 1; display: flex; flex-direction: column;
    min-width: 0; position: relative;
    transition: all var(--transition);
}

.topbar {
    height: var(--topbar-height);
    background: var(--bg-topbar);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; z-index: 50;
}
.topbar-btn {
    background: transparent; border: none; color: var(--text-secondary);
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all var(--transition);
}
.topbar-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.topbar-title { font-weight: 600; font-size: 1.1rem; color: var(--text-primary); }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.topbar-clock { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); display: none; }
@media (min-width: 768px) { .topbar-clock { display: block; } }

.page-container {
    flex: 1; padding: 24px; overflow-y: auto;
    max-width: 1400px; margin: 0 auto; width: 100%;
}

/* ─── Components ────────────────────────────────────────── */
.page-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 24px; flex-wrap: wrap; gap: 16px; }
.page-header h2 { font-size: 1.5rem; font-weight: 700; margin: 0 0 4px 0; color: var(--text-primary); }
.page-header p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }

.toolbar { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }

.card {
    background: var(--bg-secondary); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); padding: 20px;
    box-shadow: var(--shadow-sm); transition: all var(--transition);
}
.card:hover { border-color: var(--accent); box-shadow: var(--shadow-glow); }
.card-title { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 12px; }
.card-glass { background: rgba(255, 255, 255, 0.03); backdrop-filter: blur(12px); border: 1px solid rgba(255, 255, 255, 0.05); }
body.light-theme .card-glass { background: rgba(255, 255, 255, 0.7); border: 1px solid rgba(0,0,0,0.05); }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--bg-secondary); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); padding: 16px;
    display: flex; align-items: center; gap: 16px;
}
.stat-icon {
    width: 48px; height: 48px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    background: rgba(59, 130, 246, 0.1); color: var(--accent);
}
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 10px 14px;
    background: var(--bg-input); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); color: var(--text-primary);
    font-size: 0.9rem; transition: all var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 16px; border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 600;
    cursor: pointer; border: 1px solid transparent; transition: all var(--transition);
}
.btn-primary { background: var(--accent); color: white; box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--bg-input); color: var(--text-primary); border-color: var(--border-color); }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:disabled { opacity: 0.7; cursor: not-allowed; }

.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn-secondary { background: var(--bg-input); color: var(--text-primary); border-color: var(--border-color); }
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--text-muted); }
.btn-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); border-color: rgba(239, 68, 68, 0.2); }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-icon { padding: 8px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Tables */
.table-container { 
    overflow-x: auto; 
    border-radius: var(--radius-md); 
    border: 1px solid var(--border-color); 
    background: var(--bg-secondary);
    box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: separate; border-spacing: 0; }
thead th {
    background: var(--bg-card-hover); 
    padding: 14px 16px; 
    text-align: left;
    font-size: 0.8rem; 
    font-weight: 600; 
    color: var(--text-secondary);
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
    border-bottom: 2px solid var(--border-color);
    position: sticky; top: 0; z-index: 10;
}
body:not(.light-theme) thead th { background: #1e293b; }
tbody td {
    padding: 16px; 
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.95rem; 
    color: var(--text-primary); 
    vertical-align: middle;
}
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: rgba(59, 130, 246, 0.03); }
tbody tr:last-child td { border-bottom: none; }

.table-actions { display: flex; gap: 8px; align-items: center; }

/* Dropdowns (High Z-Index Fix) */
.tb-dropdown {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    background: var(--bg-secondary); border: 1px solid var(--border-focus);
    border-radius: var(--radius-sm); max-height: 250px; overflow-y: auto;
    z-index: 99999; box-shadow: var(--shadow-lg);
}
.tb-dd-item {
    padding: 10px 14px; font-size: 0.85rem; cursor: pointer;
    border-bottom: 1px solid var(--border-subtle); color: var(--text-primary);
}
.tb-dd-item:last-child { border-bottom: none; }
.tb-dd-item:hover { background: rgba(59, 130, 246, 0.1); color: var(--accent); }

/* Tender Typography */
.tb-pagu { font-weight: 800; color: var(--accent); font-size: 0.95rem; letter-spacing: -0.2px; }
.tb-date-past { font-size: 0.82rem; color: var(--text-muted); }
.tb-date-open {
    font-size: 0.85rem; font-weight: 700; color: var(--warning);
    display: flex; align-items: center; gap: 4px;
}
.tb-date-open::before {
    content: ''; display: inline-block; width: 6px; height: 6px;
    border-radius: 50%; background: var(--warning);
    box-shadow: 0 0 8px var(--warning); animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
.badge-success { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-danger  { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.2); }
.badge-info    { background: rgba(59, 130, 246, 0.15); color: #3b82f6; border: 1px solid rgba(59, 130, 246, 0.2); }
.badge-gray    { background: rgba(100, 116, 139, 0.15); color: #64748b; border: 1px solid rgba(100, 116, 139, 0.2); }

/* Tabs */
.tabs {
    display: flex; gap: 4px; background: var(--bg-secondary);
    border-radius: var(--radius-lg); padding: 6px; margin-bottom: 24px;
    border: 1px solid var(--border-color); box-shadow: var(--shadow-sm);
}
.tab {
    padding: 12px 24px; border-radius: var(--radius-md); font-size: 0.9rem;
    font-weight: 600; color: var(--text-secondary); background: transparent;
    border: none; transition: all var(--transition); flex: 1; text-align: center;
    display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
}
.tab:hover { color: var(--text-primary); background: rgba(59, 130, 246, 0.05); }
.tab.active { background: rgba(59, 130, 246, 0.1); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.2); }

/* Modals */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 20px; opacity: 1; transition: opacity 0.2s;
}
.modal-overlay.hidden { display: none; opacity: 0; }
.modal {
    background: var(--bg-secondary); border-radius: var(--radius-lg);
    width: 100%; max-width: 700px; max-height: 90vh;
    display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}
.modal-header {
    padding: 20px 24px; border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h2 { margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }
.modal-close { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 4px; }
.modal-close:hover { background: var(--bg-card-hover); color: var(--danger); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
    padding: 16px 24px; border-top: 1px solid var(--border-color);
    display: flex; justify-content: flex-end; gap: 12px;
}

/* Toast */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
    background: var(--bg-secondary); border: 1px solid var(--border-color);
    padding: 16px 20px; border-radius: var(--radius-md); box-shadow: var(--shadow-md);
    display: flex; align-items: center; gap: 12px; font-weight: 500; font-size: 0.9rem;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1); min-width: 300px;
}
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast-success i { color: var(--success); }
.toast-error i { color: var(--danger); }
.toast-warning i { color: var(--warning); }
.toast-info i { color: var(--info); }

/* Utilities */
.hidden { display: none !important; }
.text-center { text-align: center; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state i { width: 48px; height: 48px; margin-bottom: 16px; opacity: 0.5; }
.page-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 300px; color: var(--text-muted); }
.spinner {
    width: 32px; height: 32px; border: 3px solid var(--border-color);
    border-top-color: var(--accent); border-radius: 50%;
    animation: spin 1s linear infinite; margin-bottom: 16px;
}
.spinner-sm { width: 16px; height: 16px; border-width: 2px; margin: 0; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.search-box { position: relative; width: 100%; max-width: 400px; display: flex; align-items: center; }
.search-box input { width: 100%; padding: 10px 16px 10px 40px; background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--radius-md); font-size: 0.95rem; color: var(--text-primary); transition: all var(--transition); }
.search-box input:focus { border-color: var(--border-focus); outline: none; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.search-box i, .search-box svg { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--text-muted); pointer-events: none; }

.tb-grid { display: grid; grid-template-columns: 2.2fr 1fr 1fr auto; gap: 16px; align-items: flex-end; }
@media (max-width: 768px) { .tb-grid { grid-template-columns: 1fr; } }

/* Schedule Calendar Items (Dashboard) */
.schedule-calendar-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    margin-bottom: 12px;
    transition: all 0.2s ease;
}
.schedule-calendar-item:hover {
    transform: translateX(4px);
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}
.date-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 54px;
    background: var(--accent-light);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}
.date-badge .month {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}
.date-badge .day {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1.2;
}
.schedule-info {
    flex: 1;
    min-width: 0;
}
.stage-tag {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.tender-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.instansi-name {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}
.instansi-name i {
    width: 12px;
    height: 12px;
}
.time-info {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.time-info i {
    width: 14px;
    height: 14px;
}

/* LPSE Chip */
.lpse-chip {
    display: flex; align-items: center; gap: 8px; padding: 6px 12px;
    background: rgba(59, 130, 246, 0.05); border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-md); font-size: 0.85rem; color: var(--text-primary);
    transition: all var(--transition);
}
.lpse-chip:hover { background: rgba(59, 130, 246, 0.1); border-color: var(--accent); }
.lpse-chip button {
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: none; color: var(--text-muted);
    cursor: pointer; padding: 2px; border-radius: 4px; transition: all var(--transition);
}
.lpse-chip button:hover { background: var(--danger); color: white; }
