/* Variables pour la cohérence des couleurs et la maintenabilité */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #4CAF50;
    --secondary-hover: #45a049;
    --background-color: #ffffff;
    --border-color: #e5e7eb;
    --text-color: #1f2937;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --radius-md: 0.375rem;
}

/* Reset et styles de base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Style pour le conteneur principal */
.creances-douteuses-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.25rem;
    background-color: var(--background-color);
    font-family: system-ui, -apple-system, sans-serif;
}

/* Style pour le titre */
.cd-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 2rem;
    text-align: center;
}

/* Style pour les champs des années */
.cd-years-input {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.cd-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cd-input-group label {
    font-weight: 500;
    color: var(--text-color);
}

.cd-input-group input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    width: 150px;
    transition: all 0.2s;
}

.cd-input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* Style pour les tableaux */
.cd-table-container {
    background-color: var(--background-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.cd-table-scroll {
    overflow-x: auto;
    border-radius: var(--radius-md);
}

.cd-table, .cd-result-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 1000px;
}

.cd-table th,
.cd-table td,
.cd-result-table th,
.cd-result-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.cd-table th,
.cd-result-table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
}

.cd-table input,
.cd-table select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.cd-table input:focus,
.cd-table select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* Style pour les champs de provision */
.provision-group {
    display: flex;
    gap: 0.5rem;
}

.provision-pct,
.provision-mnt {
    flex: 1;
}

/* Style pour les boutons */
.cd-buttons-container {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    background-color: #f8fafc;
    border-top: 1px solid var(--border-color);
}

.cd-button,
.cd-button-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    gap: 0.5rem;
}

.cd-button {
    background-color: var(--secondary-color);
    color: white;
}

.cd-button:hover {
    background-color: var(--secondary-hover);
}

.cd-button-secondary {
    background-color: var(--primary-color);
    color: white;
}

.cd-button-secondary:hover {
    background-color: var(--primary-hover);
}

/* Style pour le bouton de suppression */
.cd-delete-row {
    background-color: #ef4444;
    color: white;
    border: none;
    border-radius: var(--radius-md);
    width: 28px;
    height: 28px;
    font-size: 1.125rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.cd-delete-row:hover {
    background-color: #dc2626;
    transform: scale(1.05);
}

/* Style pour les résultats */
.cd-results-container {
    background-color: var(--background-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-top: 2rem;
    animation: fadeIn 0.3s ease-in-out;
}

.cd-results-container h3 {
    padding: 1rem 1.25rem;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    background-color: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.cd-totals {
    font-weight: 600;
    background-color: #f8fafc;
}

/* Style pour le spinner */
.cd-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
    display: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive design */
@media screen and (max-width: 768px) {
    .cd-years-input {
        flex-direction: column;
        align-items: stretch;
    }

    .cd-input-group input {
        width: 100%;
    }

    .cd-buttons-container {
        flex-direction: column;
    }

    .cd-button,
    .cd-button-secondary {
        width: 100%;
    }

    .provision-group {
        flex-direction: column;
    }
}