/* public/css/app.css - Version complète avec header étendu */

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
    --text-color: #333;
    --border-radius: 8px;
    --box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f5f7fa;
}

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

/* Header - AVEC BREADCRUMB */
.app-header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px 20px 0 20px; /* Plus de padding en haut pour le breadcrumb */
    box-shadow: var(--box-shadow);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    height: auto; /* Hauteur automatique pour s'adapter au breadcrumb */
    min-height: 70px; /* Hauteur minimale */
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding-bottom: 10px; /* Espace avant le breadcrumb */
}

.header-left,
.header-center,
.header-right {
    display: flex;
    align-items: center;
}

.header-center {
    flex: 1;
    justify-content: center;
}

.app-logo {
    font-size: 1.4rem;
    font-weight: bold;
}

.current-page-mobile {
    font-size: 1.1rem;
    font-weight: bold;
    display: none;
}

/* Notifications */
.notification-icon {
    position: relative;
    margin-right: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-info-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 15px;
    color: white;
}

.user-role-badge .status-badge {
    font-size: 0.7rem;
    padding: 3px 8px;
}

.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Breadcrumb navigation */
.breadcrumb-nav {
    padding: 10px 0;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.9rem;
    display: none; /* Caché par défaut sur mobile */
}

.breadcrumb-nav a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
}

.breadcrumb-nav a:hover {
    color: white;
    text-decoration: underline;
}

.breadcrumb-separator {
    margin: 0 8px;
    color: rgba(255,255,255,0.5);
}

.breadcrumb-nav span:last-child {
    color: white;
    font-weight: bold;
}

/* Navigation latérale */
.sidebar {
    position: fixed;
    top: 100px; /* Commence après le header étendu */
    left: -280px;
    width: 280px;
    height: calc(100vh - 100px); /* Hauteur totale moins le header */
    background-color: white;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    transition: var(--transition);
    z-index: 1000;
    overflow-y: auto;
}

.sidebar.active {
    left: 0;
}

.nav-menu {
    list-style: none;
    padding: 0;
}

.nav-item {
    border-bottom: 1px solid #eee;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: var(--dark-color);
    text-decoration: none;
    transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
    background-color: var(--light-color);
    color: var(--primary-color);
}

.nav-icon {
    margin-right: 10px;
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

/* User info in sidebar */
.user-info-sidebar {
    padding: 20px;
    border-top: 1px solid #eee;
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--secondary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: bold;
    margin-bottom: 2px;
}

.user-role {
    font-size: 0.8rem;
    color: #666;
}

/* Contenu principal */
.main-content {
    margin-top: 100px; /* Hauteur du header étendu */
    padding: 20px;
    flex: 1;
    transition: var(--transition);
}

.page-title {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: var(--primary-color);
}

/* Cartes */
.card {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 15px 20px;
    background-color: var(--light-color);
    border-bottom: 1px solid #ddd;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 20px;
}

/* Grille de statistiques */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 15px;
    text-align: center;
    box-shadow: var(--box-shadow);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    margin: 10px 0;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
}

/* Éléments de liste */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.list-item:last-child {
    border-bottom: none;
}

.item-info {
    flex: 1;
}

.item-title {
    font-weight: bold;
    margin-bottom: 5px;
}

.item-details {
    font-size: 0.9rem;
    color: #666;
}

.item-actions {
    display: flex;
    gap: 10px;
}

/* Badges de statut */
.status-badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
}

.status-paid {
    background-color: #d4edda;
    color: #155724;
}

.status-unpaid {
    background-color: #f8d7da;
    color: #721c24;
}

.status-pending {
    background-color: #fff3cd;
    color: #856404;
}

/* Boutons */
.btn {
    display: inline-block;
    padding: 10px 15px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: var(--transition);
}

.btn:hover {
    background-color: #2980b9;
}

.btn-block {
    display: block;
    width: 100%;
}

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

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

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

.btn-warning:hover {
    background-color: #e67e22;
}

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

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

.btn-link {
    background: none;
    border: none;
    color: white;
    text-decoration: underline;
    cursor: pointer;
    padding: 5px 10px;
}

/* Formulaires */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.form-control.error {
    border-color: var(--danger-color);
}

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

/* Onglets */
.tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}

.tab.active {
    border-bottom-color: var(--secondary-color);
    font-weight: bold;
}

.tab-content {
    display: none !important;
}

