/* Styles principaux de l'application */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* Header */
.site-header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-role {
    color: #95a5a6;
    font-size: 0.9rem;
}

.btn-logout {
    padding: 0.5rem 1rem;
    background-color: #e74c3c;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s;
}

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

/* Navigation */
.site-nav {
    background-color: #34495e;
    padding: 0 2rem;
}

.nav-menu {
    max-width: 1400px;
    margin: 0 auto;
    list-style: none;
    display: flex;
    gap: 0;
}

.nav-link {
    display: block;
    padding: 1rem 1.5rem;
    color: #ecf0f1;
    text-decoration: none;
    transition: background-color 0.3s;
}

.nav-link:hover {
    background-color: #2c3e50;
}

.nav-divider {
    width: 1px;
    background-color: #2c3e50;
    margin: 0.5rem 0;
}

/* Flash Messages */
.flash-messages {
    max-width: 1400px;
    margin: 1rem auto;
    padding: 0 2rem;
}

.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

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

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

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
    min-height: calc(100vh - 250px);
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    margin-bottom: 1.5rem;
    text-align: center;
    color: #2c3e50;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.3s;
}

.btn-primary {
    background-color: #667eea;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background-color: #5568d3;
}

/* Dashboard */
.dashboard-container h1 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.dashboard-info {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.dashboard-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.widget {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.widget h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

/* Footer */
.site-footer {
    background-color: #2c3e50;
    color: #95a5a6;
    padding: 1.5rem 2rem;
    margin-top: 3rem;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
}

/* ========================================
   ADMINISTRATION - GESTION DES SOCIÉTÉS
   ======================================== */

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

/* Filtres */
.filters-bar {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filters-form {
    display: flex;
    gap: 1rem;
    align-items: end;
}

.filter-group {
    flex: 1;
}

.filter-input,
.filter-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

/* Tableaux de données */
.data-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.data-table thead {
    background-color: #34495e;
    color: white;
}

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

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

.data-table tbody tr.inactive-row {
    opacity: 0.6;
}

/* Actions */
.actions-cell {
    display: flex;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
}

.btn-info {
    background-color: #3498db;
    color: white;
}

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

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-link {
    background: none;
    color: #3498db;
    text-decoration: underline;
    border: none;
    cursor: pointer;
}

.btn-warning {
    background-color: #f39c12;
    color: white;
}

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

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

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

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-success {
    background-color: #27ae60;
    color: white;
}

.badge-danger {
    background-color: #e74c3c;
    color: white;
}

.badge-warning {
    background-color: #f39c12;
    color: white;
}

.badge-info {
    background-color: #3498db;
    color: white;
}

/* Quotas */
.quota-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: #ecf0f1;
    border-radius: 4px;
    font-weight: 500;
}

.quota-badge.quota-full {
    background-color: #e74c3c;
    color: white;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 8px;
}

.empty-state p {
    margin-bottom: 1rem;
    color: #7f8c8d;
}

/* Stats bar */
.stats-bar {
    margin-top: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ========================================
   FICHE SOCIÉTÉ (avec onglets)
   ======================================== */

/* En-tête de fiche */
.fiche-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.fiche-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.fiche-title h1 {
    margin: 0;
}

.fiche-actions {
    display: flex;
    gap: 0.5rem;
}

/* Onglets */
.tabs-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.tabs-nav {
    display: flex;
    list-style: none;
    border-bottom: 2px solid #ecf0f1;
    padding: 0;
    margin: 0;
    background-color: #f8f9fa;
}

.tabs-nav li {
    margin: 0;
}

.tabs-nav a {
    display: block;
    padding: 1rem 2rem;
    text-decoration: none;
    color: #7f8c8d;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tabs-nav li.active a {
    color: #2c3e50;
    border-bottom-color: #3498db;
    background-color: white;
    font-weight: 600;
}

.tabs-nav a:hover {
    background-color: #ecf0f1;
}

.tabs-content {
    padding: 2rem;
}

.tab-pane {
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* Info grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.info-section {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
}

.info-section h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 0.5rem;
}

.info-table {
    width: 100%;
}

.info-table th {
    text-align: left;
    padding: 0.75rem 0;
    color: #7f8c8d;
    font-weight: 500;
    width: 40%;
}

.info-table td {
    padding: 0.75rem 0;
    color: #2c3e50;
}

.info-table tr {
    border-bottom: 1px solid #ecf0f1;
}

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

/* Quotas avec barres de progression */
.quota-bar {
    width: 100%;
}

.quota-bar span {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background-color: #ecf0f1;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    transition: width 0.3s;
}

.progress-fill[style*="100%"] {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
}

/* ========================================
   FORMULAIRES
   ======================================== */

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.form-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #ecf0f1;
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

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

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-text {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #7f8c8d;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #ecf0f1;
}

.text-muted {
    color: #7f8c8d;
}

.tenant-link {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 500;
}

.tenant-link:hover {
    color: #3498db;
}

/* ========================================
   RESPONSIVE DESIGN - MOBILE & TABLETTE
   ======================================== */

/* Menu burger pour mobile */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* Tablette - 768px et moins */
@media (max-width: 768px) {
    /* Header */
    .site-header {
        padding: 1rem;
    }

    .header-container {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .header-logo h1 {
        font-size: 1.2rem;
    }

    .header-user {
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .user-role {
        display: none;
    }

    .btn-logout {
        padding: 0.4rem 0.8rem;
        font-size: 0.875rem;
    }

    /* Navigation */
    .site-nav {
        padding: 0;
    }

    .nav-menu {
        flex-direction: column;
        gap: 0;
    }

    .nav-link {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid #2c3e50;
    }

    .nav-divider {
        display: none;
    }

    /* Contenu principal */
    .main-content {
        padding: 0 1rem;
        margin: 1rem auto;
    }

    .flash-messages {
        padding: 0 1rem;
    }

    /* Page header */
    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    /* Filtres */
    .filters-form {
        flex-direction: column;
        gap: 1rem;
    }

    .filter-group {
        width: 100%;
    }

    /* Tableaux */
    .data-table {
        font-size: 0.875rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
    }

    .actions-cell {
        flex-direction: column;
        gap: 0.25rem;
    }

    /* Dashboard widgets */
    .dashboard-widgets {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .widget {
        padding: 1rem;
    }

    /* Onglets */
    .tabs-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tabs-nav a {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        white-space: nowrap;
    }

    .tabs-content {
        padding: 1rem;
    }

    /* Info grid */
    .info-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .info-section {
        padding: 1rem;
    }

    /* Formulaires */
    .form-card {
        padding: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    /* Fiche header */
    .fiche-header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .fiche-actions {
        flex-direction: column;
        width: 100%;
    }

    .fiche-actions .btn {
        width: 100%;
    }

    /* Footer */
    .site-footer {
        padding: 1rem;
    }
}

/* Mobile - 480px et moins */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    .header-logo h1 {
        font-size: 1rem;
    }

    .main-content {
        padding: 0 0.5rem;
    }

    .page-header h1 {
        font-size: 1.25rem;
    }

    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.875rem;
    }

    /* Tableaux responsive - affichage en cartes */
    .data-table thead {
        display: none;
    }

    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
    }

    .data-table tr {
        margin-bottom: 1rem;
        border: 1px solid #ecf0f1;
        border-radius: 8px;
        overflow: hidden;
    }

    .data-table td {
        position: relative;
        padding-left: 40%;
        border-bottom: 1px solid #ecf0f1;
    }

    .data-table td:last-child {
        border-bottom: none;
    }

    .data-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 38%;
        padding: 1rem 0.5rem;
        font-weight: 600;
        background-color: #f8f9fa;
    }

    .actions-cell {
        padding-left: 0.5rem !important;
    }

    .actions-cell::before {
        display: none;
    }

    /* Login box */
    .login-box {
        padding: 1.5rem;
        margin: 1rem;
    }

    /* Info table */
    .info-table th {
        width: 35%;
        font-size: 0.875rem;
    }

    .info-table td {
        font-size: 0.875rem;
    }
}

/* Large desktop - optimisation pour grands écrans */
@media (min-width: 1600px) {
    .header-container,
    .nav-menu,
    .main-content,
    .footer-container,
    .flash-messages {
        max-width: 1600px;
    }
}

/* Mode paysage mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .nav-menu {
        flex-direction: row;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav-link {
        white-space: nowrap;
        border-bottom: none;
        border-right: 1px solid #2c3e50;
    }
}
