* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: #f0f2f5;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    background: linear-gradient(135deg, #1e2b4f 0%, #2a3f6e 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.header-left h1 {
    font-size: 26px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.enterprise-badge {
    background: linear-gradient(135deg, #ffd700, #ffa500);
    color: #1e2b4f;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 20px;
    margin-left: 10px;
    font-weight: bold;
    text-transform: uppercase;
}

.stats-header {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.badge {
    background: rgba(255,255,255,0.15);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 13px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.1);
    cursor: pointer;
    transition: all 0.3s;
}

.badge:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.05);
}

.badge-corbeille {
    background: rgba(255, 71, 87, 0.3);
}

.badge-corbeille:hover {
    background: rgba(255, 71, 87, 0.5);
}

.header-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-box {
    background: white;
    border-radius: 30px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 350px;
}

.search-box i {
    color: #1e2b4f;
    font-size: 16px;
}

.search-box input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 14px;
}

.btn-refresh {
    background: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    color: #1e2b4f;
    transition: all 0.3s;
    font-size: 18px;
}

.btn-refresh:hover {
    transform: rotate(180deg);
    background: #f0f0f0;
}

.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 10px;
    color: white;
    z-index: 1000;
    animation: slideIn 0.3s;
    display: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

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

.message.success { background: #28a745; }
.message.error { background: #ff4757; }
.message.info { background: #17a2b8; }
.message.warning { background: #ff9800; }

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab {
    padding: 12px 20px;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.tab i {
    font-size: 16px;
}

.tab:hover {
    background: #1e2b4f;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(30,43,79,0.3);
}

.tab.active {
    background: #1e2b4f;
    color: white;
}

.tab-warning {
    background: #fff3e0;
    color: #ff9800;
}

.tab-warning:hover {
    background: #ff9800;
    color: white;
}

.badge-tab {
    background: rgba(0,0,0,0.1);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    margin-left: 5px;
}

.tab.active .badge-tab {
    background: rgba(255,255,255,0.2);
}

.badge-alert {
    background: #ff4757;
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    margin-left: 5px;
    animation: clignoter 1.5s infinite;
}

.tab-content {
    display: none;
}

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

.section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #1e2b4f;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    font-size: 18px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-warning .section-header {
    border-bottom: 2px solid #ff9800;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.form-group {
    margin-bottom: 15px;
}

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

.form-group .required {
    color: #ff4757;
    margin-left: 3px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1e2b4f;
    box-shadow: 0 0 0 3px rgba(30,43,79,0.1);
}

.form-group input.readonly {
    background: #f8f9fa;
    cursor: not-allowed;
}

.full-width {
    grid-column: 1 / -1;
}

button {
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    font-size: 13px;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40,167,69,0.3);
}

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

.btn-warning:hover {
    background: #f57c00;
    transform: translateY(-2px);
}

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

.btn-danger:hover {
    background: #ee3e4e;
    transform: translateY(-2px);
}

.btn-export {
    background: #17a2b8;
    color: white;
}

.btn-export:hover {
    background: #138496;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-action {
    padding: 5px 10px;
    font-size: 11px;
    margin: 2px;
    border-radius: 5px;
}

.btn-action i {
    font-size: 12px;
}

.btn-action.btn-success { background: #28a745; }
.btn-action.btn-warning { background: #ff9800; }
.btn-action.btn-danger { background: #ff4757; }
.btn-action.btn-info { background: #17a2b8; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 5px 15px rgba(102,126,234,0.3);
    transition: all 0.3s;
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(102,126,234,0.4);
}

.stat-blue { background: linear-gradient(135deg, #2193b0, #6dd5ed); }
.stat-green { background: linear-gradient(135deg, #11998e, #38ef7d); }
.stat-orange { background: linear-gradient(135deg, #f2994a, #f2c94c); }
.stat-purple { background: linear-gradient(135deg, #834d9b, #d04ed6); }
.stat-red { background: linear-gradient(135deg, #eb3349, #f45c43); }
.stat-cyan { background: linear-gradient(135deg, #00b4db, #0083b0); }
.stat-gold { background: linear-gradient(135deg, #bb8c2c, #e6b800); }
.stat-yellow { background: linear-gradient(135deg, #f7971e, #ffd200); }

.stat-icon {
    font-size: 42px;
    opacity: 0.8;
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 26px;
    font-weight: bold;
    display: block;
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-container {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    max-height: 500px;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
}

th {
    background: #1e2b4f;
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 500;
    font-size: 13px;
    position: sticky;
    top: 0;
    z-index: 10;
}

td {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 13px;
}

tr:hover {
    background: #f8f9fa;
}

tr.expire {
    background: #ffebee;
    border-left: 4px solid #ff4757;
}

tr.expire:hover {
    background: #ffcdd2;
}

tr.bientot {
    background: #fff3e0;
    border-left: 4px solid #ff9800;
}

tr.bientot:hover {
    background: #ffe0b2;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
    text-align: center;
}

.status-badge.actif { background: #28a745; color: white; }
.status-badge.stock { background: #17a2b8; color: white; }
.status-badge.maintenance { background: #ff9800; color: white; }
.status-badge.casse { background: #ff4757; color: white; }
.status-badge.expire { background: #ff4757; color: white; }
.status-badge.bientot { background: #ff9800; color: white; }
.status-badge.ok { background: #28a745; color: white; }

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1001;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 500px;
    border-radius: 15px;
    padding: 25px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-content.modal-large {
    max-width: 900px;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
}

.modal-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 4px solid #1e2b4f;
    line-height: 1.8;
}

.modal-info p {
    margin: 8px 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.modal-info strong {
    color: #1e2b4f;
    width: 150px;
    display: inline-block;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    flex-wrap: wrap;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 14px;
}

.loading:after {
    content: '...';
    animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {
    0%,20% { content: '.'; }
    40% { content: '..'; }
    60%,100% { content: '...'; }
}

.search-mini {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    width: 250px;
    font-size: 13px;
}

.filter-group {
    display: flex;
    gap: 10px;
}

.filter-group select {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 13px;
    background: white;
}

/* Alertes et notifications */
.alertes-ticker {
    background: #ff4757;
    color: white;
    padding: 8px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-weight: bold;
    display: none;
}

.alertes-ticker marquee {
    color: white;
}

.alert-banner {
    background: linear-gradient(135deg, #ff4757, #ff6b81);
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    animation: pulse 2s infinite;
    box-shadow: 0 4px 15px rgba(255,71,87,0.3);
}

.alert-banner i {
    font-size: 24px;
}

.alert-banner span {
    flex: 1;
    font-weight: 500;
}

/* Stock */
.stock-danger {
    background-color: rgba(255, 71, 87, 0.2);
    font-weight: bold;
    color: #ff4757;
}

.stock-warning {
    background-color: rgba(255, 152, 0, 0.2);
    font-weight: bold;
    color: #ff9800;
}

.stock-ok {
    color: #28a745;
}

/* Animations */
@keyframes clignoter {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.9; box-shadow: 0 4px 20px rgba(255,71,87,0.5); }
    100% { opacity: 1; }
}

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

/* Responsive design */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        width: 100%;
    }
    
    .grid-2 {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .stat-icon {
        font-size: 32px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .table-container {
        font-size: 12px;
    }
    
    .btn-action {
        padding: 4px 6px;
        font-size: 10px;
    }
}

/* Amélioration des boutons dans les tableaux */
.actions-cell {
    min-width: 200px;
    white-space: nowrap;
    text-align: center;
}

.btn-action {
    padding: 6px 10px;
    margin: 2px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.btn-action i {
    margin-right: 3px;
    font-size: 12px;
}

.btn-action.btn-success { 
    background: #28a745; 
    color: white; 
}
.btn-action.btn-success:hover { 
    background: #218838; 
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(40,167,69,0.3);
}

.btn-action.btn-info { 
    background: #17a2b8; 
    color: white; 
}
.btn-action.btn-info:hover { 
    background: #138496; 
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(23,162,184,0.3);
}

.btn-action.btn-warning { 
    background: #ff9800; 
    color: white; 
}
.btn-action.btn-warning:hover { 
    background: #f57c00; 
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255,152,0,0.3);
}

.btn-action.btn-danger { 
    background: #dc3545; 
    color: white; 
}
.btn-action.btn-danger:hover { 
    background: #c82333; 
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220,53,69,0.3);
}

.btn-action.btn-cyan {
    background: #17a2b8;
    color: white;
}

.btn-action.btn-cyan:hover {
    background: #138496;
}

.btn-action:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Badges supplémentaires */
.badge-history {
    background: #17a2b8;
    color: white;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 10px;
    margin-left: 5px;
}

/* Tooltip */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]:before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 1000;
}

[data-tooltip]:hover:before {
    opacity: 1;
    visibility: visible;
    bottom: 150%;
}

/* Indicateur de statut */
.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

.status-indicator.vert { background: #28a745; box-shadow: 0 0 10px #28a745; }
.status-indicator.jaune { background: #ffd700; box-shadow: 0 0 10px #ffd700; }
.status-indicator.orange { background: #ff9800; box-shadow: 0 0 10px #ff9800; }
.status-indicator.rouge { background: #ff4757; box-shadow: 0 0 10px #ff4757; }

/* Cartes de stock */
.stock-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stock-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-left: 5px solid;
    transition: all 0.3s;
}

.stock-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.stock-card.alerte-rouge {
    border-left-color: #ff4757;
    background: #ffebee;
}

.stock-card.alerte-orange {
    border-left-color: #ff9800;
    background: #fff3e0;
}

.stock-card.alerte-jaune {
    border-left-color: #ffd700;
    background: #fff9e6;
}

.stock-card.alerte-vert {
    border-left-color: #28a745;
}

.stock-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.stock-card-header h3 {
    font-size: 18px;
    color: #333;
    margin: 0;
}

.stock-card-header .stock-badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.stock-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stock-stat {
    text-align: center;
}

.stock-stat .stat-value {
    font-size: 24px;
    font-weight: bold;
    display: block;
    color: #1e2b4f;
}

.stock-stat .stat-label {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
}

.stock-progress {
    grid-column: span 2;
    margin-top: 15px;
}

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

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    border-radius: 5px;
    transition: width 0.3s ease;
}

.progress-fill.alerte-rouge {
    background: linear-gradient(90deg, #ff4757, #ff6b81);
}

.progress-fill.alerte-orange {
    background: linear-gradient(90deg, #ff9800, #ffb74d);
}

.stock-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-commande {
    background: #1e2b4f;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
}

.btn-commande:hover {
    background: #2a3f6e;
}


/* Styles pour les formulaires SIM multiples */
.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.badge-info {
    background: #17a2b8;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
}

.tab-btn {
    padding: 10px 20px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.tab-btn.active {
    background: #1e2b4f;
    color: white;
    border-color: #1e2b4f;
}

.tab-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: monospace;
    font-size: 13px;
    resize: vertical;
}

textarea:focus {
    outline: none;
    border-color: #1e2b4f;
    box-shadow: 0 0 0 3px rgba(30,43,79,0.1);
}

.search-mini {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    min-width: 250px;
    font-size: 13px;
}

.search-mini:focus {
    outline: none;
    border-color: #1e2b4f;
    box-shadow: 0 0 0 2px rgba(30,43,79,0.1);
}

/* Amélioration des badges cliquables */
.status-badge {
    cursor: pointer;
    transition: all 0.2s;
}

.status-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Style pour les lignes de tableau */
tr[data-sim-id] {
    transition: background 0.2s;
}

tr[data-sim-id]:hover {
    background: #f0f7ff;
}

/* Animation pour les boutons */
.btn-action {
    transition: all 0.2s;
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Tooltip amélioré */
[title] {
    position: relative;
}

[title]:hover:after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

/* Badge pour les compteurs */
.badge {
    transition: all 0.2s;
}

.badge:hover {
    transform: scale(1.05);
}
