/* ===== CSS Variables ===== */
:root {
    --navy: #0a1628;
    --navy-light: #1a2d4a;
    --gold: #c9a24a;
    --sidebar-w: 260px;
    --topbar-h: 64px;
    --font: "Inter", sans-serif;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.12);
}

/* ===== Reset ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
}
body {
    font-family: var(--font);
    background: #f4f6fa;
    color: #1a1a2e;
    margin: 0;
    font-size: 14px;
}

/* ===== Sidebar ===== */
.admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: #022871;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 1040;
    transition: transform 0.3s ease;
}
.admin-sidebar.collapsed {
    transform: translateX(calc(-1 * var(--sidebar-w)));
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}
.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--gold);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.brand-info {
    line-height: 1.3;
}
.brand-name {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}
.brand-sub {
    display: block;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0 8px;
    overflow-y: auto;
}

.nav-section {
    padding: 4px 0;
}
.nav-label {
    display: block;
    padding: 8px 20px 4px;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 600;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: #fff;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 450;
    transition:
        background 0.15s,
        color 0.15s;
    position: relative;
}
.nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}
.nav-item.active {
    background: rgba(201, 162, 74, 0.15);
    color: var(--gold);
    font-weight: 600;
}
.nav-item.active::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--gold);
    border-radius: 0 3px 3px 0;
}
.nav-item i {
    font-size: 16px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}
.nav-item span {
    flex: 1;
}
.nav-badge {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}
.nav-badge.bg-danger {
    background: #dc3545 !important;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius);
    text-decoration: none;
    transition: background 0.15s;
}
.sidebar-user:hover {
    background: rgba(255, 255, 255, 0.06);
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}
.user-info {
    flex: 1;
    min-width: 0;
}
.user-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-role {
    display: block;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
}

/* ===== Main Area ===== */
.admin-main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}
.admin-main.expanded {
    margin-left: 0;
}

/* ===== Topbar ===== */
.admin-topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid #e5e8ef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}
.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-sidebar-toggle {
    width: 36px;
    height: 36px;
    background: none;
    border: 1px solid #e5e8ef;
    border-radius: var(--radius);
    font-size: 18px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        border-color 0.15s,
        color 0.15s;
}
.btn-sidebar-toggle:hover {
    border-color: var(--navy);
    color: var(--navy);
}
.topbar-btn {
    width: 36px;
    height: 36px;
    background: none;
    border: 1px solid #e5e8ef;
    border-radius: var(--radius);
    font-size: 16px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    position: relative;
    transition:
        border-color 0.15s,
        color 0.15s;
}
.topbar-btn:hover {
    border-color: var(--navy);
    color: var(--navy);
}
.notif-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #dc3545;
    color: #fff;
    font-size: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}
.topbar-avatar {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}
.topbar-avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e5e8ef;
}
.notif-dropdown {
    min-width: 260px;
}

.breadcrumb-item a {
    color: var(--navy);
    text-decoration: none;
}
.breadcrumb-item a:hover {
    color: var(--gold);
}

/* ===== Content ===== */
.admin-content {
    flex: 1;
    padding: 28px 24px;
}
.admin-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e8ef;
    text-align: center;
    color: #999;
    font-size: 12px;
}

/* ===== Page Header ===== */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--navy);
    margin: 0;
}
.page-sub {
    color: #6b7280;
    font-size: 13px;
    margin: 2px 0 0;
}

/* ===== Card Panel ===== */
.card-panel {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
}
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.panel-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--navy);
    margin: 0;
}
.panel-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f3f7;
}

/* ===== Stat Cards ===== */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow);
}
.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.bg-primary-soft {
    background: rgba(13, 110, 253, 0.1);
}
.bg-success-soft {
    background: rgba(25, 135, 84, 0.1);
}
.bg-warning-soft {
    background: rgba(255, 193, 7, 0.12);
}
.bg-danger-soft {
    background: rgba(220, 53, 69, 0.1);
}
.bg-info-soft {
    background: rgba(13, 202, 240, 0.1);
}
.bg-gold-soft {
    background: rgba(201, 162, 74, 0.12);
}
.text-gold {
    color: var(--gold);
}
.stat-body {
    min-width: 0;
}
.stat-num {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.2;
}
.stat-label {
    display: block;
    font-size: 11px;
    color: #6b7280;
    white-space: nowrap;
}

/* Mini stats --*/
.mini-stat {
    padding: 12px 8px;
    border-radius: 8px;
    background: #f8f9fc;
}
.mini-stat i {
    display: block;
    font-size: 18px;
    margin-bottom: 4px;
}
.mini-num {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--navy);
}
.mini-label {
    display: block;
    font-size: 11px;
    color: #6b7280;
}

