/* ============================================================
   Shepherwing Property Management System — Stylesheet
   ============================================================ */

:root {
    --primary:        #1B4332;
    --primary-light:  #2D6A4F;
    --primary-pale:   #D8F3DC;
    --accent:         #C9A84C;
    --accent-light:   #F5E6B8;
    --danger:         #C0392B;
    --danger-light:   #FDECEA;
    --warning:        #D68910;
    --warning-light:  #FEF9E7;
    --info:           #1A5276;
    --info-light:     #D6EAF8;
    --success:        #1E8449;
    --success-light:  #D5F5E3;
    --bg:             #F7F8FA;
    --card-bg:        #FFFFFF;
    --sidebar-bg:     #0D2818;
    --sidebar-text:   #B7CEBC;
    --sidebar-active: #2D6A4F;
    --border:         #E4E7EC;
    --text-primary:   #1A2332;
    --text-secondary: #6B7280;
    --text-muted:     #9CA3AF;
    --sidebar-w:      260px;
    --topbar-h:       60px;
    --radius:         10px;
    --shadow:         0 2px 12px rgba(0,0,0,0.07);
    --shadow-md:      0 4px 24px rgba(0,0,0,0.10);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    font-size: 14px;
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon { font-size: 28px; }

.brand-name {
    font-family: 'Playfair Display', serif;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.brand-sub {
    font-size: 10px;
    color: var(--accent);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

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

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.3);
    padding: 14px 20px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.2s;
    border-radius: 0;
    margin: 1px 8px;
    border-radius: 8px;
}

.nav-item i { width: 18px; text-align: center; font-size: 14px; }

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

.nav-item.active {
    background: var(--sidebar-active);
    color: #fff;
}

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

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    text-decoration: none;
    padding: 6px 8px;
    border-radius: 8px;
    transition: background 0.2s;
}
.user-info:hover { background: rgba(255,255,255,0.07); }

.user-avatar {
    width: 32px; height: 32px;
    background: var(--accent);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; color: #fff;
    flex-shrink: 0;
}

.user-name {
    font-size: 13px; font-weight: 600;
    color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px;
}
.user-role { font-size: 11px; color: var(--sidebar-text); text-transform: capitalize; }

.logout-btn {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    color: var(--sidebar-text);
    border-radius: 8px;
    transition: all 0.2s;
    text-decoration: none;
}
.logout-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }

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

.topbar {
    height: var(--topbar-h);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.sidebar-toggle {
    background: none; border: none;
    font-size: 18px; cursor: pointer;
    color: var(--text-secondary);
    display: none;
    padding: 4px;
}

.topbar-title {
    font-weight: 600;
    font-size: 16px;
    flex: 1;
    color: var(--text-primary);
}

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

.content-area { padding: 24px; flex: 1; }

/* ---- Cards ---- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body { padding: 20px; }

/* ---- Stat Cards ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon.green   { background: var(--success-light); color: var(--success); }
.stat-icon.gold    { background: var(--accent-light);  color: var(--warning); }
.stat-icon.red     { background: var(--danger-light);  color: var(--danger);  }
.stat-icon.blue    { background: var(--info-light);    color: var(--info);    }
.stat-icon.primary { background: var(--primary-pale);  color: var(--primary); }

.stat-content { flex: 1; min-width: 0; }
.stat-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.stat-change { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

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

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

th {
    background: var(--bg);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

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

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }

.btn-primary    { background: var(--primary); color: #fff; }
.btn-primary:hover    { background: var(--primary-light); }
.btn-success    { background: var(--success); color: #fff; }
.btn-success:hover    { background: #1a7a3f; }
.btn-danger     { background: var(--danger);  color: #fff; }
.btn-danger:hover     { background: #a93226; }
.btn-warning    { background: var(--warning); color: #fff; }
.btn-info       { background: var(--info);    color: #fff; }
.btn-accent     { background: var(--accent);  color: #fff; }
.btn-outline    { background: transparent; border: 1.5px solid var(--border); color: var(--text-primary); }
.btn-outline:hover { background: var(--bg); }

/* ---- Badges ---- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-success   { background: var(--success-light); color: var(--success); }
.badge-danger    { background: var(--danger-light);  color: var(--danger);  }
.badge-warning   { background: var(--warning-light); color: var(--warning); }
.badge-primary   { background: var(--primary-pale);  color: var(--primary); }
.badge-info      { background: var(--info-light);    color: var(--info);    }
.badge-secondary { background: #F3F4F6; color: var(--text-secondary); }

/* ---- Forms ---- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text-primary); }
.required::after { content: ' *'; color: var(--danger); }

.form-control {
    width: 100%;
    padding: 9px 13px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text-primary);
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(45,106,79,0.12);
}

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ---- Grid ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* ---- Alerts ---- */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    margin-bottom: 16px;
}

