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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Amélioration de la zone de toucher pour les petits éléments */
a, button, input, select, textarea {
    min-height: 44px;
    min-width: 44px;
}

input[type="date"],
input[type="number"],
input[type="text"],
textarea,
select {
    font-size: 16px; /* Empêche le zoom automatique sur iOS */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navbar */
.navbar {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Language Selector */
.language-selector {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.lang-btn {
    padding: 0.4rem 0.8rem;
    border: 2px solid transparent;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
    font-weight: 500;
}

.lang-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.lang-btn.active {
    background-color: #3498db;
    border-color: #3498db;
    font-weight: 600;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    flex-wrap: wrap;
    width: 100%;
    justify-content: center;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
    font-size: 0.9rem;
    white-space: nowrap;
}

.nav-link:hover {
    background-color: #34495e;
}

.nav-link.active {
    background-color: #3498db;
}

/* Main Content */
.main-content {
    margin-top: 2rem;
    padding-bottom: 3rem;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h2 {
    color: #2c3e50;
}

/* Alerts */
#alerts {
    margin-bottom: 1rem;
}

.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-success {
    background-color: #27ae60;
    color: white;
}

.btn-success:hover {
    background-color: #229954;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

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

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Forms */
.form-container {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.form-container.hidden {
    display: none;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #2c3e50;
    font-size: 1rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    padding-right: 2.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.form-actions .btn {
    flex: 1;
    min-width: 120px;
}

/* Tables */
.table-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.table-container::after {
    content: '← Faites défiler →';
    position: sticky;
    right: 0;
    bottom: 0;
    background: linear-gradient(to left, rgba(255,255,255,0.95), transparent);
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    color: #7f8c8d;
    text-align: right;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

@media (max-width: 768px) {
    .table-container::after {
        opacity: 1;
    }
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.data-table thead {
    background-color: #34495e;
    color: white;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    font-size: 0.95rem;
}

.data-table th {
    white-space: nowrap;
}

.data-table tbody tr {
    border-bottom: 1px solid #ecf0f1;
    transition: background-color 0.2s;
}

.data-table tbody tr:hover {
    background-color: #f8f9fa;
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.table-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    min-width: 150px;
}

/* Dossier Selector */
.dossier-selector {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.dossier-selector h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

#current-dossier-info {
    padding: 1rem;
    background-color: #ecf0f1;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.no-selection {
    color: #7f8c8d;
    font-style: italic;
}

.dossier-info-content {
    color: #2c3e50;
}

.dossier-info-content strong {
    display: block;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.dossier-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.dossier-actions select {
    flex: 1;
}

/* Summary Section */
.summary-section {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.summary-section h3 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

.totals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.total-card {
    padding: 1.5rem;
    background-color: #ecf0f1;
    border-radius: 4px;
    border-left: 4px solid #3498db;
}

.total-card-label {
    font-weight: 500;
    color: #7f8c8d;
    margin-bottom: 0.5rem;
}

.total-card-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
}

.total-general {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-top: 2rem;
}

.total-general h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.total-general-card {
    padding: 2rem;
    background-color: #27ae60;
    color: white;
    border-radius: 4px;
    text-align: center;
}

.total-general-card .amount {
    font-size: 2.5rem;
    font-weight: 700;
}

/* Calcul Page */
.calcul-results {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.calcul-results h3 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

.dossier-info {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .navbar {
        padding: 0.75rem 0;
    }

    .navbar .container {
        flex-direction: column;
        gap: 0.75rem;
    }

    .logo {
        font-size: 1.25rem;
        text-align: center;
        width: 100%;
    }

    .language-selector {
        justify-content: center;
    }

    .nav-menu {
        gap: 0.25rem;
        padding: 0;
    }

    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    .main-content {
        margin-top: 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .page-header h2 {
        font-size: 1.5rem;
    }

    .page-header .btn {
        width: 100%;
    }

    .page-header-actions {
        width: 100%;
    }

    .page-header-actions .btn {
        flex: 1;
        min-width: 0;
    }

    .dossier-actions {
        flex-direction: column;
        width: 100%;
    }

    .dossier-actions select,
    .dossier-actions button {
        width: 100%;
    }

    .form-container {
        padding: 1rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    .totals-grid {
        grid-template-columns: 1fr;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }

    .table-actions {
        flex-direction: column;
        gap: 0.25rem;
    }

    .table-actions .btn {
        width: 100%;
        text-align: center;
    }

    .dossier-selector,
    .summary-section,
    .calcul-results,
    .dossier-info {
        padding: 1rem;
    }

    .total-card {
        padding: 1rem;
    }

    .total-general {
        padding: 1rem;
    }

    .total-general-card {
        padding: 1.5rem;
    }

    .total-general-card .amount {
        font-size: 2rem;
    }

    .alert {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    /* Calcul page responsive */
    .total-general-section {
        margin-bottom: 1.5rem;
    }

    .total-general-card-main {
        padding: 1.5rem;
    }

    .total-amount-large {
        font-size: 2rem;
    }

    .card-header {
        padding: 1rem;
        font-size: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .calcul-table th,
    .calcul-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }

    .calcul-table th:first-child,
    .calcul-table td:first-child {
        display: none;
    }

    .dossier-alert {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .progress-header {
        font-size: 0.85rem;
    }

    .progress-bar-container {
        height: 25px;
    }

    .calcul-empty {
        padding: 3rem 1rem;
    }

    .calcul-empty .icon {
        font-size: 3rem;
    }

    .calcul-empty h5 {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    .logo {
        font-size: 1.1rem;
    }

    .nav-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    .lang-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }

    .page-header h2 {
        font-size: 1.25rem;
    }

    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .btn-sm {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }

    .form-control {
        padding: 0.6rem;
        font-size: 0.95rem;
    }

    .data-table {
        min-width: 500px;
        font-size: 0.85rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem 0.35rem;
    }

    .total-card-value {
        font-size: 1.25rem;
    }

    .total-general-card .amount {
        font-size: 1.75rem;
    }
}

/* Landscape mobile optimization */
@media (max-width: 900px) and (orientation: landscape) {
    .navbar {
        position: static;
    }

    .main-content {
        margin-top: 0.5rem;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #7f8c8d;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state-text {
    font-size: 1.2rem;
}

/* Page Header Enhancements */
.page-subtitle {
    color: #7f8c8d;
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

.page-header-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.icon {
    display: inline-block;
    margin-right: 0.25rem;
}

/* Dossier Alert */
.dossier-alert {
    background-color: #d4e9ff;
    border-left: 4px solid #3498db;
    padding: 1rem 1.5rem;
    border-radius: 4px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dossier-alert .icon {
    font-size: 1.25rem;
}

/* Total General Section */
.total-general-section {
    max-width: 600px;
    margin: 0 auto 2rem;
}

.total-general-card-main {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
    text-align: center;
}

.total-general-card-main h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    opacity: 0.9;
    font-weight: 500;
}

.total-amount-large {
    font-size: 3rem;
    font-weight: 700;
    margin: 0;
}

/* Card Styles */
.card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
    font-weight: 600;
    font-size: 1.1rem;
    color: #2c3e50;
}

.card-body {
    padding: 1.5rem;
}

/* Calcul Table */
.calcul-table {
    width: 100%;
    border-collapse: collapse;
}

.calcul-table thead {
    background-color: #34495e;
    color: white;
}

.calcul-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.calcul-table th:first-child {
    width: 5%;
}

.calcul-table th:nth-child(3),
.calcul-table th:nth-child(4) {
    text-align: right;
}

.calcul-table tbody tr {
    border-bottom: 1px solid #ecf0f1;
    transition: background-color 0.2s;
}

.calcul-table tbody tr:hover {
    background-color: #f8f9fa;
}

.calcul-table td {
    padding: 1rem;
}

.calcul-table td:nth-child(3),
.calcul-table td:nth-child(4) {
    text-align: right;
}

.calcul-table tfoot {
    background-color: #34495e;
    color: white;
    font-weight: 600;
}

.calcul-table tfoot td {
    padding: 1rem;
}

.badge {
    display: inline-block;
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 4px;
}

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

.badge-light {
    background-color: #f8f9fa;
    color: #212529;
}

/* Progress Bars */
.progress-item {
    margin-bottom: 1.5rem;
}

.progress-item:last-child {
    margin-bottom: 0;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.progress-header .label {
    font-weight: 600;
    color: #2c3e50;
}

.progress-header .value {
    color: #7f8c8d;
}

.progress-bar-container {
    width: 100%;
    height: 30px;
    background-color: #ecf0f1;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db 0%, #2980b9 100%);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    transition: width 0.6s ease;
}

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

.btn-danger:hover {
    background-color: #c0392b;
}

/* Empty State for Calcul */
.calcul-empty {
    text-align: center;
    padding: 4rem 2rem;
}

.calcul-empty .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    display: block;
}

.calcul-empty h5 {
    font-size: 1.5rem;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.calcul-empty p {
    color: #7f8c8d;
    margin-bottom: 1.5rem;
}
