/* General body styling */

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f9;
    box-sizing: border-box;
}


/* Navbar styling */

.navbar {
    background-color: #007bff;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    display: none;
}


/* Navbar brand */

.navbar-brand {
    font-weight: bold;
    color: white !important;
    font-size: 1.2rem;
}


/* Navbar links */

.navbar-nav .nav-link {
    color: white !important;
    font-size: 1rem;
    padding: 0.5rem 1rem;
}


/* Hide specific links by default */

.nav-link[href="analyse.html"],
.nav-link[href="create_zip_files.html"] {
    display: none;
}


/* Hover effect for navbar links */

.navbar-nav .nav-link:hover {
    background-color: #0056b3;
}


/* Navbar toggler */

.navbar-toggler {
    border: none;
    padding: 0.25rem 0.75rem;
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%' stroke='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/>%3c/svg%3e");
}


/* Container styling */

.container {
    padding: 1rem;
    max-width: 1400px;
    margin: 0 auto;
    box-sizing: border-box;
}


/* Main title */

.main-title {
    text-align: center;
    margin: 1.5rem 0;
    font-size: 2rem;
    color: #333;
}


/* Search container */

.search-container {
    text-align: center;
    margin: 1.5rem 0;
}


/* Search input */

.search-input {
    padding: 0.6rem;
    width: 80%;
    max-width: 600px;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-size: 1rem;
}


/* Tabs styling */

.nav-tabs {
    display: flex;
    justify-content: center;
    border-bottom: none;
    margin: 1rem 0;
    padding: 0;
    list-style: none;
}

.nav-tabs .nav-item {
    margin: 0 1rem;
}

.nav-tabs .nav-link {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    color: #333;
    border: none;
    background-color: transparent;
    transition: all 0.3s ease;
}

.nav-tabs .nav-link:hover {
    color: #000;
}

.nav-tabs .nav-link.active {
    color: #000;
    font-weight: 700;
    border-bottom: 2px solid #007bff;
}


/* Divider */

.divider {
    margin: 2rem 2rem;
    border-color: #ddd;
}


/* Tab content */

.tab-content {
    min-height: calc(100vh - 200px);
    padding: 1rem 0;
    width: 100%;
    text-align: center;
}


/* Cashpoint container */

.cashpoint-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 0;
}


/* Card grid */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 350px));
    gap: 1.5rem;
    background: #fff;
    padding: 2rem 0;
    margin-bottom: 1.5rem;
    width: 100%;
    max-width: 1200px;
    justify-content: center;
}


/* Center single card */

.card-grid:has(.card:only-child) {
    display: flex;
    justify-content: center;
}


/* Card styling */

.card {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    max-height: 350px;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
}

.card h3 {
    margin: 0 0 10px;
    font-size: 1.2em;
    color: #333;
}


/* Limit visible <p> tags */

.card p {
    margin: 5px 0;
    font-size: 0.9em;
    color: #555;
}

.card p:nth-child(n+8) {
    display: none;
}


/* Ensure critical elements remain visible */

.card .solvency-bar,
.card .reserve-btn,
.card .details-btn {
    display: block !important;
}


/* Solvability bar */

.solvency-bar {
    width: 100%;
    height: 10px;
    background: #eee;
    border-radius: 5px;
    overflow: hidden;
    margin: 10px 0;
}

.solvency-fill {
    height: 100%;
    transition: width 0.3s ease;
}


/* Solvability colors with maximum specificity */

.card .solvency-bar .solvency-fill.color-critique {
    background-color: #FF0000 !important;
}

.card .solvency-bar .solvency-fill.color-tres-faible {
    background-color: #FF0000 !important;
}

.card .solvency-bar .solvency-fill.color-faible {
    background-color: #FF0000 !important;
}

.card .solvency-bar .solvency-fill.color-moyen {
    background-color: #FFFF00 !important;
}

.card .solvency-bar .solvency-fill.color-modere {
    background-color: #FFA500 !important;
}

.card .solvency-bar .solvency-fill.color-bon {
    background-color: #008000 !important;
}