.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #A9DFBF; }
.alert-danger  { background: var(--danger-light);  color: var(--danger);  border: 1px solid #F5B7B1; }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #FAD7A0; }
.alert-info    { background: var(--info-light);    color: var(--info);    border: 1px solid #AED6F1; }
.alert-dismissible { padding-right: 40px; }
.alert-close { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; font-size: 18px; cursor: pointer; color: inherit; opacity: 0.6; }

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

.page-header-left h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.breadcrumb { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ---- Filter bar ---- */
.filter-bar {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.filter-bar .form-control { width: auto; min-width: 140px; }
.filter-bar .search-input { min-width: 220px; }

/* ---- Progress bar ---- */
.progress {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.progress-bar {
    height: 100%;
    border-radius: 3px;
    background: var(--primary-light);
    transition: width 0.4s;
}

.progress-bar.danger  { background: var(--danger); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.success { background: var(--success); }

/* ---- Modal ---- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    display: none;
}
.modal-overlay.open { display: flex; }

.modal {
    background: #fff;
    border-radius: 12px;
    max-width: 580px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

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

.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ---- Login page ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    background: var(--bg);
}

.login-left {
    flex: 1;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    position: relative;
    overflow: hidden;
}

.login-left::before {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    border-radius: 50%;
    background: rgba(201,168,76,0.08);
    top: -100px; right: -100px;
}

.login-left::after {
    content: '';
    position: absolute;
    width: 300px; height: 300px;
    border-radius: 50%;
    background: rgba(45,106,79,0.3);
    bottom: -80px; left: -80px;
}

.login-logo { font-size: 60px; margin-bottom: 20px; position: relative; z-index: 1; }
.login-brand { font-family: 'Playfair Display', serif; font-size: 36px; color: #fff; font-weight: 700; position: relative; z-index: 1; }
.login-tagline { color: var(--accent); font-size: 14px; margin-top: 6px; letter-spacing: 0.05em; position: relative; z-index: 1; }

.login-right {
    width: 440px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 50px;
    background: #fff;
}

.login-form-box { width: 100%; }
.login-form-box h2 { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.login-form-box p { color: var(--text-secondary); margin-bottom: 28px; }

/* ---- Misc ---- */
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-success{ color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning{ color: var(--warning); }
.fw-600      { font-weight: 600; }
.fw-700      { font-weight: 700; }
.mb-0        { margin-bottom: 0; }
.mb-16       { margin-bottom: 16px; }
.mb-20       { margin-bottom: 20px; }
.mb-24       { margin-bottom: 24px; }
.mt-16       { margin-top: 16px; }
.gap-8       { gap: 8px; }
.d-flex      { display: flex; }
.align-center{ align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap   { flex-wrap: wrap; }
.font-mono   { font-family: monospace; }

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.empty-state i { font-size: 40px; opacity: 0.3; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

.detail-row { display: flex; padding: 10px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.detail-row:last-child { border-bottom: none; }
.detail-label { width: 180px; font-size: 12.5px; color: var(--text-muted); flex-shrink: 0; }
.detail-value { font-size: 13.5px; font-weight: 500; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: block; }
    .main-content { margin-left: 0; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .login-left { display: none; }
    .login-right { width: 100%; }
}
