/* ============================================================
   PROPMANAGER PRO — MAIN STYLESHEET
   Aesthetic: Refined & Professional — Deep Navy / Warm Amber
   ============================================================ */

:root {
    --navy: #0f1e3a;
    --navy-mid: #162848;
    --navy-light: #1e3561;
    --amber: #c8923a;
    --amber-light: #e5a84d;
    --amber-pale: #fdf3e3;
    --slate: #64748b;
    --slate-light: #94a3b8;
    --bg: #f5f7fa;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #1a2332;
    --text-muted: #64748b;
    --success: #0d9e6e;
    --success-bg: #ecfdf5;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --info: #0369a1;
    --info-bg: #f0f9ff;
    --primary: #2563eb;
    --primary-bg: #eff6ff;
    --sidebar-w: 270px;
    --topbar-h: 64px;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.05);
    --shadow-md: 0 4px 16px rgba(0,0,0,.10), 0 1px 4px rgba(0,0,0,.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--navy);
    position: fixed;
    left: 0; top: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: transform .3s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}

.brand-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--amber), var(--amber-light));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; }
.brand-name { font-family: 'DM Serif Display', serif; color: #fff; font-size: 16px; font-weight: 400; }
.brand-tagline { color: rgba(255,255,255,.4); font-size: 10px; text-transform: uppercase; letter-spacing: 1px; margin-top: 1px; }

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.nav-section-label {
    color: rgba(255,255,255,.3);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 16px 10px 6px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,.65);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 400;
    transition: all .2s;
    margin-bottom: 2px;
    position: relative;
}

.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }

.nav-item.active {
    background: linear-gradient(135deg, var(--amber) 0%, var(--amber-light) 100%);
    color: #fff;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(200,146,58,.35);
}

.nav-icon { width: 18px; text-align: center; font-size: 14px; flex-shrink: 0; }

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    min-width: 20px;
    text-align: center;
}
.nav-badge.warning { background: var(--warning); }
.nav-badge.alert { background: var(--danger); animation: pulse 2s infinite; }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.6} }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,.07);
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--amber), var(--amber-light));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 12px; font-weight: 700;
    flex-shrink: 0;
}