.card .solvency-bar .solvency-fill.color-excellent {
    background-color: #008000 !important;
}

.card .solvency-bar .solvency-fill.color-par-defaut {
    background-color: #7f8c8d !important;
}


/* Legend colors */

.legend-color.color-critique {
    background-color: #FF0000 !important;
}

.legend-color.color-tres-faible {
    background-color: #FF0000 !important;
}

.legend-color.color-faible {
    background-color: #FF0000 !important;
}

.legend-color.color-moyen {
    background-color: #FFFF00 !important;
}

.legend-color.color-modere {
    background-color: #FFA500 !important;
}

.legend-color.color-bon {
    background-color: #008000 !important;
}

.legend-color.color-excellent {
    background-color: #008000 !important;
}

.legend-color.color-par-defaut {
    background-color: #7f8c8d !important;
}


/* Solvability text colors */

.critique {
    color: #FF0000 !important;
    font-weight: bold;
}

.tres-faible {
    color: #FF0000;
}

.faible {
    color: #FF0000;
}

.moyen {
    color: #FFFF00;
}

.modere {
    color: #FFA500;
}

.bon {
    color: #008000;
}

.excellent {
    color: #008000;
}

.par-defaut {
    color: #7f8c8d;
}


/* Loading container */

.loading-container {
    display: block;
    text-align: center;
    margin-top: 3rem;
}


/* Modal loading indicator */

.modal-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 1001;
    font-size: 1.5rem;
    color: #333;
}


/* App container */

.app-container {
    display: none;
    padding-top: 80px;
}


/* Reserve button */

button.reserve-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 10px;
    transition: background-color 0.3s ease;
    width: 45%;
    white-space: nowrap;
}

button.reserve-btn:hover:not(:disabled) {
    background-color: #0056b3;
}

button.reserve-btn:disabled {
    background-color: #008000;
    cursor: not-allowed;
    width: 45%;
    white-space: nowrap;
}

button.reserve-btn.pending {
    background-color: #6c757d;
    cursor: not-allowed;
    color: white;
    width: 45%;
    white-space: nowrap;
}


/* Financing buttons */

.finance-btn {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 10px;
    transition: background-color 0.3s ease;
    width: 45%;
    white-space: nowrap;
}

.finance-btn:hover:not(:disabled) {
    background-color: #218838;
}

.finance-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    width: 45%;
}


/* Button group to align buttons side by side */

.button-group {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
}


/* Details button */

.details-btn {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
    padding: 2px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.details-btn:hover {
    color: #4a6baf;
}


/* Available summary */

#availableSummary {
    display: none;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin: 0 auto 1.5rem;
    width: fit-content;
    min-width: 300px;
    box-sizing: border-box;
}


/* Chart container */

.chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 1rem 0;
}

.chart-wrapper {
    position: relative;
    width: 250px;
    height: 250px;
}

.chart-center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.cashpoint-count {
    display: block;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.cashpoint-label {
    font-size: 14px;
    color: #555;
}


/* Legend */

.legend {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.legend-colors {
    display: flex;
    align-items: center;
}

.legend-color {
    background-color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: block;
    border: 1px solid #ccc;
}


/* Legend label */

.legend-label {
    font-size: 0.9rem;
    color: #333;
}


/* Modal styling for cashpoint details */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    z-index: 1000;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-content {
    background-color: #fff;
    position: relative;
    padding: 1.5rem;
    border-radius: 12px;
    margin: 2.5rem auto;
    width: 90%;
    max-width: 900px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    box-sizing: border-box;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    border: 1px solid #ccc;
    display: flex;
    flex-direction: column;
}

.close-modal {
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    font-size: 1.5rem;
    color: #000;
    cursor: pointer;
}

.modal-content h2 {
    position: sticky;
    top: 0;
    margin: 0 0 0.5rem;
    background: #fff;
    padding-bottom: 0.5rem;
    z-index: 1000;
}

.modal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    overflow-wrap: break-word;
    flex-grow: 1;
}

.modal-item {
    display: block;
    overflow-wrap: break-word;
}

.detail-label {
    font-weight: bold;
    color: #444;
}

.detail-value.approved {
    color: green;
    font-weight: bold;
}

.detail-value.rejected {
    color: red;
    font-weight: bold;
}

.detail-value.critique {
    color: #FF0000;
}

.detail-value.tres-faible {
    color: #FF0000;
}

.detail-value.faible {
    color: #FF0000;
}

.detail-value.moyen {
    color: #FFFF00;
}

.detail-value.modere {
    color: #FFA500;
}

.detail-value.bon {
    color: #008000;
}

.detail-value.excellent {
    color: #008000;
}

.detail-value.par-defaut {
    color: #7f8c8d;
}


/* Modal footer for cashpoint details */

.modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 1rem;
    border-top: 1px solid #e0e0e0;
    gap: 0.5rem;
}

