@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css");
/* ===================================================================
   REALESTATE AI - RESPONSIVE CSS (MOBILE-FIRST + DESKTOP OPTIMIZED)
   =================================================================== */

/* CSS VARS & DARK MODE */
:root {
    --color-bg: #f5f7fa;
    --color-bg-card: #fff;
    --color-bg-sidebar: #1e3a8a;
    --color-bg-topbar: #fff;
    --color-bg-quickbar: #0f172a;
    --color-text: #1f2937;
    --color-text-secondary: #374151;
    --color-text-light: #6b7280;
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-success: #10b981;
    --color-success-dark: #059669;
    --color-danger: #ef4444;
    --color-danger-dark: #dc2626;
    --color-secondary: #6b7280;
    --color-secondary-dark: #4b5563;
    --color-badge-primary-bg: #dbeafe;
    --color-badge-primary-text: #1e40af;
    --color-badge-success-bg: #d1fae5;
    --color-badge-success-text: #065f46;
    --color-badge-danger-bg: #fee2e2;
    --color-badge-danger-text: #991b1b;
    --color-card-shadow: 0 1px 3px rgba(0,0,0,0.1);
    --color-border: #e5e7eb;
    --color-border-light: #f3f4f6;
}

.dark {
    --color-bg: #181e2a;
    --color-bg-card: #232b3e;
    --color-bg-sidebar: #111827;
    --color-bg-topbar: #232b3e;
    --color-bg-quickbar: #111827;
    --color-text: #f3f4f6;
    --color-text-secondary: #d1d5db;
    --color-text-light: #9ca3af;
    --color-primary: #60a5fa;
    --color-primary-dark: #2563eb;
    --color-success: #34d399;
    --color-success-dark: #059669;
    --color-danger: #f87171;
    --color-danger-dark: #dc2626;
    --color-secondary: #6b7280;
    --color-secondary-dark: #374151;
    --color-badge-primary-bg: #1e40af;
    --color-badge-primary-text: #dbeafe;
    --color-badge-success-bg: #065f46;
    --color-badge-success-text: #d1fae5;
    --color-badge-danger-bg: #991b1b;
    --color-badge-danger-text: #fee2e2;
    --color-card-shadow: 0 1px 6px rgba(0,0,0,0.22);
    --color-border: #374151;
    --color-border-light: #232b3e;
}

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

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

img, video, canvas, svg {
    max-width: 100%;
    height: auto;
}

/* VIEWPORT SETUP */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    position: relative;
}

/* SIDEBAR - MOBILE FIRST */
.sidebar {
    width: 260px;
    background: #1e3a8a;
    color: white;
    position: fixed;
    height: 100vh;
    left: -260px;
    top: 0;
    z-index: 1000;
    transition: left 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar.open {
    left: 0;
}

body.sidebar-open {
    overflow: hidden;
}

body.sidebar-open .sidebar-overlay {
    display: block;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 16px;
    font-weight: 700;
}

.sidebar-close {
    display: block;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item span {
    margin-right: 12px;
    font-size: 16px;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-left-color: #60a5fa;
    font-weight: 600;
}

.nav-section-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 12px 20px;
}

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

.btn-logout {
    width: 100%;
    padding: 12px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.2);
}

/* MAIN CONTENT - MOBILE FIRST */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
}

/* TOPBAR */
.topbar {
    background: white;
    padding: 12px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.hamburger {
    display: block;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    color: #1f2937;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-left h1 {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-badge {
    padding: 6px 12px;
    background: #f3f4f6;
    border-radius: 20px;
    font-size: 13px;
    color: #374151;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2563eb;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.topbar-search {
    position: relative;
    display: none;
}

.topbar-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

.topbar-search input {
    padding: 8px 12px 8px 36px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    width: 200px;
}

.topbar-search input:focus {
    outline: none;
    border-color: #2563eb;
}

.topbar-actions {
    display: flex;
    gap: 8px;
}

.topbar-btn {
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.topbar-btn.primary {
    background: #2563eb;
    color: white;
}

.topbar-btn.primary:hover {
    background: #1d4ed8;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.breadcrumbs a {
    color: #2563eb;
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    color: #9ca3af;
}

/* CONTENT */
.content {
    flex: 1;
    padding: 16px;
    width: 100%;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
}

/* KPI GRID - MOBILE: 1 COLUMN */
.kpi-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.kpi-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kpi-value {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
}

/* QUICK ACTIONS - MOBILE: 1 COLUMN */
.quick-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 24px;
}

.mobile-quickbar {
    display: none;
}

.action-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.action-card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
}

.action-card p {
    color: #6b7280;
    margin-bottom: 16px;
    font-size: 14px;
}

/* BUTTONS */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    font-size: 14px;
    text-align: center;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* TABLES - RESPONSIVE */
.table-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.filters-bar {
    display: flex;
    gap: 12px;
    padding: 12px;
    align-items: center;
    flex-wrap: wrap;
    border-bottom: 1px solid #e5e7eb;
}

.filters-toggle {
    display: none;
}

.filter-select {
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    min-width: 180px;
    font-size: 14px;
    background: white;
}

.clear-filters {
    background: #e5e7eb;
    color: #111827;
    border-color: #e5e7eb;
}

/* Mobile-friendly table to cards */
.table.responsive {
    min-width: 0;
}

