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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    opacity: 0.9;
    font-size: 1.1em;
}

/* Tabs */
.tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.tab {
    flex: 1;
    padding: 20px;
    border: none;
    background: transparent;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.tab:hover {
    background: #e9ecef;
}

.tab.active {
    background: white;
    border-bottom-color: #667eea;
    color: #667eea;
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 40px;
}

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

/* Info Box */
.info-box {
    background: #e7f3ff;
    border-left: 4px solid #2196F3;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 8px;
}

.info-box p {
    margin: 5px 0;
    line-height: 1.6;
}

/* Rule Card */
.rule-card {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    transition: all 0.3s;
}

.rule-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.rule-card.disabled {
    opacity: 0.6;
    background: #e9ecef;
}

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

.rule-title {
    font-size: 1.3em;
    font-weight: bold;
    color: #2d3748;
}

.rule-description {
    color: #6c757d;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 60px;
    height: 30px;
    background: #ccc;
    border-radius: 15px;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-switch.active {
    background: #28a745;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: left 0.3s;
}

.toggle-switch.active::after {
    left: 33px;
}

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

.form-label {
    display: block;
    font-weight: bold;
    color: #495057;
    margin-bottom: 8px;
}

.form-label-sub {
    display: block;
    font-size: 0.9em;
    color: #6c757d;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1em;
    transition: border 0.3s;
}

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

.input-with-unit {
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-with-unit input {
    flex: 1;
}

.input-unit {
    font-weight: bold;
    color: #6c757d;
}

/* Tags Input */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    min-height: 50px;
}

.tag {
    background: #667eea;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
}

.tag-remove {
    cursor: pointer;
    font-weight: bold;
}

.tag-input {
    flex: 1;
    border: none;
    outline: none;
    min-width: 150px;
    padding: 6px;
}

/* Buttons */
.actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-weight: bold;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

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

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

.btn-large {
    font-size: 1.3em;
    padding: 20px 50px;
}

/* Progress */
.progress-section {
    margin: 30px 0;
}

.progress-bar {
    width: 100%;
    height: 40px;
    background: #e9ecef;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    transition: width 0.3s;
}

#progress-text {
    text-align: center;
    color: #6c757d;
    font-size: 1.1em;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.stat-card {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    border: 2px solid #e9ecef;
}

.stat-number {
    font-size: 3em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

.stat-label {
    color: #6c757d;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Anomalies List */
#anomalies-list {
    margin-top: 30px;
}

.anomaly-card {
    background: white;
    border-left: 5px solid #dc3545;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.anomaly-card.COMMANDE_BLOQUEE {
    border-left-color: #dc3545;
}

.anomaly-card.INSTALLATION_MANQUANTE {
    border-left-color: #fd7e14;
}

.anomaly-card.COMMANDE_NON_PASSEE {
    border-left-color: #ffc107;
}

.anomaly-card.PRET_ENLEVEMENT_TROP_LONG {
    border-left-color: #17a2b8;
}

.anomaly-title {
    font-size: 1.2em;
    font-weight: bold;
    color: #2d3748;
    margin-bottom: 10px;
}

.anomaly-message {
    color: #495057;
    margin-bottom: 10px;
}

.anomaly-details {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 5px;
    font-size: 0.9em;
    color: #6c757d;
}

/* History List */
#history-list {
    margin-top: 30px;
}

.history-item {
    background: #f8f9fa;
    padding: 15px;
    border-left: 4px solid #667eea;
    border-radius: 5px;
    margin-bottom: 10px;
}

.history-date {
    font-size: 0.9em;
    color: #6c757d;
    margin-bottom: 5px;
}

.history-content {
    color: #2d3748;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    background: #28a745;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

.notification.error {
    background: #dc3545;
}

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

/* Responsive */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8em;
    }

    .tabs {
        flex-direction: column;
    }

    .tab {
        border-bottom: 1px solid #e9ecef;
        border-left: 3px solid transparent;
    }

    .tab.active {
        border-bottom-color: #e9ecef;
        border-left-color: #667eea;
    }

    .rule-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

