:root {
    --primary: #1a56db;
    --sidebar-bg: #111827;
    --sidebar-text: #d1d5db;
    --border: #e5e7eb;
}

* { box-sizing: border-box; }

body { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; background: #f3f4f6; }

/* Admin shell */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 260px; background: var(--sidebar-bg); color: var(--sidebar-text);
    display: flex; flex-direction: column; flex-shrink: 0;
}
.sidebar-brand { padding: 1.25rem; border-bottom: 1px solid #374151; }
.sidebar-brand h2 { margin: 0; color: #fff; font-size: 1.1rem; }
.sidebar-nav { padding: 0.75rem; overflow-y: auto; flex: 1; }
.sidebar-nav a {
    display: block; padding: 0.5rem 0.75rem; color: var(--sidebar-text);
    text-decoration: none; border-radius: 6px; font-size: 0.9rem; margin-bottom: 2px;
}
.sidebar-nav a:hover { background: #1f2937; color: #fff; }
.sidebar-nav a.active { background: var(--primary); color: #fff; }
.nav-group {
    font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em;
    color: #6b7280; padding: 0.75rem 0.75rem 0.25rem; margin-top: 0.5rem;
}
.admin-main { flex: 1; display: flex; flex-direction: column; }
.admin-header { background: #fff; border-bottom: 1px solid var(--border); padding: 1rem 1.5rem; }
.admin-header h1 { margin: 0; font-size: 1.25rem; }
.admin-content { padding: 1.5rem; flex: 1; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.35rem; font-size: 0.9rem; }
.form-input { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.95rem; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }
.form-message { margin-top: 1rem; color: var(--primary); }
.social-card {
    background: #fff; border: 1px solid var(--border); border-radius: 10px;
    padding: 1.25rem 1.5rem; margin: 1rem 0 1.5rem;
}
.social-card h4 { margin: 0 0 .5rem; }
.social-card p { color: #4b5563; line-height: 1.55; }

/* Buttons */
.btn { padding: 0.5rem 1rem; border-radius: 6px; border: none; cursor: pointer; font-size: 0.9rem; text-decoration: none; display: inline-block; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: #e5e7eb; color: #374151; }
.page-toolbar { display: flex; gap: 1rem; margin-bottom: 1rem; align-items: center; }

/* Table */
.data-table { width: 100%; background: #fff; border-collapse: collapse; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.data-table th, .data-table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { background: #f9fafb; font-size: 0.8rem; text-transform: uppercase; color: #6b7280; }
.table-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; }
.actions { display: flex; gap: 0.5rem; }
.actions a, .actions button { font-size: 0.85rem; background: none; border: none; color: var(--primary); cursor: pointer; }

/* Image upload */
.image-upload {
    display: block; position: relative; width: 200px; height: 150px;
    border: 2px dashed var(--border); border-radius: 8px; cursor: pointer; overflow: hidden;
    background: #f9fafb;
}
.image-upload-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.image-upload-preview { width: 100%; height: 100%; object-fit: cover; }
.image-upload-placeholder {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; color: #6b7280; font-size: 0.85rem; text-align: center; padding: 0.5rem;
}
.upload-icon { font-size: 2rem; }
.image-upload-overlay {
    position: absolute; inset: 0; background: rgba(0,0,0,.5); color: #fff;
    display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .2s;
}
.image-upload:hover .image-upload-overlay { opacity: 1; }
.image-upload-loading {
    position: absolute; inset: 0; background: rgba(255,255,255,.8);
    display: flex; align-items: center; justify-content: center; font-size: 0.85rem;
}

/* Gallery */
.gallery-grid { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.gallery-item { position: relative; width: 120px; height: 90px; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.btn-remove {
    position: absolute; top: -6px; right: -6px; width: 22px; height: 22px;
    border-radius: 50%; background: #ef4444; color: #fff; border: none; cursor: pointer;
}
.gallery-add {
    width: 120px; height: 90px; border: 2px dashed var(--border); border-radius: 6px;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    font-size: 0.8rem; color: #6b7280; position: relative;
}
.gallery-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Dashboard */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin: 1rem 0; }
.stat-card { background: #fff; padding: 1.25rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.stat-num { display: block; font-size: 1.75rem; font-weight: 700; color: var(--primary); }
.stat-card.highlight { border: 2px solid var(--primary); }
.total-revenue { margin-left: auto; font-size: 1rem; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; margin-top: 1rem; }
.media-card { background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.media-thumb { width: 100%; height: 120px; object-fit: cover; display: block; }
.media-file { display: flex; align-items: center; justify-content: center; background: #f3f4f6; height: 120px; }
.media-info { padding: 0.5rem; display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.75rem; }

/* Chat panel */
.chat-panel { background: #fff; border-radius: 8px; padding: 1rem; margin-top: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.chat-messages { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.5rem; margin: 0.75rem 0; padding: 0.5rem; background: #f9fafb; border-radius: 6px; }
.chat-bubble { max-width: 80%; padding: 0.5rem 0.75rem; border-radius: 8px; }
.chat-bubble.mine { align-self: flex-end; background: #dbeafe; }
.chat-bubble.theirs { align-self: flex-start; background: #fff; border: 1px solid #e5e7eb; }
.chat-bubble p { margin: 0.25rem 0; }
.chat-bubble small { color: #6b7280; font-size: 0.7rem; }
.chat-compose { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.chat-compose .form-input { flex: 1; min-width: 120px; }

/* Auth & user portal */
.auth-card { max-width: 420px; margin: 2rem auto; background: #fff; padding: 2rem; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.form-message.error { color: #dc2626; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1rem 0; align-items: center; }
.book-form { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.user-main { max-width: 900px; }

.text-muted { color: #6b7280; }
.d-none { display: none; }
.module-placeholder { background: #fff; padding: 2rem; border-radius: 8px; }
.badge { background: #fef3c7; color: #92400e; padding: 0.25rem 0.75rem; border-radius: 999px; font-size: 0.8rem; }
.alert { padding: 0.75rem 1rem; border-radius: 6px; margin: 1rem 0; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; }
.quick-actions { margin-top: 1.5rem; display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.view-san-link { display: block; font-size: 0.75rem; color: #93c5fd; margin-top: 0.25rem; }

/* Public sàn */
.public-header { background: #1a56db; color: #fff; padding: 0.75rem 1.5rem; }
.public-header-inner { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
.public-logo { color: #fff; font-weight: 700; font-size: 1.2rem; text-decoration: none; }
.public-nav a { color: #dbeafe; margin-left: 1.25rem; text-decoration: none; }
.public-nav a.active { color: #fff; font-weight: 600; }
.admin-link { background: rgba(255,255,255,.15); padding: 0.25rem 0.75rem; border-radius: 4px; }
.public-main { max-width: 1200px; margin: 0 auto; padding: 1.5rem; min-height: 70vh; }
.public-footer { text-align: center; padding: 1.5rem; color: #6b7280; border-top: 1px solid #e5e7eb; }
.hero { text-align: center; padding: 2rem 0; }
.hero h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.search-bar { display: flex; gap: 0.5rem; max-width: 600px; margin: 1rem auto; }
.property-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
.property-card { background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.1); text-decoration: none; color: inherit; transition: transform .15s; }
.property-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.property-card-img { height: 180px; background: #f3f4f6; }
.property-card-img img { width: 100%; height: 100%; object-fit: cover; }
.no-img { display: flex; align-items: center; justify-content: center; height: 100%; color: #9ca3af; }
.property-card-body { padding: 1rem; }
.property-card-body h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.price { color: #dc2626; font-weight: 700; font-size: 1.1rem; }
.meta, .address { font-size: 0.85rem; color: #6b7280; margin: 0.25rem 0; }
.property-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.detail-gallery img { width: 100%; border-radius: 8px; margin-bottom: 0.5rem; }
.price-lg { font-size: 1.5rem; color: #dc2626; font-weight: 700; }
.detail-content { margin: 1rem 0; line-height: 1.6; }
@media (max-width: 768px) { .property-detail { grid-template-columns: 1fr; } .admin-shell { flex-direction: column; } .admin-sidebar { width: 100%; } }

/* User auth & notifications */
.user-main { max-width: 900px; }
.auth-card { max-width: 420px; margin: 2rem auto; background: #fff; padding: 2rem; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.notification-bell { position: relative; display: inline-block; margin-left: 1rem; }
.notification-btn { background: transparent; border: none; color: #dbeafe; font-size: 1.1rem; cursor: pointer; }
.notification-badge { position: absolute; top: -6px; right: -8px; background: #dc2626; color: #fff; font-size: 0.65rem; padding: 2px 5px; border-radius: 999px; }
.notification-dropdown { position: absolute; right: 0; top: 1.75rem; width: 280px; background: #fff; color: #111; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.15); z-index: 100; max-height: 320px; overflow-y: auto; }
.notification-item { padding: 0.75rem 1rem; border-bottom: 1px solid #e5e7eb; }
.notification-item p { margin: 0.25rem 0; font-size: 0.85rem; color: #4b5563; }
.notification-empty { padding: 1rem; color: #6b7280; font-size: 0.9rem; }

/* Checklist */
.checklist-panel { background: #fff; border-radius: 8px; padding: 1rem; margin-top: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.checklist-apply { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: end; margin-bottom: 1rem; }
.checklist-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.checklist-items { list-style: none; padding: 0; margin: 0; }
.checklist-item { padding: 0.5rem 0; border-bottom: 1px solid #f3f4f6; }
.checklist-item.done span { text-decoration: line-through; color: #6b7280; }
.checklist-item-row { align-items: center; margin-bottom: 0.5rem; }
