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

:root {
    /* Light Theme (Default) */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --border-color: rgba(15, 23, 42, 0.08);
    
    --primary: #6366f1;
    --primary-rgb: 99, 102, 241;
    --primary-hover: #4f46e5;
    --accent: #f59e0b;
    --accent-rgb: 245, 158, 11;
    
    --text-main: #0f172a;
    --text-muted: #475569;
    --text-dark: #94a3b8;
    
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;

    --font-sans: 'Outfit', sans-serif;
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 15px -3px rgba(15, 23, 42, 0.08);
    --shadow-glow: 0 0 15px rgba(99, 102, 241, 0.08);
    
    --bg-input: #ffffff;
    --bg-input-focus: #ffffff;
    --bg-panel-header: rgba(248, 250, 252, 0.8);
    --bg-pill: rgba(15, 23, 42, 0.03);
    --bg-pill-hover: rgba(15, 23, 42, 0.05);
    --bg-profile-pill: rgba(15, 23, 42, 0.04);
}

[data-theme="dark"] {
    /* Dark Theme */
    --bg-main: #0b0f19;
    --bg-card: #151c2c;
    --bg-card-hover: #1c253b;
    --border-color: rgba(255, 255, 255, 0.08);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dark: #64748b;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 20px -2px rgba(0, 0, 0, 0.25);
    --shadow-glow: 0 0 15px rgba(99, 102, 241, 0.15);
    
    --bg-input: rgba(0, 0, 0, 0.2);
    --bg-input-focus: rgba(0, 0, 0, 0.3);
    --bg-panel-header: rgba(11, 15, 25, 0.6);
    --bg-pill: rgba(255, 255, 255, 0.02);
    --bg-pill-hover: rgba(255, 255, 255, 0.05);
    --bg-profile-pill: rgba(0, 0, 0, 0.25);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-dark);
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: var(--transition-normal);
}

.sidebar-brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand .logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.sidebar-brand span {
    font-weight: 700;
    font-size: 22px;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, var(--text-main), var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-menu {
    padding: 24px 16px;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-menu-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: var(--transition-fast);
}

.sidebar-menu-item a:hover {
    color: var(--text-main);
    background-color: var(--bg-pill);
}

.sidebar-menu-item.active a {
    color: var(--text-main);
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0.02) 100%);
    border-left: 3px solid var(--primary);
    padding-left: 13px;
}

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

.admin-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background-color: var(--bg-profile-pill);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.admin-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.admin-info .admin-name {
    font-weight: 600;
    font-size: 14px;
    display: block;
}

.admin-info .admin-role {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
}

/* Logout Button */
.btn-logout {
    width: 100%;
    background: none;
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-fast);
}

.btn-logout:hover {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
}

/* Main Content Area */
.main-wrapper {
    flex-grow: 1;
    margin-left: 280px;
    width: calc(100% - 280px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-bar {
    height: 80px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    background-color: var(--bg-panel-header);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 90;
}

.page-title h1 {
    font-size: 24px;
    font-weight: 700;
}

.page-title p {
    font-size: 13px;
    color: var(--text-muted);
}

.main-content {
    padding: 40px;
    flex-grow: 1;
}

/* Cards & Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    transition: var(--transition-normal);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    opacity: 0;
    transition: var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-4px);
    background-color: var(--bg-card-hover);
    box-shadow: var(--shadow-md), var(--shadow-glow);
    border-color: rgba(99, 102, 241, 0.25);
}

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

.stat-details h3 {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-details .stat-number {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

/* Card variants */
.stat-card.accent::after { background: var(--accent); }
.stat-card.accent .stat-icon { background-color: rgba(245, 158, 11, 0.1); color: var(--accent); }

.stat-card.success::after { background: var(--success); }
.stat-card.success .stat-icon { background-color: rgba(16, 185, 129, 0.1); color: var(--success); }

.stat-card.info::after { background: var(--info); }
.stat-card.info .stat-icon { background-color: rgba(6, 182, 212, 0.1); color: var(--info); }

/* Dashboard layout sections */
.dashboard-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 40px;
}

@media (max-width: 1300px) {
    .dashboard-row {
        grid-template-columns: 1fr;
    }
}

.panel-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    min-width: 0;
    overflow: hidden;
}

/* Responsive Grid Helpers */
.grid-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 32px;
    align-items: flex-start;
}