@media (max-width: 720px) {
    .table.responsive thead {
        display: none;
    }

    .table.responsive tbody tr {
        display: block;
        background: white;
        margin-bottom: 12px;
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        box-shadow: 0 1px 2px rgba(0,0,0,0.05);
        padding: 6px 0;
    }

    .table.responsive tbody tr:hover {
        background: white;
    }

    .table.responsive td {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px 14px;
        border-top: 1px solid #f3f4f6;
        text-align: left;
        width: 100%;
        font-size: 14px;
    }

    .table.responsive td:first-child {
        border-top: none;
    }

    .table.responsive td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #6b7280;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .table.responsive td.actions-cell {
        align-items: stretch;
    }

    .table.responsive td .btn {
        width: 100%;
        justify-content: center;
    }

    .table.responsive td .actions-stack {
        width: 100%;
        align-items: stretch;
    }

    .filters-bar {
        display: none;
        flex-direction: column;
        align-items: stretch;
        background: #f9fafb;
        gap: 10px;
        border-bottom: 1px solid #e5e7eb;
    }

    .filters-bar.open {
        display: flex;
    }

    .filter-select {
        width: 100%;
        min-width: 0;
    }

    .clear-filters {
        width: 100%;
    }

    .filters-toggle {
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

    .property-picker {
        flex-direction: column;
        align-items: stretch;
    }

    .property-picker select {
        width: 100%;
        min-width: 0;
    }

    .picker-btn {
        width: 100%;
        justify-content: center;
    }

    .mobile-quickbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        display: flex;
        gap: 8px;
        padding: 10px 12px;
        background: #0f172a;
        box-shadow: 0 -6px 18px rgba(0,0,0,0.22);
        z-index: 50;
    }

    .mobile-quickbar .btn {
        flex: 1;
        width: 100%;
        justify-content: center;
    }

    .content {
        padding-bottom: 96px;
    }

    .mobile-actions {
        display: flex;
        flex-direction: column;
        gap: 8px;
        width: 100%;
        margin-top: 10px;
    }

    .mobile-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .hide-mobile {
        display: none !important;
    }
}

.hide-mobile {
    display: table-cell;
}

.mobile-actions {
    display: none;
}

.table thead {
    background: #f9fafb;
}

.table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table td {
    padding: 16px;
    border-top: 1px solid #e5e7eb;
    line-height: 1.45;
}

.actions-cell {
    text-align: right;
}

.actions-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
}

.actions-cell .primary-action {
    margin-bottom: 6px;
}

.table tbody tr:hover {
    background: #f9fafb;
}

/* BADGES */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-primary {
    background: #dbeafe;
    color: #1e40af;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* CARD */
.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
}

.card-body {
    padding: 20px;
}

/* EMPTY STATE */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.empty-state p {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 20px;
}

/* LAYOUT HELPERS */
.layout-split {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.layout-split .table-container {
    max-height: none;
}

.layout-split .card {
    height: auto;
}

@media (min-width: 1024px) {
    .layout-split {
        grid-template-columns: 1fr 400px;
        gap: 20px;
        height: calc(100vh - 260px);
    }

    .layout-split .table-container {
        overflow-y: auto;
        max-height: 100%;
    }

    .layout-split .card {
        height: 100%;
        overflow-y: auto;
    }
}

/* ACTION BAR (STICKY BOTTOM) */
.action-bar-fixed {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0f172a;
    color: white;
    padding: 12px 16px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.12);
    z-index: 30;
}

.action-bar-fixed .action-bar-label {
    flex: 1;
    font-weight: 600;
    min-width: 180px;
}

.action-bar-fixed .btn {
    min-width: 140px;
}

@media (min-width: 768px) {
    .action-bar-fixed {
        left: 260px;
        padding: 12px 20px;
        flex-wrap: nowrap;
    }
}

/* FORMS */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
}

.property-picker {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.property-picker select {
    flex: 1;
    min-width: 220px;
}

.picker-btn {
    white-space: nowrap;
}

/* ===================================================================
   TABLET BREAKPOINT (768px+)
   =================================================================== */

@media (min-width: 768px) {
    .hamburger {
        display: none;
    }

    .sidebar {
        left: 0;
    }

    .sidebar-close {
        display: none;
    }

    .sidebar-overlay {
        display: none !important;
    }

    .main-content {
        margin-left: 260px;
    }

    .topbar {
        padding: 16px 24px;
    }

    .topbar-left h1 {
        font-size: 20px;
    }

    .content {
        padding: 24px;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .page-header h2 {
        font-size: 24px;
    }
}

/* ===================================================================
   DESKTOP BREAKPOINT (1024px+)
   =================================================================== */

@media (min-width: 1024px) {
    .content {
        padding: 32px;
        max-width: 1400px;
        margin: 0 auto;
    }

    .topbar {
        padding: 16px 32px;
    }

    .topbar-left h1 {
        font-size: 24px;
    }

    .kpi-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 24px;
    }

    .quick-actions {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }

    .kpi-value {
        font-size: 32px;
    }

    .page-header h2 {
        font-size: 28px;
    }
}

/* ===================================================================
   LARGE DESKTOP (1440px+)
   =================================================================== */

@media (min-width: 1440px) {
    .content {
        max-width: 1600px;
    }
}

/* ===================================================================
   PAGE TOOLBAR
   =================================================================== */

.page-toolbar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.page-subtitle {
    color: #6b7280;
    font-size: 14px;
    margin: 4px 0 0 0;
}

@media (min-width: 768px) {
    .page-toolbar {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .page-title {
        font-size: 28px;
    }
}
