/**
 * GogoFid Frontend - Style "Morceau de sucre"
 * Design sobre, épuré, efficace
 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    color: #333;
    background: #f5f5f5;
    line-height: 1.5;
}

/* ==== LAYOUT ==== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ==== PAGE LOGIN ==== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #fff;
}

.login-box {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.login-logo p {
    font-size: 13px;
    color: #666;
    margin-top: 5px;
}

/* ==== LAYOUT PRINCIPAL ==== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: #fff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.main-content {
    flex: 1;
    background: #f5f5f5;
    overflow-y: auto;
}

/* ==== MENU ==== */
#menu-principal {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.menu-categorie {
    margin-bottom: 5px;
}

.menu-categorie-titre {
    padding: 12px 20px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px; 
    cursor: pointer;
    display: flex;
    /*justify-content: space-between;*/
    justify-content: flex-start;
    align-items: center;
    user-select: none;
}

.menu-categorie-titre:hover {
    background: #f5f5f5;
}

.menu-chevron {
	/*margin-left: auto;*/
	margin-right: 8px;
    font-size: 10px;
    color: #999;
}

.menu-items {
    display: none;  /* Fermé par défaut */
}

.menu-items.active {
    display: block;  /* Ouvert au clic */
}


.menu-item {
    display: flex;
    align-items: center;
    padding: 10px 20px 10px 35px;
    color: #555;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
}

.menu-item:hover {
    background: #f5f5f5;
    color: #333;
}

.menu-item.active {
    background: #f0f0f0;
    color: #000;
    font-weight: 500;
    border-left: 3px solid #333;
}

.menu-item i {
    margin-right: 10px;
    font-size: 14px;
    width: 16px;
    text-align: center;
}

/* ==== USER INFO ==== */
#user-info {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    background: #fafafa;
}

.user-details {
    margin-bottom: 10px;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.user-profil {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

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

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #333;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #333;
}

.form-error {
    color: #d32f2f;
    font-size: 12px;
    margin-top: 5px;
}

/* ==== BOUTONS ==== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 3px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #333;
    color: #fff;
}

.btn-primary:hover {
    background: #000;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #f5f5f5;
}

.btn-logout {
    width: 100%;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.btn-logout i {
    margin-right: 5px;
}

/* ==== PAGE CONTENT ==== */
.page-header {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 20px 30px;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.page-content {
    padding: 30px;
}

/* ==== CARD / BOX ==== */
.card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

/* ==== TOOLBAR CRUD ==== */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

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

.btn-icon {
    padding: 8px 15px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-icon i {
    font-size: 13px;
}

/* ==== FILTRES ==== */
.filters {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
}

/* ==== TABLES ==== */
.table-container {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

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

.table thead {
    background: #fafafa;
    border-bottom: 1px solid #e0e0e0;
}

.table th {
    padding: 12px 15px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #333;
}

.table tbody tr:hover {
    background: #fafafa;
}

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

/* ==== ACTIONS TABLE ==== */
.table-actions {
    display: flex;
    gap: 8px;
}

.btn-action {
    padding: 5px 10px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-action:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.btn-action.btn-edit {
    color: #1976d2;
}

.btn-action.btn-delete {
    color: #d32f2f;
}

/* ==== MESSAGES ==== */
.message {
    padding: 12px 15px;
    border-radius: 3px;
    margin-bottom: 20px;
    font-size: 14px;
}

.message-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.message-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.message-info {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
}

/* ==== LOADING ==== */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.loading-spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f0f0f0;
    border-top-color: #333;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==== RESPONSIVE ==== */
@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filters {
        flex-direction: column;
    }
}

/* Correction dropdown actions - positionnement amélioré */

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: auto !important;*/
    left: 0 !important;*/
    top: 100%;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    min-width: 180px;
    max-width: 220px;
    z-index: 1000;
    margin-top: 5px;
}
/* === DROPDOWN FIX - Version forcée === */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    /* FORCER À GAUCHE */
    right: auto !important;
    left: 0 !important;
    top: 100%;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    min-width: 180px;
    max-width: 220px;
    z-index: 1000;
    margin-top: 5px;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 10px 12px;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-menu a:hover {
    background: #f8f9fa;
}

.dropdown-menu a i {
    margin-right: 8px;
    width: 16px;
    display: inline-block;
    text-align: center;
}

.dropdown-toggle {
    cursor: pointer;
}

/* Amélioration responsive */
@media (max-width: 768px) {
    .dropdown-menu {
        min-width: 150px;
        font-size: 14px;
    }
    
    .dropdown-menu a {
        padding: 8px 12px;
    }
}
