/* Calculateur de Barreaudage - Styles Frontend */

#barreaudage-calculator {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* En-tête */
.calculator-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #639ca7 0%, #4a7c89 100%);
    border-radius: 8px;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.calculator-header h2 {
    margin: 0 0 10px 0;
    font-size: 24px;
    font-weight: 600;
}

.calculator-header p {
    margin: 0;
    opacity: 0.9;
}

/* Groupes de champs */
.form-group {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #639ca7;
    transition: all 0.3s ease;
}

.form-group:hover {
    background: #f1f3f4;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.form-group label i {
    margin-right: 8px;
    color: #639ca7;
}

.form-group input[type="number"] {
    width: 200px;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
}

.form-group input[type="number"]:focus {
    border-color: #639ca7;
    box-shadow: 0 0 0 3px rgba(99, 156, 167, 0.1);
    outline: none;
}

.unit {
    margin-left: 10px;
    color: #666;
    font-weight: 500;
    font-size: 14px;
}

.help-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* Labels avec toggle */
.toggle-label {
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    padding: 10px 0;
}

.toggle-label input[type="checkbox"] {
    margin-right: 10px;
    transform: scale(1.2);
}

/* Conteneurs d'options */
#fixation-container, #barreau-container {
    margin-top: 15px;
    padding: 20px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.fixation-option {
    margin-bottom: 15px;
}

.separator {
    text-align: center;
    margin: 15px 0;
    font-weight: bold;
    color: #639ca7;
    position: relative;
}

.separator::before,
.separator::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: #ddd;
}

.separator::before {
    left: 0;
}

.separator::after {
    right: 0;
}

/* Boutons radio personnalisés */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
    border: 1px solid #e1e5e9;
}

.radio-label:hover {
    background: #f8f9fa;
    border-color: #639ca7;
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
    transition: all 0.3s ease;
}

.radio-label input[type="radio"]:checked + .radio-custom {
    border-color: #639ca7;
    background: #639ca7;
}

.radio-label input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

.radio-label.warning {
    border-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.05);
}

.warning-text {
    color: #ff6b6b;
    font-weight: 500;
}

/* Boutons d'action */
.form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    padding: 20px 0;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-success {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #218838, #1c9f7a);
}

.btn-primary {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
}

/* Alertes */
.alert {
    padding: 16px 20px;
    margin-bottom: 20px;
    border-radius: 6px;
    border-left: 4px solid;
}

.alert-warning {
    background: #fff3cd;
    border-left-color: #ffc107;
    color: #856404;
}

.alert-success {
    background: #d4edda;
    border-left-color: #28a745;
    color: #155724;
}

.alert-info {
    background: #cce7ff;
    border-left-color: #007bff;
    color: #004085;
}

/* Sections de codes d'accès */
.access-code-section,
.purchase-section {
    margin: 20px 0;
    padding: 20px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
}

.access-code-section h4,
.purchase-section h4 {
    margin-top: 0;
    color: #333;
}

#access-code {
    width: 343px;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    font-family: monospace;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Section des résultats */
.results-section {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    padding: 25px;
    border-radius: 8px;
    margin: 30px 0;
    border-left: 5px solid #28a745;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.results-section h3 {
    margin-top: 0;
    color: #155724;
    font-size: 22px;
}

.result-summary p {
    margin: 10px 0;
    font-size: 15px;
}

.result-summary strong {
    color: #155724;
}

/* Tableaux */
.positions-table,
.calculations-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.positions-table th,
.positions-table td,
.calculations-table th,
.calculations-table td {
    border: none;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e1e5e9;
}

.positions-table th,
.calculations-table th {
    background: #639ca7;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.positions-table tr:nth-child(even),
.calculations-table tr:nth-child(even) {
    background: #f8f9fa;
}

.positions-table tr:hover,
.calculations-table tr:hover {
    background: #e8f4f8;
}

.table-responsive {
    overflow-x: auto;
    margin: 20px 0;
}

/* Section des calculs récents */
.recent-section {
    margin-top: 40px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 8px;
    border-top: 4px solid #639ca7;
}

.recent-section h3 {
    margin-top: 0;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.recent-section h3 i {
    color: #639ca7;
}

/* Options dans le tableau */
.option-plus {
    background: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.option-minus {
    background: #dc3545;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.option-none {
    background: #6c757d;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.warning {
    color: #dc3545 !important;
    font-weight: bold;
}

/* Section d'impression */
.print-section {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px dashed #639ca7;
}

/* Responsive */
@media (max-width: 768px) {
    #barreaudage-calculator {
        padding: 15px;
    }
    
    .calculator-header {
        padding: 15px;
    }
    
    .calculator-header h2 {
        font-size: 20px;
    }
    
    .form-group {
        padding: 15px;
    }
    
    .form-group input[type="number"] {
        width: 100%;
        max-width: 300px;
    }
    
    #access-code {
        width: 100%;
        max-width: 250px;
    }
    
    .form-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 200px;
        justify-content: center;
    }
    
    .table-responsive {
        font-size: 14px;
    }
    
    .positions-table th,
    .positions-table td,
    .calculations-table th,
    .calculations-table td {
        padding: 8px 10px;
    }
    
    .radio-group {
        gap: 8px;
    }
    
    .radio-label {
        padding: 10px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .calculator-header h2 {
        font-size: 18px;
    }
    
    .form-group {
        padding: 12px;
    }
    
    .results-section {
        padding: 15px;
    }
    
    .recent-section {
        padding: 15px;
    }
    
    .positions-table,
    .calculations-table {
        font-size: 12px;
    }
    
    .positions-table th,
    .positions-table td,
    .calculations-table th,
    .calculations-table td {
        padding: 6px 8px;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#calculation-results {
    animation: slideIn 0.5s ease-out;
}

.form-group {
    animation: fadeIn 0.3s ease-out;
}

/* États de chargement */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn:disabled:hover {
    transform: none !important;
}

/* Messages d'erreur et de succès */
.error-message {
    color: #dc3545;
    font-size: 14px;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.success-message {
    color: #28a745;
    font-size: 14px;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Styles d'impression */
@media print {
    .sans_pour_impression,
    .calculator-header p,
    .form-actions,
    .recent-section,
    #calculator-form,
    .access-code-section,
    .purchase-section {
        display: none !important;
    }
    
    #barreaudage-calculator {
        max-width: none;
        padding: 0;
    }
    
    .results-section {
        background: white !important;
        box-shadow: none !important;
        border: 1px solid #000;
        page-break-inside: avoid;
    }
    
    .positions-table,
    .calculations-table {
        page-break-inside: avoid;
    }
    
    .positions-table th,
    .calculations-table th {
        background: #f0f0f0 !important;
        color: black !important;
    }
}