.close-modal-btn,
.reserve-now-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}


/* Modal styling for reservation */

#reservationModal .modal-content {
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    background-color: #fff;
}

#reservationModal .modal-header {
    background-color: #0d6efd;
    color: white;
    border-bottom: 1px solid #e0e0e0;
}

#reservationModal .modal-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #fff;
}

#reservationModal .modal-body {
    padding: 2rem;
}

#reservationDetails p {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 1rem;
}

#reservationDetails p strong {
    font-weight: 600;
}

#paymentForm .form-label {
    color: #444;
    font-weight: 600;
    font-size: 1rem;
}

#paymentForm .form-select {
    border-radius: 6px;
    padding: 0.6rem;
    font-size: 1rem;
    border: 1px solid #d1d9e6;
}

#paymentForm .form-select:focus {
    border-color: #333;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

#paymentForm .mb-3 {
    margin-bottom: 1.5rem !important;
}

#paymentForm p {
    color: #333 !important;
}

#paymentForm #totalCost {
    font-weight: bold;
    color: #008000;
}

#paymentForm .btn-primary {
    background-color: #007bff;
    border: none;
    padding: 0.8rem;
    font-size: 1.15rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    width: 100%;
}

#paymentForm .btn-primary:hover {
    background-color: #0056b3;
    transform: none;
}


/* Pagination */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 1.5rem;
}

.pagination-btn {
    padding: 0.5rem 0.75rem;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.pagination-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.pagination-btn:hover:not(:disabled) {
    background-color: #0056b3;
}

.pagination span {
    font-size: 1rem;
    color: #333;
}


/* Remove inline order styles */

.modal-item.order-0 {
    order: 0;
}

.modal-item.order-1 {
    order: 1;
}

.modal-item.order-2 {
    order: 2;
}

.modal-item.order-3 {
    order: 3;
}

.modal-item.order-4 {
    order: 4;
}

.modal-item.order-5 {
    order: 5;
}

.modal-item.order-6 {
    order: 6;
}

.modal-item.order-7 {
    order: 7;
}

.modal-item.order-8 {
    order: 8;
}

.modal-item.order-9 {
    order: 9;
}

.modal-item.order-10 {
    order: 10;
}

.modal-item.order-11 {
    order: 11;
}

.modal-item.order-12 {
    order: 12;
}

.modal-item.order-13 {
    order: 13;
}

.modal-item.order-14 {
    order: 14;
}

.modal-item.order-15 {
    order: 15;
}

.modal-item.order-16 {
    order: 16;
}

.modal-item.order-17 {
    order: 17;
}

.modal-item.order-18 {
    order: 18;
}

.modal-item.order-19 {
    order: 19;
}

.modal-item.order-20 {
    order: 20;
}

.modal-item.decision-financement {
    grid-column: span 2;
}

#successModal .modal-header.bg-success {
    background-color: #28a745 !important;
}

#successModal .modal-body ul {
    list-style-type: disc;
    padding-left: 20px;
}

#successModal .modal-body strong {
    color: #00695c;
}


/* Financing buttons */

