/* ==========================================================================
   Crystal Clear Property CRM — Custom Styles
   ========================================================================== */

:root {
    --sidebar-bg: #1a1a2e;
    --sidebar-bg-hover: #16213e;
    --sidebar-text: #ffffff;
    --sidebar-text-muted: rgba(255, 255, 255, 0.6);
    --gold: #c9a84c;
    --gold-dark: #b8973f;
    --gold-light: #e0c878;
    --navy: #1a1a2e;
    --navy-light: #16213e;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --card-shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s ease;
}

/* ---- Base ---- */
body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f6fa;
    color: #333;
}

/* ---- Gold accent buttons ---- */
.btn-gold {
    background-color: var(--gold);
    color: #fff;
    border: 1px solid var(--gold);
    font-weight: 500;
    transition: var(--transition);
}

.btn-gold:hover {
    background-color: var(--gold-dark);
    color: #fff;
    border-color: var(--gold-dark);
}

.btn-outline-gold {
    color: var(--gold-dark);
    border: 1px solid var(--gold);
    background-color: transparent;
    transition: var(--transition);
}

.btn-outline-gold:hover {
    background-color: var(--gold);
    color: #fff;
}

.text-gold {
    color: var(--gold-dark) !important;
}

/* ---- Sidebar ---- */
.wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    min-width: 250px;
    height: 100vh;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header a {
    color: #fff;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-header a i {
    color: var(--gold);
    font-size: 1.5rem;
}

.sidebar-brand-text {
    line-height: 1.2;
}

.sidebar-nav {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
    flex-grow: 1;
}

.sidebar-nav li {
    margin: 0;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.5rem;
    color: var(--sidebar-text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-nav li a:hover {
    background-color: var(--sidebar-bg-hover);
    color: #fff;
}

.sidebar-nav li a.active {
    background-color: var(--sidebar-bg-hover);
    color: var(--gold);
    border-left-color: var(--gold);
}

.sidebar-nav li a i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--sidebar-text-muted);
    margin-bottom: 0.5rem;
}

.sidebar-user i {
    font-size: 1.2rem;
    color: var(--gold);
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--sidebar-text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    transition: var(--transition);
}

.sidebar-logout:hover {
    color: #ff6b6b;
}

/* ---- Sidebar Overlay ---- */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
}

.sidebar-overlay.active {
    display: block;
}

/* ---- Main Content ---- */
.main-content {
    width: calc(100% - 250px);
    margin-left: 250px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

/* ---- Topbar ---- */
.topbar {
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    padding: 0.75rem 1.5rem;
    min-height: 60px;
    border-bottom: 1px solid #e8e8e8;
}

.topbar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-left: 0.5rem;
}

.sidebar-toggle {
    padding: 0.25rem 0.5rem;
    text-decoration: none;
}

/* ---- Footer ---- */
.footer {
    background-color: #fff;
    border-top: 1px solid #e8e8e8;
    margin-top: auto;
}

/* ---- Stat Cards ---- */
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    border: none;
}

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

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: #fff;
    flex-shrink: 0;
}

.stat-card-blue .stat-icon { background: linear-gradient(135deg, #4a90d9, #357abd); }
.stat-card-info .stat-icon { background: linear-gradient(135deg, #36d7b7, #2bb4a3); }
.stat-card-success .stat-icon { background: linear-gradient(135deg, #52c41a, #389e0d); }
.stat-card-gold .stat-icon { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); }

.stat-content {
    flex-grow: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: #333;
}

.stat-label {
    font-size: 0.85rem;
    color: #888;
    margin-top: 0.25rem;
}

/* ---- Mini Stats ---- */
.stat-mini {
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: var(--card-shadow);
}

/* ---- Cards ---- */
.card {
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #e8e8e8;
    padding: 1rem 1.25rem;
}

/* ---- Property Cards ---- */
.property-card {
    transition: var(--transition);
    overflow: hidden;
}

.property-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-3px);
}

.property-card-image {
    position: relative;
    height: 200px;
    overflow: hidden;
    background-color: #f0f0f0;
}

.property-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.property-card:hover .property-card-image img {
    transform: scale(1.05);
}

.property-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ccc;
    background: #f8f9fa;
}

.property-no-image i {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.property-no-image-large {
    width: 100%;
    height: 350px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ccc;
    background: #f8f9fa;
    border-radius: 10px 10px 0 0;
}

.property-status-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.75rem;
    padding: 0.4rem 0.75rem;
}

.property-published-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 0.75rem;
    padding: 0.4rem 0.75rem;
}

.property-features .badge {
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
    margin-right: 0.25rem;
}

/* ---- Property Detail ---- */
.property-detail-image {
    max-height: 400px;
    object-fit: cover;
    width: 100%;
}

.feature-box {
    text-align: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.feature-box i {
    font-size: 1.5rem;
    color: var(--gold-dark);
}

.feature-label {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
}

.feature-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
}

.gallery-img {
    transition: var(--transition);
    cursor: pointer;
}

.gallery-img:hover {
    opacity: 0.85;
}

/* ---- Gallery Thumbnails ---- */
.gallery-thumb {
    position: relative;
    display: inline-block;
}

.gallery-thumb-delete {
    position: absolute;
    top: -8px;
    right: -8px;
}

/* ---- Form Section Titles ---- */
.form-section-title {
    color: var(--navy);
    font-weight: 600;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--gold);
    margin-bottom: 1rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 0.2rem rgba(201, 168, 76, 0.15);
}

/* ---- Auth / Login Page ---- */
.auth-body {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
}

.auth-logo {
    color: #fff;
}

.auth-logo i {
    font-size: 3rem;
    color: var(--gold);
}

.auth-logo h2 {
    font-weight: 700;
}

.auth-logo p {
    font-size: 0.9rem;
    opacity: 0.7;
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.auth-icon {
    font-size: 3rem;
    color: var(--gold);
}

/* ---- Tables ---- */
.table > :not(caption) > * > * {
    padding: 0.75rem 1rem;
}

.table-hover > tbody > tr:hover {
    background-color: #f8f9fa;
}

/* ---- Alerts ---- */
.alert {
    border-radius: 8px;
}

/* ---- Responsive ---- */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-content {
        width: 100%;
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block !important;
    }
}

@media (min-width: 992px) {
    .sidebar-toggle {
        display: none;
    }
}

/* ---- Loading Button State ---- */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
}

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

/* ---- Scrollbar styling ---- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ---- nl2br support ---- */
.nl2br {
    white-space: pre-wrap;
}