.grid-1-1 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 1024px) {
    .grid-2-1 {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

@media (max-width: 576px) {
    .grid-1-1 {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.panel-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.panel-card-title {
    font-size: 18px;
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: var(--transition-fast);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background-color: var(--bg-pill);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-pill-hover);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

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

.btn-success {
    background-color: var(--success);
    color: white;
}

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

.btn-icon-only {
    padding: 8px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.custom-table th {
    padding: 16px 20px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.custom-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.custom-table tbody tr {
    transition: var(--transition-fast);
}

.custom-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.015);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-new {
    background-color: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}

.badge-contacted {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.badge-closed {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.badge-archived {
    background-color: rgba(148, 163, 184, 0.15);
    color: var(--text-muted);
}

.badge-sale {
    background-color: rgba(6, 182, 212, 0.15);
    color: var(--info);
}

.badge-leasehold {
    background-color: rgba(236, 72, 153, 0.15);
    color: #ec4899;
}

.badge-freehold {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

/* Alert Notification */
.alert {
    padding: 16px 24px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    animation: slideDown 0.3s ease;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.alert-error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Forms */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

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

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

/* Switch & Checkbox styling */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-pill);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    user-select: none;
    transition: var(--transition-fast);
}

.checkbox-label:hover {
    background-color: var(--bg-pill-hover);
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

/* Login Page Styling */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.05) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(245, 158, 11, 0.05) 0%, transparent 40%),
                var(--bg-main);
}

.login-card {
    width: 100%;
    max-width: 440px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-md);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header .logo-wrapper {
    display: inline-flex;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-md);
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    margin-bottom: 20px;
}

.login-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 14px;
}

/* Listing Property Card in dashboard */
.property-inline {
    display: flex;
    align-items: center;
    gap: 16px;
}

.property-inline-img {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background-color: rgba(255, 255, 255, 0.05);
}

.property-inline-info .title {
    font-weight: 600;
    font-size: 14px;
    display: block;
}

.property-inline-info .code {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Responsive sidebar and general layout */
#sidebar-toggle {
    display: none;
}

@media (max-width: 768px) {
    #sidebar-toggle {
        display: inline-flex;
    }
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-wrapper {
        margin-left: 0;
        width: 100%;
    }
    .top-bar {
        padding: 0 20px;
        height: 70px;
    }
    .top-bar .btn .btn-text {
        display: none;
    }
    .top-bar .btn {
        padding: 8px;
    }
    .page-title h1 {
        font-size: 18px;
    }
    .page-title p {
        display: none;
    }
    .main-content {
        padding: 20px;
    }
    .panel-card {
        padding: 20px;
    }
    .filter-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 16px;
    }
    .stat-card {
        padding: 16px;
    }
    .stat-details .stat-number {
        font-size: 24px;
    }
    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 24px;
        margin: 16px;
    }
}

/* Floating Actions */
.actions-cell {
    display: flex;
    gap: 8px;
}

/* Filter Section */
.filter-bar {
    background-color: var(--bg-pill);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: var(--radius-md);
    margin-bottom: 30px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) auto;
    gap: 16px;
    align-items: flex-end;
}

/* Image Upload Previews */
.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.image-preview-card {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 1;
    border: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.2);
}

.image-preview-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    padding: 8px;
    display: flex;
    justify-content: space-between;
    opacity: 0;
    transition: var(--transition-fast);
}

.image-preview-card:hover .image-preview-actions {
    opacity: 1;
}

.image-preview-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    display: flex;
    align-items: center;
    border-radius: 4px;
    transition: var(--transition-fast);
}

.image-preview-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.image-preview-btn.delete:hover {
    color: var(--danger);
}

.image-preview-card.primary {
    border-color: var(--primary);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

.primary-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background-color: var(--primary);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

/* Pagination */
.pagination-wrapper {
    margin-top: 30px;
}
.pagination-wrapper nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.pagination-wrapper .hidden {
    display: flex;
    gap: 8px;
    align-items: center;
}
.pagination-wrapper span, .pagination-wrapper a {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    background-color: var(--bg-card);
    transition: var(--transition-fast);
}
.pagination-wrapper a:hover {
    color: var(--text-main);
    border-color: var(--primary);
}
.pagination-wrapper .active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.material-icons-outlined {
    font-family: 'Material Symbols Outlined' !important;
}