/* ===== Table ===== */
.table thead th {
    background: #f8f9fc;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    border-bottom-width: 1px;
    white-space: nowrap;
}
.table-thumb {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
}
.table-thumb-sm {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
}
.btn-xs {
    padding: 3px 7px;
    font-size: 12px;
    line-height: 1.4;
}

/* ===== Badges ===== */
.badge-status,
.badge-purpose {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: none;
    line-height: 1.5;
}
.badge-status.active,
.badge-purpose.sale {
    background: #d1fae5;
    color: #065f46;
}
.badge-status.pending {
    background: #fef3c7;
    color: #92400e;
}
.badge-status.sold,
.badge-purpose.rent {
    background: #fee2e2;
    color: #991b1b;
}
.badge-status.rented {
    background: #dbeafe;
    color: #1e40af;
}
.badge-status.inactive {
    background: #f3f4f6;
    color: #4b5563;
}
.badge-purpose.lease {
    background: #ede9fe;
    color: #5b21b6;
}
.badge-purpose.investment {
    background: rgba(201, 162, 74, 0.15);
    color: #92660a;
}

/* ===== Sort link ===== */
.sort-link {
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}
.sort-link:hover,
.sort-link.active {
    color: var(--navy);
}

/* ===== Toggle buttons ===== */
.btn-toggle-featured {
    background: none;
    border: none;
    color: #d1d5db;
    font-size: 18px;
    padding: 0;
    cursor: pointer;
    transition: color 0.15s;
}
.btn-toggle-featured.on {
    color: var(--gold);
}

/* ===== Contact rows ===== */
.contact-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f3f7;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s;
}
.contact-row:last-child {
    border-bottom: none;
}
.contact-row:hover {
    background: #f8f9fc;
}
.contact-row.unread .contact-name {
    font-weight: 700;
}
.contact-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--navy);
    color: var(--gold);
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.contact-info {
    flex: 1;
    min-width: 0;
}
.contact-name {
    display: block;
    font-size: 13px;
}
.contact-msg {
    display: block;
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.contact-time {
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
}

/* ===== Upload Zones ===== */
.upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    transition: border-color 0.15s;
    cursor: pointer;
}
.upload-zone:hover {
    border-color: var(--navy);
}
.upload-label {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #6b7280;
}
.upload-label span {
    font-weight: 500;
    color: var(--navy);
}

.upload-zone-sm {
    text-align: center;
}
.upload-label-sm {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid #d1d5db;
    border-radius: var(--radius);
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: border-color 0.15s;
}
.upload-label-sm:hover {
    border-color: var(--navy);
}

.btn-img-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(220, 53, 69, 0.85);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
}

/* ===== Feature card ===== */
.feature-item-card {
    background: #f8f9fc;
    border-radius: var(--radius);
    padding: 10px 12px;
}
.cat-icon-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--navy);
    color: var(--gold);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Feature tag ===== */
.feature-tag {
    font-size: 13px;
    color: #374151;
}

/* ===== Media cards ===== */
.media-card {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid #e5e8ef;
    background: #fff;
    position: relative;
}
.media-card:hover .media-actions {
    opacity: 1;
}
.media-thumb {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
}
.media-icon-placeholder {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    color: #6b7280;
}
.media-info {
    padding: 6px 8px;
}
.media-name {
    max-width: 100%;
    font-size: 11px;
}
.media-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

/* ===== Auth page ===== */
.auth-page {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.auth-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 16px;
}
.auth-card {
    background: #fff;
    border-radius: 16px;
    padding: 36px 32px;
    box-shadow: var(--shadow-md);
}
.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    margin-bottom: 28px;
}
.auth-brand .brand-mark {
    background: var(--navy);
    color: var(--gold);
}
.auth-brand .brand-name {
    color: var(--navy);
    font-size: 18px;
    font-weight: 700;
}
.auth-brand .brand-sub {
    color: #6b7280;
    font-size: 12px;
}
.auth-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--navy);
    text-align: center;
    margin-bottom: 4px;
}
.auth-sub {
    text-align: center;
    color: #6b7280;
    margin-bottom: 24px;
    font-size: 13px;
}
.auth-footer {
    color: rgba(255, 255, 255, 0.45);
    font-size: 12px;
    text-align: center;
    margin-top: 20px;
}

