:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #16a085;
    --light-bg: #ecf0f1;
    --dark-bg: #34495e;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px 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;
    /* Remplacement du dégradé violet par un dégradé bleu nuit/bleu pro */
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--box-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

header h1 {
    color: var(--primary-color);
    font-size: 1.8rem;
}

header h1 i {
    color: var(--secondary-color);
    margin-right: 10px;
}

/* Stats Bar */
.stats-bar {
    background: white;
    border-radius: var(--border-radius);
    padding: 15px 20px;
    margin-bottom: 20px;
    box-shadow: var(--box-shadow);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.stat-card {
    text-align: center;
    padding: 10px;
    border-radius: var(--border-radius);
    background: var(--light-bg);
}

.stat-card i {
    font-size: 2rem;
    color: var(--secondary-color);
    margin-bottom: 5px;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: #666;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--secondary-color);
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52,152,219,0.3);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #219a52;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-info {
    background: #16a085;
    color: white;
}
 
.btn-info:hover {
    background: #138d75;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(22, 160, 133, 0.3);
}

/* Main Layout */
.main-content {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    min-height: 600px;
}

/* Sidebar */
.sidebar {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--box-shadow);
}

.search-box {
    position: relative;
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 10px 35px 10px 15px;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.search-box i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.armoires-list {
    max-height: 500px;
    overflow-y: auto;
}

.armoire-item {
    padding: 15px;
    margin-bottom: 10px;
    background: var(--light-bg);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    border-left: 4px solid transparent;
}

.armoire-item:hover {
    background: #e0e0e0;
    transform: translateX(5px);
}

.armoire-item.active {
    background: linear-gradient(135deg, var(--secondary-color), #2980b9);
    color: white;
    border-left-color: var(--primary-color);
}

.armoire-item h3 {
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.armoire-item p {
    font-size: 0.85rem;
    opacity: 0.8;
}

.armoire-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

/* Content Area */
.content {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--box-shadow);
}

.content-area {
    min-height: 500px;
}

.welcome-message {
    text-align: center;
    padding: 100px 20px;
}

.welcome-message i {
    font-size: 4rem;
    color: var(--secondary-color);
    margin-bottom: 20px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
}

/* Armoire Header */
.armoire-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--light-bg);
}

.armoire-header h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.armoire-header-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Rails Section */
.rails-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.rail-card {
    background: var(--light-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
}

.rail-card:hover {
    box-shadow: var(--box-shadow);
}

.rail-header {
    background: var(--primary-color);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
}

.rail-header:hover {
    background: var(--dark-bg);
}

.rail-title {
    font-weight: bold;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.rail-actions {
    display: flex;
    gap: 10px;
}

.btn-icon {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: var(--transition);
}

.btn-icon:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.1);
}

.components-list {
    padding: 15px;
    max-height: 500px;
    overflow-y: auto;
}

.component-item {
    background: white;
    border-radius: var(--border-radius);
    padding: 12px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid;
    transition: var(--transition);
    animation: slideIn 0.3s ease;
}

.component-item:hover {
    transform: translateX(5px);
    box-shadow: var(--box-shadow);
}

.component-phase-monophase {
    border-left-color: #3498db;
}

.component-phase-triphase {
    border-left-color: #e74c3c;
}

.component-phase-tetrapolaire {
    border-left-color: #f39c12;
}

.component-info {
    flex: 1;
}

.component-name {
    font-weight: bold;
    font-size: 1rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.component-details {
    font-size: 0.85rem;
    color: #666;
    margin-top: 4px;
}

.component-details i {
    margin-right: 5px;
}

.component-actions {
    display: flex;
    gap: 8px;
}

.phase-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: bold;
}

.phase-monophase {
    background: #3498db;
    color: white;
}

.phase-triphase {
    background: #e74c3c;
    color: white;
}

.phase-tetrapolaire {
    background: #f39c12;
    color: white;
}

.type-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    background: #95a5a6;
    color: white;
}

.empty-component {
    text-align: center;
    padding: 20px;
    color: #999;
    font-style: italic;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 600px;
    animation: slideIn 0.3s;
}

.modal-small {
    max-width: 400px;
}

.modal-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--dark-bg));
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.close:hover {
    transform: scale(1.2);
}

.modal-body {
    padding: 20px;
}

/* Formulaires */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--primary-color);
}

.form-group label i {
    margin-right: 5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52,152,219,0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: var(--border-radius);
    color: white;
    z-index: 2000;
    animation: slideInRight 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--box-shadow);
}

.notification-success {
    background: var(--success-color);
}

.notification-error {
    background: var(--danger-color);
}

.notification-info {
    background: var(--info-color);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,0,0,0.1);
    border-radius: 50%;
    border-top-color: var(--secondary-color);
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        max-height: 300px;
        overflow-y: auto;
    }
    
    .component-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .component-actions {
        margin-top: 10px;
        width: 100%;
        justify-content: flex-end;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-bar {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #2980b9;
}

/* ============ GESTION COMPLÈTE DES COULEURS D'ICÔNES ============ */

/* Variables globales pour les couleurs */
:root {
    --icon-default: #2c3e50;
    --icon-hover: #3498db;
    --icon-edit: #f39c12;
    --icon-delete: #e74c3c;
    --icon-add: #27ae60;
    --icon-save: #3498db;
    --icon-cancel: #95a5a6;
    --icon-monophase: #3498db;
    --icon-triphase: #e74c3c;
    /* Remplacement de la couleur tétrapolaire violette par de l'orange/warning */
    --icon-tetrapolaire: #f39c12;
}

/* Couleurs de base */
i, .fas, .far {
    color: var(--icon-default);
    transition: all 0.3s ease;
}

/* Icônes blanches UNIQUEMENT dans les boutons colorés */
.btn-primary i,
.btn-success i,
.btn-danger i,
.btn-warning i {
    color: white;
}

/* Icônes par défaut dans les autres cas */
.btn i,
.btn-icon i {
    color: var(--icon-default);
}

/* Icônes d'action */
.fa-edit { color: var(--icon-edit); }
.fa-trash-alt, .fa-trash { color: var(--icon-delete); }
.fa-plus { color: var(--icon-add); }
.fa-save { color: var(--icon-save); }
.fa-times, .fa-ban { color: var(--icon-cancel); }

/* Icônes de phase */
.fa-bolt {
    color: var(--icon-monophase);
}

.component-phase-triphase .fa-bolt {
    color: var(--icon-triphase);
}

.component-phase-tetrapolaire .fa-bolt {
    color: var(--icon-tetrapolaire);
}

/* Icônes au survol */
.btn-icon:hover i {
    transform: scale(1.2);
}

.fa-edit:hover { color: #e67e22; }
.fa-trash:hover { color: #c0392b; }
.fa-plus:hover { color: #219a52; }

/* Icônes dans les statistiques */
.stat-card i {
    font-size: 2rem;
    color: var(--icon-default);
}

.stat-card:hover i {
    color: var(--icon-hover);
    transform: scale(1.1);
}

/* Icônes dans l'en-tête */
header h1 i {
    font-size: 2rem;
    /* Remplacement du dégradé de texte violet par le dégradé bleu nuit/bleu du thème */
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Icônes dans les rails */
.rail-header i {
    color: white;
}

/* Icônes dans les composants */
.component-details i {
    font-size: 0.8rem;
    margin-right: 5px;
}

.component-details i.fa-bolt {
    color: var(--icon-monophase);
}

.component-details i.fa-charging-station {
    color: var(--icon-add);
}

/* Animation au survol */
i, .fas, .far {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon:hover i {
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}