.tab-content.active {
    display: block !important;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1100;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: white;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(-20px);
    transition: var(--transition);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.3rem;
    font-weight: bold;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Tableaux */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.data-table th {
    background-color: var(--light-color);
    font-weight: bold;
}

.data-table tr:hover {
    background-color: #f9f9f9;
}

/* Alertes */
.alert {
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

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

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

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Styles pour la gestion de caisse */
.cash-summary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.cash-amount {
    font-size: 2rem;
    font-weight: bold;
    margin: 10px 0;
}

.movement-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    border-left: 4px solid transparent;
    transition: var(--transition);
}

.movement-item.income {
    border-left-color: var(--success-color);
    background: rgba(39, 174, 96, 0.05);
}

.movement-item.expense {
    border-left-color: var(--danger-color);
    background: rgba(231, 76, 60, 0.05);
}

.debt-card {
    border-left: 4px solid var(--danger-color);
    padding: 15px;
    margin-bottom: 10px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.debt-overdue {
    background: rgba(231, 76, 60, 0.1);
}

/* Styles pour le profil */
.profile-info {
    display: grid;
    gap: 15px;
}

.info-group {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.info-group:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: bold;
    width: 200px;
    color: var(--primary-color);
}

.info-value {
    flex: 1;
}

.error-text {
    color: var(--danger-color);
    font-size: 0.9rem;
    margin-top: 5px;
    display: block;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* Projects grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.project-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

.project-header {
    padding: 15px;
    background: var(--light-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.project-body {
    padding: 15px;
}

.project-details {
    display: grid;
    gap: 5px;
    margin: 10px 0;
    font-size: 0.9rem;
}

.voting-progress {
    margin-top: 10px;
}

.progress-bar {
    background: #eee;
    border-radius: 10px;
    height: 10px;
    margin-bottom: 5px;
}

.progress {
    background: var(--success-color);
    height: 100%;
    border-radius: 10px;
    transition: width 0.3s ease;
}

.project-footer {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.vote-options {
    display: flex;
    gap: 20px;
}

.vote-option {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.vote-label {
    margin-left: 5px;
}

.admin-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    text-align: center;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--secondary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.flash-message {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 300px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Menu icon animation */
.menu-icon {
    transition: transform 0.3s ease;
}

/* RESPONSIVE DESIGN */

/* Desktop */
@media (min-width: 768px) {
    .app-container {
        flex-direction: row;
        padding-top: 100px; /* Compenser le header étendu */
    }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: 100px;
        width: 250px;
        height: calc(100vh - 100px);
        box-shadow: none;
        border-right: 1px solid #ddd;
    }
    
    .menu-toggle {
        display: none;
    }
    
    .main-content {
        margin-left: 250px;
        margin-top: 100px;
        width: calc(100% - 250px);
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .breadcrumb-nav {
        display: block;
    }
    
    .current-page-mobile {
        display: none;
    }
    
    .user-info-header {
        display: flex;
    }
    
    .notification-icon {
        display: flex;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .app-header {
        padding: 10px 15px 0 15px;
        min-height: 60px;
    }
    
    .sidebar {
        top: 80px;
        height: calc(100vh - 80px);
    }
    
    .sidebar.active + .main-content {
        margin-left: 280px;
        width: calc(100% - 280px);
    }
    
    .main-content {
        margin-top: 80px;
    }
    
    /* Empêcher le défilement du body quand la sidebar est ouverte */
    body.sidebar-active {
        overflow: hidden;
    }
    
    .item-actions {
        flex-direction: column;
    }
    
    .data-table {
        font-size: 0.9rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }
    
    .info-group {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .info-label {
        width: 100%;
        margin-bottom: 5px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-actions {
        flex-direction: column;
    }
    
    .header-center {
        display: none;
    }
    
    .current-page-mobile {
        display: block;
    }
    
    .user-info-header {
        display: none;
    }
    
    .breadcrumb-nav {
        display: none;
    }
    
    .notification-icon {
        display: none;
    }
    
    .user-info-sidebar {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .user-details {
        text-align: center;
    }

    /* Styles pour le multi-immeuble */
.building-selector-desktop {
    display: inline-block;
}

.building-selector-desktop select {
    max-width: 250px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    border-radius: var(--border-radius);
    padding: 5px 10px;
}

.building-selector-desktop select:focus {
    outline: none;
    border-color: rgba(255,255,255,0.6);
}

.current-building-indicator {
    margin-right: 15px;
}

.building-badge {
    background: rgba(255,255,255,0.2);
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    border: 1px solid rgba(255,255,255,0.3);
    white-space: nowrap;
}

.building-info-sidebar {
    background: linear-gradient(135deg, var(--primary-color), #3498db);
    color: white;
    border-bottom: none;
}

.building-info-sidebar .building-indicator {
    display: flex;
    align-items: center;
    padding: 15px 20px;
}

.building-icon {
    font-size: 1.5rem;
    margin-right: 12px;
}

.building-details {
    flex: 1;
}

.building-name {
    font-weight: bold;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.building-address {
    font-size: 0.8rem;
    opacity: 0.9;
}

.user-building {
    font-size: 0.75rem;
    color: #666;
    margin-top: 2px;
    font-style: italic;
}

.breadcrumb-building {
    color: rgba(255,255,255,0.9);
    font-weight: bold;
}

/* Indicateur visuel pour l'immeuble actuel */
.current-building-highlight {
    border-left: 4px solid var(--secondary-color);
    background: rgba(52, 152, 219, 0.1);
}

/* Animation pour le changement d'immeuble */
.building-transition {
    animation: buildingFade 0.5s ease;
}

@keyframes buildingFade {
    0% { opacity: 0.7; transform: translateY(-5px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 767px) {
    .building-selector-desktop {
        display: none;
    }
    
    .current-building-indicator {
        display: none;
    }
    
    .building-badge {
        font-size: 0.8rem;
        padding: 4px 8px;
    }
}

@media (min-width: 768px) {
    .building-info-sidebar {
        display: block;
    }
}
}