.input-with-icon {
    position: relative;
}
.input-with-icon i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 14px;
}
.input-with-icon .form-control {
    padding-left: 36px;
}
.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 14px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(calc(-1 * var(--sidebar-w)));
    }
    .admin-sidebar.open {
        transform: translateX(0);
    }
    .admin-main {
        margin-left: 0;
    }
    .admin-content {
        padding: 16px;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ===== Select2 overrides ===== */
.select2-container--bootstrap-5 .select2-selection {
    min-height: 38px;
    font-size: 14px;
}

/* ===== Prose (page/blog content display) ===== */
.prose {
    line-height: 1.7;
    color: #374151;
}
.prose p {
    margin-bottom: 12px;
}
.prose h2,
.prose h3 {
    font-weight: 700;
    color: var(--navy);
    margin: 20px 0 8px;
}

/* ===== Thin Sidebar Scrollbar ===== */

/* Firefox */
.admin-sidebar,
.sidebar-nav {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

/* Chrome, Edge, Safari */
.admin-sidebar::-webkit-scrollbar,
.sidebar-nav::-webkit-scrollbar {
    width: 4px; /* Change to 3px or 2px for thinner */
}

.admin-sidebar::-webkit-scrollbar-track,
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.admin-sidebar::-webkit-scrollbar-thumb,
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 10px;
}

.admin-sidebar::-webkit-scrollbar-thumb:hover,
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.45);
}

/* ========================================
   MODERN PROPERTY STAT CARDS
======================================== */

.modern-stat-card {
    position: relative;
    background: #ffffff;
    border: 1px solid #eef1f6;
    border-radius: 16px;
    padding: 18px;
    min-height: 145px;
    overflow: hidden;
    box-shadow:
        0 2px 6px rgba(15, 23, 42, 0.04),
        0 10px 30px rgba(15, 23, 42, 0.05);
    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease,
        border-color 0.25s ease;
}

.modern-stat-card:hover {
    transform: translateY(-5px);
    border-color: #e2e7ef;
    box-shadow:
        0 8px 18px rgba(15, 23, 42, 0.07),
        0 18px 40px rgba(15, 23, 42, 0.08);
}

/* Top */
.stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

/* Main icon */
.modern-stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: transform 0.25s ease;
}

.modern-stat-card:hover .modern-stat-icon {
    transform: scale(1.08) rotate(-3deg);
}

/* Icon colors */
.modern-stat-icon.primary {
    color: #0d6efd;
    background: linear-gradient(
        135deg,
        rgba(13, 110, 253, 0.14),
        rgba(13, 110, 253, 0.05)
    );
}

.modern-stat-icon.success {
    color: #198754;
    background: linear-gradient(
        135deg,
        rgba(25, 135, 84, 0.14),
        rgba(25, 135, 84, 0.05)
    );
}

.modern-stat-icon.warning {
    color: #f59e0b;
    background: linear-gradient(
        135deg,
        rgba(245, 158, 11, 0.16),
        rgba(245, 158, 11, 0.05)
    );
}

.modern-stat-icon.danger {
    color: #dc3545;
    background: linear-gradient(
        135deg,
        rgba(220, 53, 69, 0.14),
        rgba(220, 53, 69, 0.05)
    );
}

.modern-stat-icon.info {
    color: #0891b2;
    background: linear-gradient(
        135deg,
        rgba(8, 145, 178, 0.14),
        rgba(8, 145, 178, 0.05)
    );
}

.modern-stat-icon.gold {
    color: var(--gold);
    background: linear-gradient(
        135deg,
        rgba(201, 162, 74, 0.18),
        rgba(201, 162, 74, 0.05)
    );
}

/* Small top-right indicator */
.stat-trend {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.stat-trend.primary {
    color: #0d6efd;
    background: rgba(13, 110, 253, 0.08);
}

.stat-trend.success {
    color: #198754;
    background: rgba(25, 135, 84, 0.08);
}

.stat-trend.warning {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.stat-trend.danger {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.08);
}

.stat-trend.info {
    color: #0891b2;
    background: rgba(8, 145, 178, 0.08);
}

.stat-trend.gold {
    color: var(--gold);
    background: rgba(201, 162, 74, 0.1);
}

/* Number */
.modern-stat-num {
    display: block;
    color: #0f172a;
    font-size: 25px;
    font-weight: 750;
    line-height: 1;
    letter-spacing: -0.5px;
    margin-bottom: 7px;
}

/* Label */
.modern-stat-label {
    display: block;
    color: #64748b;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.3;
}

/* Bottom accent */
.stat-accent {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 3px;
    opacity: 0.85;
}

.stat-accent.primary {
    background: #0d6efd;
}

.stat-accent.success {
    background: #198754;
}

.stat-accent.warning {
    background: #f59e0b;
}

.stat-accent.danger {
    background: #dc3545;
}

.stat-accent.info {
    background: #0891b2;
}

.stat-accent.gold {
    background: var(--gold);
}

/* Mobile */
@media (max-width: 576px) {
    .modern-stat-card {
        padding: 15px;
        min-height: 135px;
    }

    .modern-stat-icon {
        width: 40px;
        height: 40px;
        font-size: 17px;
    }

    .modern-stat-num {
        font-size: 22px;
    }

    .modern-stat-label {
        font-size: 10px;
    }
}
