/* ===========================
   RUBIK PROPERTIES – ADMIN CSS
   =========================== */

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

:root {
    --gold: #c9a84c;
    --gold-light: #e8c96a;
    --dark: #0d0d0d;
    --dark2: #141414;
    --dark3: #1e1e1e;
    --dark4: #2a2a2a;
    --text: #e0e0e0;
    --text-muted: #888;
    --danger: #e05252;
    --info: #4a90d9;
    --success: #4caf7d;
    --sidebar-w: 240px;
    --radius: 10px;
    --font: 'Poppins', sans-serif;
    --font-heading: 'Playfair Display', serif;
}

body {
    font-family: var(--font);
    background: var(--dark2);
    color: var(--text);
}

/* ─── LOGIN PAGE ─────────────────────────────────────── */
.admin-login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d0d0d 0%, #1a1208 50%, #0d0d0d 100%);
}

.login-wrapper {
    width: 100%;
    max-width: 440px;
    padding: 1rem;
}

.login-card {
    background: var(--dark3);
    border: 1px solid rgba(201, 168, 76, 0.2);
    border-radius: 16px;
    padding: 2.8rem 2.4rem;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.login-logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: 2px;
    text-align: center;
    margin-bottom: 1.6rem;
}

.login-logo span {
    color: var(--gold);
}

.login-card h2 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    text-align: center;
    color: var(--gold);
    margin-bottom: 0.3rem;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 2rem;
}

.alert-error {
    background: rgba(224, 82, 82, 0.15);
    border: 1px solid rgba(224, 82, 82, 0.4);
    color: #f99;
    border-radius: var(--radius);
    padding: 0.8rem 1rem;
    font-size: 0.85rem;
    margin-bottom: 1.2rem;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="file"],
.form-group input[type="number"] {
    width: 100%;
    background: var(--dark4);
    border: 1px solid rgba(201, 168, 76, 0.2);
    border-radius: 8px;
    color: var(--text);
    padding: 0.75rem 1rem;
    font-family: var(--font);
    font-size: 0.95rem;
    transition: border-color 0.2s;
    outline: none;
}

.form-group input:focus {
    border-color: var(--gold);
}

.form-group input[type="file"] {
    cursor: pointer;
    padding: 0.6rem 1rem;
}

.login-btn {
    width: 100%;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    color: #0d0d0d;
    font-family: var(--font);
    font-weight: 700;
    font-size: 1rem;
    padding: 0.85rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    letter-spacing: 1px;
    margin-top: 0.4rem;
    transition: opacity 0.2s, transform 0.15s;
}

.login-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.back-link {
    text-align: center;
    margin-top: 1.4rem;
    font-size: 0.85rem;
}

.back-link a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.back-link a:hover {
    color: var(--gold);
}

/* ─── DASHBOARD LAYOUT ───────────────────────────────── */
.admin-body {
    display: flex;
    min-height: 100vh;
}

@media screen and (max-width: 960px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid rgba(201, 168, 76, 0.12);
        padding: 1rem 0;
    }

    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        padding: 0 1rem;
        gap: 0.5rem;
    }

    .nav-item {
        white-space: nowrap;
        padding: 0.5rem 1rem;
    }

    .admin-main {
        margin-left: 0;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem;
    }

    .header-stats {
        flex-wrap: wrap;
    }

    .admin-section {
        padding: 1rem;
    }

    .listings-admin-grid {
        grid-template-columns: 1fr;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: var(--dark);
    border-right: 1px solid rgba(201, 168, 76, 0.12);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    padding: 1.5rem 0;
    z-index: 100;
}

.sidebar-logo {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--text);
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(201, 168, 76, 0.12);
    margin-bottom: 1rem;
}

.sidebar-logo span {
    color: var(--gold);
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0 0.8rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
    cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(201, 168, 76, 0.12);
    color: var(--gold);
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(201, 168, 76, 0.12);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.sidebar-footer strong {
    color: var(--gold);
}

.logout-btn {
    background: rgba(224, 82, 82, 0.15);
    color: #f99;
    border: 1px solid rgba(224, 82, 82, 0.3);
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    text-decoration: none;
    text-align: center;
    font-weight: 600;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: rgba(224, 82, 82, 0.3);
}

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

.admin-header {
    background: var(--dark);
    border-bottom: 1px solid rgba(201, 168, 76, 0.12);
    padding: 1.2rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.admin-header h1 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--gold);
}

.header-stats {
    display: flex;
    gap: 0.8rem;
}