.finance-now-btn {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    margin: 10px 5px;
    transition: background-color 0.3s ease;
}

.finance-now-btn:hover:not(:disabled) {
    background-color: #218838;
}

.finance-now-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}


/* Responsive adjustments */

@media (max-width: 992px) {
    .navbar {
        padding: 0.5rem;
    }
    .navbar-brand {
        font-size: 1.1rem;
    }
    .nav-item .nav-link {
        font-size: 0.9rem;
        padding: 0.5rem;
    }
    .app-container {
        padding-top: 60px;
    }
    .main-title {
        font-size: 1.5rem;
    }
    .search-input {
        width: 90%;
        font-size: 0.9rem;
    }
    .nav-tabs {
        justify-content: center;
        flex-wrap: wrap;
        margin: 0.5rem 1rem;
    }
    .nav-tabs .nav-item {
        margin: 0 0.5rem;
    }
    .nav-tabs .nav-link {
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
    }
    .card-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
    .card {
        padding: 12px;
        max-height: 300px;
    }
    .card h3 {
        font-size: 1.1rem;
    }
    .card p {
        font-size: 0.85rem;
    }
    .reserve-btn {
        font-size: 13px;
        padding: 6px 16px;
        width: 45%;
    }
    .finance-btn {
        font-size: 13px;
        padding: 6px 16px;
        width: 45%;
    }
    .details-btn {
        font-size: 0.85rem;
        padding: 6px 10px;
    }
    .chart-wrapper {
        width: 200px;
        height: 200px;
    }
    .cashpoint-count {
        font-size: 1.5rem;
    }
    .cashpoint-label {
        font-size: 0.8rem;
    }
    .modal-loading {
        font-size: 1.2rem;
    }
    .modal-content {
        width: 95%;
        padding: 1rem;
    }
    .modal-grid {
        grid-template-columns: 1fr;
    }
    .modal-item.decision-financement {
        grid-column: span 1;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1rem;
    }
    .navbar-nav .nav-link {
        font-size: 0.85rem;
    }
    .main-title {
        font-size: 1.2rem;
    }
    .search-input {
        width: 95%;
        font-size: 0.85rem;
    }
    .nav-tabs .nav-link {
        font-size: 0.85rem;
        padding: 0.3rem 0.6rem;
    }
    .card-grid {
        grid-template-columns: 1fr;
    }
    .card {
        max-height: 280px;
    }
    .card h3 {
        font-size: 1rem;
    }
    .card p {
        font-size: 0.8rem;
    }
    .reserve-btn {
        font-size: 12px;
        padding: 6px 12px;
        width: 45%;
    }
    .finance-btn {
        font-size: 12px;
        padding: 6px 12px;
        width: 45%;
    }
    .details-btn {
        font-size: 0.8rem;
        padding: 6px 8px;
    }
    .chart-wrapper {
        width: 180px;
        height: 180px;
    }
    .cashpoint-count {
        font-size: 1.2rem;
    }
    .cashpoint-label {
        font-size: 0.75rem;
    }
    .legend-label {
        font-size: 0.8rem;
    }
    .pagination-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }
    .pagination span {
        font-size: 0.9rem;
    }
    .modal-loading {
        font-size: 1rem;
    }
}

@media (min-width: 1200px) {
    .main-title {
        font-size: 2.5rem;
    }
    .search-input {
        font-size: 1.1rem;
    }
    .nav-tabs .nav-link {
        font-size: 1.1rem;
    }
    .card-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 350px));
    }
    .card {
        max-height: 400px;
    }
    .card h3 {
        font-size: 1.3rem;
    }
    .card p {
        font-size: 1rem;
    }
    .reserve-btn {
        font-size: 15px;
        width: 45%;
    }
    .finance-btn {
        font-size: 15px;
        width: 45%;
    }
    .details-btn {
        font-size: 1rem;
    }
    .chart-wrapper {
        width: 300px;
        height: 300px;
    }
    .cashpoint-count {
        font-size: 2rem;
    }
    .cashpoint-label {
        font-size: 1rem;
    }
}