/**
 * GESLOC - CSS Mobile-First
 * Simple, propre, responsive
 */

/* ═══════════════════════════════════════════════════════════════════════════
   VARIABLES
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
    --primary: #2b855e;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --secondary: #6c757d;
    
    --bg-page: #f5f7fa;
    --bg-white: #ffffff;
    --border: #dee2e6;
    --text: #212529;
    --text-muted: #6c757d;
    
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --radius: 8px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════════════════════════ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg-page);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONTAINER
   ═══════════════════════════════════════════════════════════════════════════ */
.container {
    width: 100%;
    padding: 0 1rem;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 960px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   HEADER & NAVIGATION
   ═══════════════════════════════════════════════════════════════════════════ */
.header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* Menu Hamburger (Mobile uniquement) */
.menu-toggle {
    display: block;
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text);
}

/* Navigation Mobile */
.nav-mobile {
    display: none;
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: var(--bg-white);
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    padding: 2rem 1rem;
    transition: right 0.3s ease;
    z-index: 200;
}

.nav-mobile.active {
    right: 0;
}

.nav-mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.nav-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text);
}

.nav-mobile a {
    display: block;
    padding: 1rem;
    margin-bottom: 0.5rem;
    text-decoration: none;
    color: var(--text);
    border-radius: var(--radius);
    font-weight: 500;
    transition: background 0.2s;
}

.nav-mobile a:hover,
.nav-mobile a.active {
    background: var(--primary);
    color: white;
}

.nav-mobile .logout {
    margin-top: 2rem;
    background: var(--danger);
    color: white;
    text-align: center;
}

/* Overlay pour fermer le menu mobile */
.nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 150;
}

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

/* Navigation Desktop (cachée sur mobile) */
.nav-desktop {
    display: none;
}

/* User info mobile */
.user-info-mobile {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Desktop : afficher nav horizontale, cacher hamburger */
@media (min-width: 768px) {
    .menu-toggle {
        display: none;
    }
    
    .nav-mobile,
    .nav-overlay {
        display: none !important;
    }
    
    .nav-desktop {
        display: flex;
        gap: 0.5rem;
        align-items: center;
    }
    
    .nav-desktop a {
        padding: 0.5rem 1rem;
        text-decoration: none;
        color: var(--text);
        border-radius: var(--radius);
        font-weight: 500;
        transition: background 0.2s;
    }
    
    .nav-desktop a:hover,
    .nav-desktop a.active {
        background: var(--primary);
        color: white;
    }
    
    .nav-desktop .logout {
        background: var(--danger);
        color: white;
        margin-left: 1rem;
    }
    
    .user-info-mobile {
        display: none;
    }
    
    .user-info-desktop {
        display: block;
        font-size: 0.875rem;
        color: var(--text-muted);
        margin-left: auto;
        padding-right: 1rem;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTION / CARD
   ═══════════════════════════════════════════════════════════════════════════ */
.section {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--text);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORMULAIRES
   ═══════════════════════════════════════════════════════════════════════════ */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    background: white;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(43, 133, 94, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BOUTONS
   ═══════════════════════════════════════════════════════════════════════════ */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--secondary);
    color: white;
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary);
}

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

.btn-block {
    display: block;
    width: 100%;
    margin-bottom: 0.75rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ALERTES
   ═══════════════════════════════════════════════════════════════════════════ */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ═══════════════════════════════════════════════════════════════════════════
   KPI CARDS
   ═══════════════════════════════════════════════════════════════════════════ */
.kpi-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 480px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .kpi-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.kpi-card {
    background: var(--bg-white);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.kpi-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════════════════ */
.footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 3rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════════════════════ */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-secondary {
    background: #e9ecef;
    color: #6c757d;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PROPERTY LIST & CARDS
   ═══════════════════════════════════════════════════════════════════════════ */
.property-list {
    display: grid;
    gap: 1rem;
}

.property-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.property-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.property-header h3 {
    margin: 0;
    font-size: 1.125rem;
    color: var(--text);
}

.property-details {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.property-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

@media (min-width: 768px) {
    .property-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TENANT LIST & CARDS
   ═══════════════════════════════════════════════════════════════════════════ */
.tenant-list {
    display: grid;
    gap: 1rem;
}

.tenant-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.tenant-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.tenant-header h3 {
    margin: 0;
    font-size: 1.125rem;
    color: var(--text);
}

.tenant-details {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.tenant-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

@media (min-width: 768px) {
    .tenant-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   LEASE LIST & CARDS
   ═══════════════════════════════════════════════════════════════════════════ */
.lease-list {
    display: grid;
    gap: 1rem;
}

.lease-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.lease-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.lease-header h3 {
    margin: 0;
    font-size: 1.125rem;
    color: var(--text);
}

.lease-details {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.lease-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

@media (min-width: 768px) {
    .lease-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   RENT LIST & CARDS
   ═══════════════════════════════════════════════════════════════════════════ */
.rent-list {
    display: grid;
    gap: 1rem;
}

.rent-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.rent-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.rent-header h3 {
    margin: 0;
    font-size: 1.125rem;
    color: var(--text);
}

.rent-details {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.rent-actions {
    display: grid;
    gap: 0.5rem;
}

@media (min-width: 768px) {
    .rent-list {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* ═══════════════════════════════════════════════════════════════════════════
   TABLEAUX
   ═══════════════════════════════════════════════════════════════════════════ */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th {
    background: var(--bg-page);
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    border-bottom: 2px solid var(--border);
}

td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

tr:hover {
    background: var(--bg-page);
}

/* Mobile : masquer certaines colonnes */
@media (max-width: 767px) {
    .hide-mobile {
        display: none;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════════════════════ */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-secondary {
    background: #e9ecef;
    color: #6c757d;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOOLBAR
   ═══════════════════════════════════════════════════════════════════════════ */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-form {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    max-width: 400px;
}

.search-form input {
    flex: 1;
}

/* Mobile : toolbar en colonne */
@media (max-width: 767px) {
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-form {
        max-width: 100%;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════════════════ */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   UTILITAIRES
   ═══════════════════════════════════════════════════════════════════════════ */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.hide-desktop {
    display: none;
}

@media (max-width: 767px) {
    .hide-desktop {
        display: block;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   RENT LIST & CARDS
   ═══════════════════════════════════════════════════════════════════════════ */
.rent-list {
    display: grid;
    gap: 1rem;
}

.rent-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.rent-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.rent-header h4 {
    margin: 0;
    font-size: 1.125rem;
    color: var(--text);
}

@media (min-width: 768px) {
    .rent-list {
        grid-template-columns: repeat(2, 1fr);
    }
}
