@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --sidebar-width: 280px;
    --header-height: 80px;

    /* Midnight Indigo Palette */
    --bg-page: #0f1117;
    --bg-sidebar: #161b27;
    --bg-card: #1e2a3a;
    --bg-card-hover: #243244;
    --bg-input: #111827;
    --bg-deep: #0d1120;

    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-dim: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.25);

    --border: rgba(99, 102, 241, 0.15);
    --border-hover: rgba(99, 102, 241, 0.4);
    --border-subtle: rgba(255, 255, 255, 0.06);

    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #4b5563;

    --green: #10b981;
    --red: #ef4444;
    --yellow: #f59e0b;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;

    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── RESET & BASE ─── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.5;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.6);
}

/* ─── LAYOUT ─── */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 10;
}

/* ─── SIDEBAR ─── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
}

.sidebar-header {
    padding: 28px 24px 20px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 16px;
}

.sidebar-header h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin: 0;
    color: #fff;
    background: linear-gradient(135deg, #ffffff 0%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 12px;
    overflow-y: auto;
}

.db-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid transparent;
    cursor: pointer;
}

.db-nav-link i {
    font-size: 17px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.db-nav-link:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--text-primary);
    transform: translateX(3px);
}

.db-nav-link:hover i {
    color: var(--accent-light);
}

.db-nav-link.active {
    background: rgba(99, 102, 241, 0.14);
    border-color: rgba(99, 102, 241, 0.25);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--accent);
}

.db-nav-link.active i {
    color: var(--accent-light);
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border-subtle);
}

.btn-logout {
    color: var(--red) !important;
    justify-content: center;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    transform: none !important;
}

/* ─── MAIN ─── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 36px 44px;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 80% 0%, rgba(99, 102, 241, 0.07) 0%, transparent 50%),
        radial-gradient(ellipse at 0% 100%, rgba(79, 70, 229, 0.05) 0%, transparent 50%);
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 36px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.top-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #0f1117;
    margin: 0;
    letter-spacing: -0.3px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    padding: 9px 20px;
    border-radius: 99px;
    transition: var(--transition);
}

.user-profile:hover {
    border-color: var(--border-hover);
}

.user-profile span {
    font-size: 14px;
    color: var(--text-secondary);
}

.user-profile strong {
    color: #fff;
    font-weight: 600;
}

/* ─── SECTIONS ─── */
.hidden {
    display: none !important;
}

/* ─── STAT CARDS ─── */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 36px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md), 0 0 0 1px rgba(99, 102, 241, 0.1);
}

.stat-card:hover::after {
    opacity: 1;
}

.stat-card h3 {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin: 0 0 10px;
}

.stat-card .value {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1;
}

.stat-card:nth-child(1) .value {
    color: #fff;
}

.stat-card:nth-child(2) .value {
    color: var(--green);
}

.stat-card:nth-child(3) .value {
    color: var(--red);
}

.stat-card:nth-child(4) .value {
    color: var(--yellow);
}

/* ─── FORM PANEL ─── */
.form-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 36px;
    margin-bottom: 36px;
    box-shadow: var(--shadow-sm);
}

.form-panel h2 {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 28px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-panel h2::before {
    content: '';
    display: block;
    width: 4px;
    height: 22px;
    background: var(--accent);
    border-radius: 4px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

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

.form-group label {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.2px;
}

.form-group input,
.form-group select,
.form-group textarea {
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition);
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    background: #0d1120;
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group select option {
    background: var(--bg-deep);
    color: var(--text-primary);
}

.form-group input[type="file"] {
    padding: 10px 16px;
    background: rgba(99, 102, 241, 0.04);
    border: 1px dashed rgba(99, 102, 241, 0.3);
    cursor: pointer;
    color: var(--text-secondary);
}

.form-group input[type="file"]:hover {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.08);
}

.form-actions {
    margin-top: 32px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid var(--border-subtle);
}

/* ─── BUTTONS ─── */
.db-btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 12px 28px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.db-btn-primary:hover {
    background: var(--accent-light);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.55);
}

.db-btn-primary:active {
    transform: translateY(1px);
    box-shadow: none;
}

