/* RentConnect - Main Stylesheet */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --secondary: #0ea5e9;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --dark: #1e293b;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --white: #ffffff;
    --sidebar-width: 260px;
    --header-height: 64px;
    --border-radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; background: var(--gray-50); color: var(--gray-800); font-size: 14px; line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ===== LOGIN PAGE ===== */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-container { background: var(--white); border-radius: var(--border-radius); padding: 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); }
.login-logo { text-align: center; margin-bottom: 30px; }
.login-logo h1 { font-size: 28px; color: var(--primary); font-weight: 700; }
.login-logo p { color: var(--gray-500); margin-top: 5px; }
.login-tabs { display: flex; margin-bottom: 25px; border-bottom: 2px solid var(--gray-200); }
.login-tab { flex: 1; text-align: center; padding: 10px; cursor: pointer; color: var(--gray-500); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.3s; }
.login-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ===== LAYOUT ===== */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-width); background: var(--gray-900); color: var(--white); position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; overflow-y: auto; transition: transform 0.3s; }
.sidebar-header { padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.1); display: flex; align-items: center; gap: 12px; }
.sidebar-header h2 { font-size: 18px; font-weight: 700; color: var(--white); }
.sidebar-header .logo-icon { width: 36px; height: 36px; background: var(--primary); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; }
.sidebar-user { padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.1); display: flex; align-items: center; gap: 10px; }
.sidebar-user .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; }
.sidebar-user .user-info { flex: 1; }
.sidebar-user .user-info .name { font-size: 13px; font-weight: 600; }
.sidebar-user .user-info .role { font-size: 11px; color: var(--gray-400); text-transform: capitalize; }

.sidebar-nav { padding: 12px 0; }
.sidebar-nav .nav-section { padding: 8px 20px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-500); font-weight: 600; }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: var(--gray-400); font-size: 13px; font-weight: 500; transition: all 0.2s; border-left: 3px solid transparent; }
.sidebar-nav a:hover { color: var(--white); background: rgba(255,255,255,0.05); }
.sidebar-nav a.active { color: var(--white); background: rgba(79,70,229,0.2); border-left-color: var(--primary); }
.sidebar-nav a .icon { width: 20px; text-align: center; font-size: 16px; }
.sidebar-nav a .badge { margin-left: auto; background: var(--danger); color: var(--white); font-size: 10px; padding: 2px 6px; border-radius: 10px; font-weight: 600; }

.main-content { margin-left: var(--sidebar-width); flex: 1; min-height: 100vh; }
.top-header { height: var(--header-height); background: var(--white); border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 50; }
.top-header .page-title { font-size: 18px; font-weight: 700; color: var(--gray-900); }
.top-header .header-actions { display: flex; align-items: center; gap: 16px; }
.header-btn { background: none; border: none; cursor: pointer; color: var(--gray-500); font-size: 18px; position: relative; padding: 8px; border-radius: 8px; transition: all 0.2s; }
.header-btn:hover { background: var(--gray-100); color: var(--gray-700); }
.header-btn .notif-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; }

.content-area { padding: 24px; }

/* ===== CARDS & STATS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 24px; }
.stat-card { background: var(--white); border-radius: var(--border-radius); padding: 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; transition: transform 0.2s, box-shadow 0.2s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.stat-icon.blue { background: #dbeafe; color: #2563eb; }
.stat-icon.green { background: #dcfce7; color: #16a34a; }
.stat-icon.yellow { background: #fef3c7; color: #d97706; }
.stat-icon.red { background: #fee2e2; color: #dc2626; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.cyan { background: #cffafe; color: #0891b2; }
.stat-card .stat-info h3 { font-size: 24px; font-weight: 700; color: var(--gray-900); }
.stat-card .stat-info p { font-size: 13px; color: var(--gray-500); margin-top: 2px; }
.stat-card .stat-info .trend { font-size: 12px; margin-top: 4px; }
.trend.up { color: var(--success); }
.trend.down { color: var(--danger); }

.card { background: var(--white); border-radius: var(--border-radius); box-shadow: var(--shadow); margin-bottom: 24px; overflow: hidden; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 16px; font-weight: 600; color: var(--gray-900); }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--gray-200); background: var(--gray-50); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.form-control { width: 100%; padding: 10px 14px; border: 1px solid var(--gray-300); border-radius: 8px; font-size: 14px; color: var(--gray-800); background: var(--white); transition: border-color 0.2s, box-shadow 0.2s; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
textarea.form-control { min-height: 100px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-text { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s; text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); color: var(--white); }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #16a34a; color: var(--white); }
.btn-warning { background: var(--warning); color: var(--white); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #dc2626; color: var(--white); }
.btn-outline { background: var(--white); color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); color: var(--gray-700); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }
.btn-group { display: flex; gap: 8px; }

/* ===== TABLES ===== */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th { padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.05em; background: var(--gray-50); border-bottom: 1px solid var(--gray-200); }
table td { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); font-size: 13px; color: var(--gray-700); }
table tr:hover { background: var(--gray-50); }
table .actions { display: flex; gap: 6px; }