.stat-chip {
    background: var(--dark3);
    border: 1px solid rgba(201, 168, 76, 0.2);
    border-radius: 20px;
    padding: 0.3rem 0.9rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Sections */
.admin-section {
    display: none;
    padding: 2rem;
}

.admin-section.active {
    display: block;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: var(--text);
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.2rem;
}

.gallery-card {
    background: var(--dark3);
    border: 1px solid rgba(201, 168, 76, 0.12);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.gallery-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.gallery-card-body {
    padding: 0.8rem;
}

.gallery-card-body p {
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
    color: var(--text);
}

.gallery-card-body small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.gallery-card-body form {
    margin-top: 0.6rem;
}

/* Table */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid rgba(201, 168, 76, 0.12);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.admin-table thead {
    background: rgba(201, 168, 76, 0.08);
}

.admin-table th {
    padding: 0.9rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--gold);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    white-space: nowrap;
}

.admin-table td {
    padding: 0.85rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.empty-msg {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    color: #0d0d0d;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.88rem;
    transition: opacity 0.2s;
}

.btn-primary:hover {
    opacity: 0.85;
}

.btn-danger {
    background: rgba(224, 82, 82, 0.15);
    color: #f99;
    border: 1px solid rgba(224, 82, 82, 0.3);
    border-radius: 6px;
    padding: 0.3rem 0.7rem;
    cursor: pointer;
    font-size: 0.78rem;
    font-family: var(--font);
    transition: background 0.2s;
}

.btn-danger:hover {
    background: rgba(224, 82, 82, 0.3);
}

.btn-info {
    background: rgba(74, 144, 217, 0.15);
    color: #7db8f5;
    border: 1px solid rgba(74, 144, 217, 0.3);
    border-radius: 6px;
    padding: 0.3rem 0.7rem;
    cursor: pointer;
    font-size: 0.78rem;
    font-family: var(--font);
    transition: background 0.2s;
}

.btn-info:hover {
    background: rgba(74, 144, 217, 0.3);
}

.btn-secondary {
    background: var(--dark4);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.88rem;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: var(--dark3);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(4px);
}

.modal-box {
    background: var(--dark3);
    border: 1px solid rgba(201, 168, 76, 0.2);
    border-radius: 14px;
    padding: 2rem;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6);
}

.modal-box h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--gold);
    margin-bottom: 1.4rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 1.4rem;
}

/* ─── BADGE (pending count) ──────────────────────────── */
.badge {
    background: var(--gold);
    color: #111;
    border-radius: 20px;
    padding: 1px 7px;
    font-size: 0.72rem;
    font-weight: 700;
    margin-left: auto;
}

/* ─── INLINE FORM (add category) ────────────────────── */
.inline-form {
    display: flex;
    gap: 10px;
    margin-bottom: 1.5rem;
    align-items: center;
}

.inline-form input[type="text"] {
    flex: 1;
    background: var(--dark4);
    border: 1px solid rgba(201, 168, 76, 0.2);
    border-radius: 8px;
    color: var(--text);
    padding: 0.7rem 1rem;
    font-family: var(--font);
    font-size: 0.9rem;
    outline: none;
}

.inline-form input[type="text"]:focus {
    border-color: var(--gold);
}

/* ─── CATEGORY LIST ──────────────────────────────────── */
.category-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--dark3);
    border: 1px solid rgba(201, 168, 76, 0.1);
    border-radius: 8px;
    padding: 0.75rem 1.1rem;
}

.cat-name {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text);
}

/* ─── FILTER TABS ────────────────────────────────────── */
.filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 1.5rem;
}

.ftab {
    background: var(--dark3);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 20px;
    color: var(--text-muted);
    padding: 0.4rem 1rem;
    font-size: 0.82rem;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
}

.ftab:hover,
.ftab.active {
    background: rgba(201, 168, 76, 0.12);
    border-color: rgba(201, 168, 76, 0.3);
    color: var(--gold);
}

/* ─── LISTING CARDS GRID ─────────────────────────────── */
.listings-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.2rem;
}

.listing-admin-card {
    background: var(--dark3);
    border: 1px solid rgba(201, 168, 76, 0.1);
    border-radius: var(--radius);
    overflow: hidden;
}

.listing-admin-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    flex-wrap: wrap;
}

.listing-admin-header small {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.listing-cat {
    background: rgba(201, 168, 76, 0.1);
    color: var(--gold);
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Status badges */
.status-badge {
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 0.72rem;
    font-weight: 700;
}

.status-pending {
    background: rgba(245, 200, 66, 0.15);
    color: #f5c842;
}

.status-approved {
    background: rgba(76, 175, 125, 0.15);
    color: #4caf7d;
}

.status-rejected {
    background: rgba(224, 82, 82, 0.15);
    color: #f99;
}

.listing-info {
    padding: 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--text);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.listing-info strong {
    font-size: 0.95rem;
}

.listing-details-text {
    margin-top: 0.3rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.5;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 0.4rem;
}

/* Image strip */
.admin-img-strip {
    display: flex;
    gap: 3px;
    overflow-x: auto;
    padding: 8px;
    background: rgba(0, 0, 0, 0.15);
}

.admin-img-strip img {
    height: 80px;
    width: 80px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.admin-img-strip img:hover {
    transform: scale(1.05);
}

/* Listing action buttons */
.listing-actions {
    display: flex;
    gap: 8px;
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
}

.btn-approve {
    background: rgba(76, 175, 125, 0.15);
    color: #4caf7d;
    border: 1px solid rgba(76, 175, 125, 0.3);
    border-radius: 6px;
    padding: 0.35rem 0.85rem;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: var(--font);
    font-weight: 600;
    transition: background 0.2s;
}

.btn-approve:hover {
    background: rgba(76, 175, 125, 0.3);
}

.btn-reject {
    background: rgba(224, 82, 82, 0.12);
    color: #f5a0a0;
    border: 1px solid rgba(224, 82, 82, 0.25);
    border-radius: 6px;
    padding: 0.35rem 0.85rem;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: var(--font);
    font-weight: 600;
    transition: background 0.2s;
}

.btn-reject:hover {
    background: rgba(224, 82, 82, 0.25);
}

/* Property Code Badge */
.listing-code {
    background: #333;
    color: #ffcc00;
    padding: 2px 10px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.8rem;
    display: inline-block;
}