/* ═══════════════════════════════════════════════════════════
   ZP-DMS Application Styles
   ═══════════════════════════════════════════════════════════ */

:root {
    --primary: #1B4F72;
    --primary-light: #2E86C1;
    --primary-dark: #154360;
    --sidebar-width: 260px;
    --sidebar-collapsed: 0px;
    --header-height: 56px;
    --bg-light: #f4f6f9;
    --text-dark: #2c3e50;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 0;
    background: var(--bg-light);
    color: var(--text-dark);
}

/* ─── App Container ────────────────────────────────────── */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ──────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--primary);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transition: width 0.3s ease;
    overflow-y: auto;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); overflow: hidden; }

.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-container i { font-size: 28px; color: #f39c12; }
.logo-text { font-size: 20px; font-weight: 700; display: block; }
.logo-subtitle { font-size: 11px; opacity: 0.7; display: block; }

/* ─── Nav Menu ─────────────────────────────────────────── */
.nav-menu { padding: 8px 0; }
.nav-menu .nav { list-style: none; padding: 0; margin: 0; }

.nav-menu .nav-item { margin: 1px 0; }

.nav-menu .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-menu .nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-menu .nav-link.active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-left-color: #f39c12;
}

.nav-menu .nav-link i { width: 20px; text-align: center; font-size: 15px; }

.nav-section {
    padding: 16px 20px 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    opacity: 0.5;
    text-transform: uppercase;
}

/* ─── Main Wrapper ─────────────────────────────────────── */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed + .main-wrapper { margin-left: 0; }

/* ─── Top Header ───────────────────────────────────────── */
.top-header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.sidebar-toggle { color: var(--primary); font-size: 18px; border: none; padding: 4px 8px; }
.header-title { flex: 1; font-size: 15px; font-weight: 500; color: var(--primary); }
.header-actions { display: flex; align-items: center; }
.user-info { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.user-info i { font-size: 22px; color: var(--primary); }

/* ─── Main Content ─────────────────────────────────────── */
.main-content {
    flex: 1;
    padding: 24px;
}

/* ─── Footer ───────────────────────────────────────────── */
.app-footer {
    padding: 12px 24px;
    background: white;
    border-top: 1px solid #e0e0e0;
    font-size: 12px;
    color: #888;
    text-align: center;
}

/* ─── Page Header ──────────────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary);
    margin: 0;
}

.page-header p { margin: 4px 0 0; }

/* ─── Stats Grid ───────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: transform 0.2s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-info h3 { margin: 0; font-size: 28px; font-weight: 700; color: var(--text-dark); }
.stat-info p { margin: 4px 0 0; font-size: 13px; color: #888; }

/* ─── Cards ────────────────────────────────────────────── */
.card {
    background: white;
    border-radius: 10px;
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.card-header {
    background: white;
    border-bottom: 1px solid #eee;
    padding: 16px 20px;
    border-radius: 10px 10px 0 0 !important;
}

.card-header h5 { margin: 0; font-size: 16px; color: var(--primary); font-weight: 600; }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; background: #fafafa; border-top: 1px solid #eee; }

/* ─── Tables ───────────────────────────────────────────── */
.table { font-size: 14px; }
.table thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    padding: 12px 16px;
}

.table td { padding: 12px 16px; vertical-align: middle; }

/* ─── Badges ───────────────────────────────────────────── */
.badge { font-weight: 500; font-size: 12px; padding: 4px 10px; }

/* ─── Auth Layout ──────────────────────────────────────── */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.login-container { width: 100%; max-width: 440px; padding: 20px; }

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary);
}

.login-header i { margin-bottom: 12px; }
.login-header h2 { margin: 0; font-size: 28px; font-weight: 700; }
.login-header p { margin: 6px 0 2px; font-size: 14px; color: #666; }
.login-header small { color: #999; font-size: 12px; }

.login-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #eee;
    color: #aaa;
}

/* ─── Forms ────────────────────────────────────────────── */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #ddd;
    padding: 10px 14px;
    font-size: 14px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(46,134,193,0.15);
}

.form-label { font-weight: 500; font-size: 14px; color: #555; margin-bottom: 4px; }

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 500;
}

.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

/* ─── Modals ───────────────────────────────────────────── */
.modal-content { border-radius: 12px; border: none; }
.modal-header { border-bottom: 1px solid #eee; padding: 16px 24px; }
.modal-body { padding: 24px; }
.modal-footer { border-top: 1px solid #eee; padding: 16px 24px; }

/* ─── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { width: 0; overflow: hidden; }
    .sidebar.collapsed { width: var(--sidebar-width); overflow: auto; }
    .main-wrapper { margin-left: 0 !important; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Blazor Error UI ──────────────────────────────────── */
#blazor-error-ui {
    background: #ff4444;
    color: white;
    padding: 10px 20px;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 9999;
    display: none;
}

#blazor-error-ui a { color: white; text-decoration: underline; margin-left: 10px; }