.user-details { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.user-name { color: #fff; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: rgba(255,255,255,.4); font-size: 11px; }

.logout-btn {
    color: rgba(255,255,255,.4);
    text-decoration: none;
    font-size: 15px;
    padding: 6px;
    border-radius: 6px;
    transition: all .2s;
}
.logout-btn:hover { color: var(--danger); background: rgba(220,38,38,.15); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar h1 {
    font-family: 'DM Serif Display', serif;
    font-size: 20px;
    font-weight: 400;
    color: var(--navy);
}

.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--slate);
    padding: 6px;
    border-radius: 6px;
    display: none;
}

.topbar-title { flex: 1; }

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.notif-btn {
    position: relative;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
    border-radius: 50%;
    cursor: pointer;
    font-size: 15px;
    color: var(--slate);
    transition: all .2s;
}
.notif-btn:hover { background: var(--border); color: var(--navy); }
.notif-dot {
    position: absolute;
    top: 0; right: 0;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    width: 16px; height: 16px;
    font-size: 9px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
}

.topbar-date {
    color: var(--slate);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.page-body { padding: 28px; flex: 1; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-family: 'DM Serif Display', serif;
    font-size: 16px;
    font-weight: 400;
    color: var(--navy);
}

.card-body { padding: 24px; }

/* ============================================================
   STAT CARDS (Dashboard)
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}

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

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}
.stat-card.navy::before { background: linear-gradient(90deg, var(--navy), var(--navy-light)); }
.stat-card.amber::before { background: linear-gradient(90deg, var(--amber), var(--amber-light)); }
.stat-card.success::before { background: linear-gradient(90deg, var(--success), #34d399); }
.stat-card.danger::before { background: linear-gradient(90deg, var(--danger), #f87171); }
.stat-card.warning::before { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.stat-card.info::before { background: linear-gradient(90deg, var(--info), #38bdf8); }

.stat-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    margin-bottom: 14px;
}
.stat-card.navy .stat-icon { background: rgba(15,30,58,.08); color: var(--navy); }
.stat-card.amber .stat-icon { background: var(--amber-pale); color: var(--amber); }
.stat-card.success .stat-icon { background: var(--success-bg); color: var(--success); }
.stat-card.danger .stat-icon { background: var(--danger-bg); color: var(--danger); }
.stat-card.warning .stat-icon { background: var(--warning-bg); color: var(--warning); }
.stat-card.info .stat-icon { background: var(--info-bg); color: var(--info); }

.stat-value {
    font-family: 'DM Serif Display', serif;
    font-size: 28px;
    font-weight: 400;
    color: var(--navy);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label { color: var(--text-muted); font-size: 12px; font-weight: 500; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--slate);
    font-weight: 600;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background .15s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(200,146,58,.04); }

tbody td {
    padding: 12px 16px;
    color: var(--text);
    vertical-align: middle;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .3px;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-primary { background: var(--primary-bg); color: var(--primary); }
.badge-secondary { background: var(--bg); color: var(--slate); border: 1px solid var(--border); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    transition: all .2s;
    white-space: nowrap;
}

.btn-primary { background: var(--navy); color: white; }
.btn-primary:hover { background: var(--navy-light); box-shadow: 0 4px 12px rgba(15,30,58,.25); }

.btn-amber { background: linear-gradient(135deg, var(--amber), var(--amber-light)); color: white; }
.btn-amber:hover { box-shadow: 0 4px 12px rgba(200,146,58,.4); transform: translateY(-1px); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { opacity: .9; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: .9; }

.btn-outline { background: transparent; color: var(--navy); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--navy); background: var(--bg); }

.btn-ghost { background: transparent; color: var(--slate); }
.btn-ghost:hover { background: var(--bg); color: var(--navy); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

.btn-icon { padding: 8px; border-radius: 8px; width: 34px; height: 34px; justify-content: center; }

/* ============================================================
   FORMS
   ============================================================ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.form-full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

label {
    font-size: 12px;
    font-weight: 600;
    color: var(--slate);
    text-transform: uppercase;
    letter-spacing: .5px;
}

input, select, textarea {
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    transition: border-color .2s, box-shadow .2s;
    outline: none;
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--amber);
    box-shadow: 0 0 0 3px rgba(200,146,58,.12);
}

input:disabled, select:disabled { background: var(--bg); cursor: not-allowed; }
textarea { resize: vertical; min-height: 90px; }

.input-with-icon { position: relative; }
.input-with-icon i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--slate); font-size: 14px; }
.input-with-icon input { padding-left: 38px; }

.form-hint { font-size: 11px; color: var(--slate-light); }
.form-error { font-size: 11px; color: var(--danger); }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    margin-bottom: 16px;
}
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(13,158,110,.2); }
.alert-error, .alert-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(220,38,38,.2); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(217,119,6,.2); }
.alert-info { background: var(--info-bg); color: var(--info); border: 1px solid rgba(3,105,161,.2); }

/* ============================================================
   BREADCRUMB
   ============================================================ */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 13px;
}
.bc-link { color: var(--amber); text-decoration: none; }
.bc-link:hover { text-decoration: underline; }
.bc-sep { color: var(--border); font-size: 10px; }
.bc-active { color: var(--slate); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,30,58,.5);
    backdrop-filter: blur(4px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px) scale(.97);
    transition: transform .25s;
}
.modal-overlay.active .modal { transform: translateY(0) scale(1); }
.modal-lg { max-width: 860px; }
.modal-xl { max-width: 1100px; }

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-title { font-family: 'DM Serif Display', serif; font-size: 18px; color: var(--navy); }
.modal-close { background: none; border: none; cursor: pointer; font-size: 18px; color: var(--slate); padding: 4px 8px; border-radius: 6px; }
.modal-close:hover { background: var(--bg); color: var(--navy); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ============================================================
   FILTERS BAR
   ============================================================ */
.filters-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.search-box { position: relative; flex: 1; min-width: 200px; }
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--slate); }
.search-box input { padding-left: 36px; }

/* ============================================================
   PROGRESS / OCCUPANCY BAR
   ============================================================ */
.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 20px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 20px;
    background: linear-gradient(90deg, var(--amber), var(--amber-light));
    transition: width .5s ease;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
#toast-container {
    position: fixed;
    bottom: 24px; right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    border-left: 4px solid var(--success);
    animation: slideIn .3s ease;
}
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    min-height: 100vh;
    background: var(--navy);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 30% 50%, rgba(200,146,58,.12) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 20%, rgba(30,53,97,.6) 0%, transparent 50%);
}

.login-card {
    background: var(--surface);
    border-radius: 20px;
    padding: 48px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 80px rgba(0,0,0,.4);
    position: relative;
    z-index: 1;
}

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

.login-logo .logo-icon {
    width: 60px; height: 60px;
    background: linear-gradient(135deg, var(--amber), var(--amber-light));
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; color: white;
    margin: 0 auto 14px;
}

.login-logo h1 {
    font-family: 'DM Serif Display', serif;
    font-size: 22px;
    color: var(--navy);
}

.login-logo p { color: var(--slate); font-size: 13px; margin-top: 4px; }

/* ============================================================
   UTILS
   ============================================================ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-serif { font-family: 'DM Serif Display', serif; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .sidebar-toggle { display: flex; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid-3 { grid-template-columns: 1fr; }
    .page-body { padding: 16px; }
    .login-card { padding: 32px 24px; }
}