/* ===== BADGES & STATUS ===== */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: var(--gray-200); color: var(--gray-700); }
.badge-primary { background: #ede9fe; color: #5b21b6; }

/* ===== KANBAN BOARD ===== */
.kanban-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.kanban-column { background: var(--gray-100); border-radius: var(--border-radius); padding: 16px; min-height: 400px; }
.kanban-column-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 2px solid var(--gray-300); }
.kanban-column-header h4 { font-size: 14px; font-weight: 600; }
.kanban-column-header .count { background: var(--gray-300); color: var(--gray-700); padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.kanban-card { background: var(--white); border-radius: 8px; padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow); cursor: pointer; transition: transform 0.2s; border-left: 3px solid var(--gray-300); }
.kanban-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.kanban-card.priority-high { border-left-color: var(--danger); }
.kanban-card.priority-medium { border-left-color: var(--warning); }
.kanban-card.priority-low { border-left-color: var(--success); }
.kanban-card .card-title { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.kanban-card .card-meta { font-size: 11px; color: var(--gray-500); display: flex; gap: 10px; }

/* ===== PROPERTY GRID ===== */
.property-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.property-card { background: var(--white); border-radius: var(--border-radius); overflow: hidden; box-shadow: var(--shadow); transition: transform 0.2s, box-shadow 0.2s; }
.property-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.property-card .property-image { height: 180px; background: linear-gradient(135deg, var(--primary-light), var(--secondary)); display: flex; align-items: center; justify-content: center; color: var(--white); font-size: 48px; position: relative; }
.property-card .property-image img { width: 100%; height: 100%; object-fit: cover; }
.property-card .property-status { position: absolute; top: 12px; right: 12px; }
.property-card .property-info { padding: 16px; }
.property-card .property-info h4 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.property-card .property-info .address { font-size: 12px; color: var(--gray-500); margin-bottom: 12px; }
.property-card .property-stats { display: flex; gap: 16px; padding-top: 12px; border-top: 1px solid var(--gray-100); }
.property-card .property-stats .stat { text-align: center; flex: 1; }
.property-card .property-stats .stat .value { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.property-card .property-stats .stat .label { font-size: 11px; color: var(--gray-500); }

/* ===== CHARTS ===== */
.chart-container { position: relative; height: 300px; }
.chart-row { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 24px; }

/* ===== MODAL ===== */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; }
.modal { background: var(--white); border-radius: var(--border-radius); width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-header { padding: 20px; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 18px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--gray-400); padding: 4px; }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 8px; }

/* ===== ALERTS ===== */
.alert { padding: 14px 18px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; display: flex; align-items: center; gap: 10px; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ===== PAGINATION ===== */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 20px; }
.pagination a, .pagination span { padding: 8px 14px; border-radius: 6px; font-size: 13px; font-weight: 500; }
.pagination a { background: var(--white); color: var(--gray-700); border: 1px solid var(--gray-300); }
.pagination a:hover { background: var(--gray-50); }
.pagination span.active { background: var(--primary); color: var(--white); }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; color: var(--gray-700); margin-bottom: 8px; }
.empty-state p { color: var(--gray-500); margin-bottom: 20px; }

/* ===== SEARCH & FILTERS ===== */
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.search-box { position: relative; }
.search-box input { padding: 10px 14px 10px 38px; border: 1px solid var(--gray-300); border-radius: 8px; font-size: 13px; width: 280px; }
.search-box .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--gray-400); }
.filter-group { display: flex; gap: 8px; align-items: center; }
.filter-group select { padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: 8px; font-size: 13px; }

/* ===== TABS ===== */
.tabs { display: flex; border-bottom: 2px solid var(--gray-200); margin-bottom: 20px; }
.tab { padding: 10px 20px; cursor: pointer; color: var(--gray-500); font-weight: 500; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .kanban-board { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .chart-row { grid-template-columns: 1fr; }
    .property-grid { grid-template-columns: 1fr; }
    .toolbar { flex-direction: column; align-items: stretch; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .content-area { padding: 16px; }
}

/* CSRF-protected logout form styled like a sidebar link */
.nav-logout-form { margin: 0; padding: 0; }
.nav-logout-button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border: 0;
    border-left: 3px solid transparent;
    background: transparent;
    color: var(--gray-400);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}
.nav-logout-button:hover { color: var(--white); background: rgba(255,255,255,0.05); }
.nav-logout-button .icon { width: 20px; text-align: center; font-size: 16px; }
