* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    text-align: center;
}

.header h1 {
    color: #2c3e50;
    font-size: 2.5em;
    margin-bottom: 10px;
}

.header p {
    color: #7f8c8d;
    font-size: 1.1em;
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.nav-card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    border: 3px solid transparent;
}

.nav-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
    border-color: #667eea;
}

.nav-card.machine { border-left: 5px solid #3498db; }
.nav-card.sechoir { border-left: 5px solid #e74c3c; }
.nav-card.calandre { border-left: 5px solid #f39c12; }
.nav-card.repassage { border-left: 5px solid #9b59b6; }
.nav-card.arret { border-left: 5px solid #e67e22; }
.nav-card.nc { border-left: 5px solid #c0392b; }
.nav-card.trs { border-left: 5px solid #27ae60; }

.nav-card-icon {
    font-size: 3em;
    margin-bottom: 15px;
    opacity: 0.8;
}

.nav-card h3 {
    color: #2c3e50;
    font-size: 1.4em;
    margin-bottom: 10px;
}

.nav-card p {
    color: #7f8c8d;
    line-height: 1.4;
}

.page {
    display: none;
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    animation: fadeIn 0.5s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #ecf0f1;
}

.page-title {
    color: #2c3e50;
    font-size: 2em;
}

.back-btn {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
}

.form-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 25px;
    border-left: 4px solid #3498db;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 8px;
}

.form-group input, .form-group select, .form-group textarea {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.btn-group {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 13px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-primary { background: #3498db; color: white; }
.btn-success { background: #27ae60; color: white; }
.btn-warning { background: #f39c12; color: white; }
.btn-danger { background: #e74c3c; color: white; }
.btn-secondary { background: #95a5a6; color: white; }

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.status-display {
    background: #e8f5e8;
    border: 2px solid #27ae60;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 25px;
}

.status-display.running {
    background: #e3f2fd;
    border-color: #2196f3;
}

.status-display.paused {
    background: #fff3e0;
    border-color: #ff9800;
}

.status-display.stopped {
    background: #ffebee;
    border-color: #f44336;
}

.timer-display {
    font-size: 2em;
    font-weight: bold;
    color: #2c3e50;
    text-align: center;
    margin: 20px 0;
}

.program-info {
    background: #f0f8ff;
    border: 2px solid #3498db;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.program-info h4 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: white;
    border-radius: 8px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.data-table th, .data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.data-table th {
    background: #34495e;
    color: white;
    font-weight: 600;
}

.data-table tr:nth-child(even) {
    background: #f8f9fa;
}

.data-table tr:hover {
    background: #e3f2fd;
}

.auth-container {
    max-width: 400px;
    margin: 100px auto;
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    text-align: center;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.kpi-value {
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 10px;
}

.kpi-label {
    font-size: 1.1em;
    opacity: 0.9;
}

.filter-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    border: 2px solid #e9ecef;
}

.hidden {
    display: none !important;
}

.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

@media (max-width: 768px) {
    .nav-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .page-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .machines-grid {
        grid-template-columns: 1fr;
    }
    
    .machine-card {
        margin-bottom: 20px;
    }
}

/* Multi-Machine Layout */
.machines-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.machine-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.machine-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
}

.machine-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f8f9fa;
}

.machine-header h3 {
    color: #2c3e50;
    font-size: 1.3em;
    margin: 0;
}

.machine-status-indicator {
    font-size: 1.5em;
    color: #6c757d;
    transition: color 0.3s ease;
}

.machine-card .form-section {
    background: #f8f9fa;
    border-left: 4px solid #3498db;
    margin-bottom: 20px;
}

.machine-card .status-display {
    margin-bottom: 20px;
}

.machine-card .btn-group {
    gap: 10px;
}

.machine-card .btn {
    padding: 8px 12px;
    font-size: 0.9em;
}

/* Status colors for machine indicators */
.machine-status-indicator.running {
    color: #28a745;
}

.machine-status-indicator.paused {
    color: #ffc107;
}

.machine-status-indicator.stopped {
    color: #6c757d;
}

/* Responsive adjustments for machine cards */
@media (max-width: 1200px) {
    .machines-grid {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    }
}

@media (max-width: 768px) {
    .machines-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .machine-card {
        padding: 15px;
    }
    
    .machine-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}
