/* General Styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #f5f7fa, #c3cfe2); /* Gradient background */
    background-attachment: fixed; /* Prevents looping */
    background-size: cover; /* Ensures gradient spans full viewport */
    /*min-height: 100vh; /* Ensures it fills the screen */
    color: #333; /* Text color */
}

html {
    height: 100%;
}

.container {
    max-width: 1200px;
    margin: 20px auto; /* Center with spacing */
    padding: 20px;
    background-color: #ffffff; /* Distinct content background */
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1); /* Subtle shadow for distinction */
}

/* Filter Section Styles */
.filter-section {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.filter-button {
    padding: 10px 20px;
    background-color: #007BFF;
    color: white;
    border: none;
    cursor: pointer;
    margin-right: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.filter-button:hover {
    background-color: #0056b3;
}

/* Table Styles (Desktop and Normal Mode) */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    display: table;
}

th, td {
    padding: 10px;
    text-align: left;
    border: 1px solid #ddd;
}

th {
    background-color: #f2f2f2;
    font-weight: bold;
}

tr:nth-child(even) {
    background-color: #f9f9f9; /* Alternating row color */
}

tr:hover {
    background-color: #f1f1f1;
}


th.sortable {
    cursor: pointer;
    position: relative;
    padding-right: 20px; /* Ensure space for the arrows */
}

th.sortable::after {
    content: '▲▼'; /* Default state, shows both arrows */
    position: absolute;
    right: 5px;
    font-size: 12px;
    color: #ccc;
    pointer-events: none;
}

th.sortable.asc::after {
    content: '▲'; /* Ascending state */
    color: #000;
}

th.sortable.desc::after {
    content: '▼'; /* Descending state */
    color: #000;
}

/* Objectifs : Modal style */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 10px;
}

.modal .close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.modal .close:hover,
.modal .close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

pre {
    white-space: pre-wrap;
}

/* Action Button Styles */
.action-button {
    margin-bottom: 10px;
    padding: 10px 20px;
    background-color: #28a745;
    color: white;
    border: none;
    cursor: pointer;
    float: right;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    text-decoration: none; /* For links styled as buttons */
}

.action-button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

.action-button:hover {
    background-color: #218838;
}

.button-container {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    align-items: center;
}

.error-message {
    color: red;
    font-size: 14px;
    margin-left: auto;
    margin-right: 10px; /* Adds spacing between message and button */
    display: inline-block; /* Keeps it inline with the button */
    vertical-align: middle; /* Ensures proper alignment with the button */
}

/* Dropdown and Form Styles */
form {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    width: auto;
}

form h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
}

form div {
    margin-bottom: 15px;
}

form label {
    display: block;
    margin-bottom: 5px;
    color: #555;
}

form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="number"],
form select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

form input[type="text"]:focus,
form input[type="email"]:focus,
form input[type="password"]:focus,
form input[type="number"]:focus,
form select:focus {
    border-color: #007BFF;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
}

form input[type="submit"] {
    padding: 10px 20px;
    background-color: #28a745;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    float: right;
}

form input[type="submit"]:hover {
    background-color: #218838;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .filter-section {
        justify-content: flex-start;
    }

    .filter-button {
        margin-right: 5px;
        margin-bottom: 5px;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    thead {
        display: none;
    }

    tbody {
        display: block;
        width: 100%;
    }

    /* Data Cards Styling */
    tr {
        display: block;
        border: 1px solid #ddd;
        margin-bottom: 10px;
        border-radius: 10px;
        background-color: #e0e7ef; /* Updated light blue-gray background */
        box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); /* Subtle shadow */
        overflow: hidden; /* Prevent content overflow */
        text-wrap: wrap;
        width: calc(98%); /* Slightly smaller to fit within container */
        margin: 0 auto 10px; /* Center and spacing */
        transform: scale(0.98); /* Slightly dezoomed by default */
        transition: transform 0.2s ease-in-out, background-color 0.2s ease-in-out;
    }

    tr:hover {
        background-color: #d0e7fc; /* Pastel blue on hover for more contrast */
        transform: scale(1); /* Restore to normal scale on hover */
        overflow: hidden; /* Ensure content doesn't spill */
    }

    th, td {
        display: block;
        text-align: left;
        border: none;
        padding: 10px;
        position: relative;
    }

    td::before {
        content: attr(data-label);
        font-weight: bold;
        margin-bottom: 5px;
        display: block;
        width: 100%;
    }

    form {
        padding: 15px;
    }

    form input[type="text"],
    form input[type="email"],
    form input[type="password"],
    form input[type="number"],
    form select {
        padding: 8px;
    }

    form input[type="submit"] {
        padding: 8px 15px;
    }
}