.db-btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    padding: 12px 28px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.db-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

/* ─── FILTER BAR ─── */
.db-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
    background: var(--bg-card);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.db-filter-bar input,
.db-filter-bar select {
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: var(--transition);
    flex: 1;
    min-width: 130px;
}

.db-filter-bar input:focus,
.db-filter-bar select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.db-filter-bar input::placeholder {
    color: var(--text-muted);
}

.db-filter-bar select option {
    background: var(--bg-deep);
}

/* ─── AD GRID & CARDS ─── */
.db-ads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.db-ad-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.db-ad-card:hover {
    transform: translateY(-6px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md), 0 0 30px rgba(99, 102, 241, 0.1);
}

.db-ad-image {
    position: relative;
    height: 190px;
    overflow: hidden;
    background: var(--bg-deep);
}

.db-ad-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.db-ad-card:hover .db-ad-image img {
    transform: scale(1.06);
}

.db-ad-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 99px;
    color: #fff;
}

.db-ad-badge.available {
    background: rgba(16, 185, 129, 0.9);
}

.db-ad-badge.sold {
    background: rgba(239, 68, 68, 0.9);
}

.db-ad-badge.reserved {
    background: rgba(245, 158, 11, 0.9);
}

.db-photo-count {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 99px;
    display: flex;
    align-items: center;
    gap: 5px;
    backdrop-filter: blur(4px);
}

.db-ad-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0;
}

.db-ad-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.db-ad-id {
    font-size: 11px;
    color: var(--text-muted);
}

.db-ad-category {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--accent-light);
    background: rgba(99, 102, 241, 0.12);
    padding: 3px 10px;
    border-radius: 99px;
}

.db-ad-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 8px;
    line-height: 1.4;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.db-ad-location {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.db-ad-location i {
    color: var(--red);
    font-size: 13px;
}

.db-ad-price-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-subtle);
}

.db-ad-price {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
}

.db-ad-area {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
}

.db-ad-contact {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.db-ad-contact i {
    color: var(--green);
    font-size: 11px;
}

.db-ad-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 14px;
}

.status-select {
    flex: 1;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
}

.status-select:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.action-btn.edit-btn {
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-light);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
}

.action-btn.edit-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.action-btn.delete {
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(239, 68, 68, 0.25);
    background: rgba(239, 68, 68, 0.08);
    color: var(--red);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
}

.action-btn.delete:hover {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
}

/* ─── TABLES ─── */
.table-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 28px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    padding: 14px 18px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.15);
    text-align: left;
}

td {
    padding: 16px 18px;
    color: var(--text-primary);
    font-size: 13px;
    border-bottom: 1px solid var(--border-subtle);
    transition: var(--transition);
}

tbody tr:hover td {
    background: rgba(99, 102, 241, 0.05);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ─── EMPTY / LOADING ─── */
.db-ads-loading,
.db-ads-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 70px 20px;
    color: var(--text-secondary);
    font-size: 15px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px dashed rgba(255, 255, 255, 0.08);
}

.db-ads-loading i,
.db-ads-empty i {
    display: block;
    font-size: 44px;
    margin-bottom: 14px;
    color: rgba(99, 102, 241, 0.25);
}

/* ─── PAGINATION ─── */
#paginationContainer button {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

#paginationContainer button:hover {
    border-color: var(--accent);
    color: var(--accent-light);
}

#paginationContainer button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ─── BELL BADGE ─── */
#bell-badge {
    display: none;
    align-items: center;
    justify-content: center;
}
/* ─── MOBILE MENU & OVERLAY ─── */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    transition: var(--transition);
}

.mobile-menu-btn:hover {
    color: var(--accent-light);
}

.header-title-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 90;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 1024px) {
    .main-content {
        padding: 24px 28px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: var(--transition);
        z-index: 100;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-menu-btn {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 20px;
    }

    .db-filter-bar {
        flex-direction: column;
    }

    .top-header h1 {
        font-size: 22px;
    }

    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stat-cards {
        grid-template-columns: 1fr;
    }
    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .user-profile {
        width: 100%;
        justify-content: space-between;
    }
}