/* public/css/style.css */

body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6;
    color: #333;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* Header & Navigation */
header {
    background-color: #007bff;
    color: #fff;
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

header h1 {
    margin: 0;
    font-size: 2.2em;
    text-align: center;
    padding-bottom: 10px;
}

header nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    /* Allows navigation items to wrap on smaller screens */
}

header nav ul li {
    margin: 0 15px;
}

header nav ul li a {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1em;
    padding: 5px 0;
    position: relative;
    transition: color 0.3s ease;
}

header nav ul li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -3px;
    left: 0;
    background-color: #fff;
    transition: width 0.3s ease;
}

header nav ul li a:hover {
    color: #e0f2ff;
}

header nav ul li a:hover::after,
header nav ul li a.active::after {
    width: 100%;
}

/* Main Content */
main {
    padding: 30px 0;
}

h2 {
    color: #007bff;
    text-align: center;
    margin-bottom: 30px;
    font-size: 2em;
    position: relative;
    padding-bottom: 10px;
}

h2::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    width: 80px;
    height: 3px;
    background-color: #007bff;
    border-radius: 2px;
}

h3 {
    color: #333;
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 1.5em;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

/* Forms */
form {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    margin-top: 20px;
}

form label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="date"],
form input[type="tel"],
form textarea,
form select {
    width: calc(100% - 22px);
    /* Account for padding and border */
    padding: 11px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    box-sizing: border-box;
    /* Include padding and border in the element's total width and height */
    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="date"]:focus,
form input[type="tel"]:focus,
form textarea:focus,
form select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
    outline: none;
}

form textarea {
    resize: vertical;
    min-height: 100px;
}

form button[type="submit"] {
    background-color: #007bff;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

form button[type="submit"]:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

/* Messages */
.message {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-weight: bold;
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

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

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

.message.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

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

.message a {
    color: #007bff;
    text-decoration: underline;
}

.message a:hover {
    color: #0056b3;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Buttons */
.btn-primary {
    background-color: #007bff;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.3s ease;
}

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

.btn-secondary {
    background-color: #6c757d;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.3s ease;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

/* Specific styles for different pages (from inline styles, now centralized) */

/* Calendar and Appointment Booking (prendre_rdv.php) */
.filter-form {
    margin-bottom: 25px;
    background-color: #f8f8f8;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.filter-form label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
    color: #333;
}

.filter-form select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1em;
    background-color: #fff;
}

.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 25px;
    background-color: #007bff;
    color: white;
    padding: 10px 20px;
    border-radius: 8px 8px 0 0;
}

.calendar-nav h4 {
    margin: 0;
    color: white;
    font-size: 1.3em;
}

.calendar-nav a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.calendar-nav a:hover {
    background-color: #0056b3;
}

.calendar {
    border: 1px solid #e0e0e0;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    margin-bottom: 30px;
    background-color: #fff;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background-color: #f0f0f0;
    font-weight: bold;
    padding: 10px 0;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
}

.calendar-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-day,
.empty-day {
    border: 1px solid #eee;
    padding: 15px 10px;
    text-align: center;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 1.1em;
    color: #777;
}

.empty-day {
    background-color: #f9f9f9;
}

.calendar-day.today {
    background-color: #e6f2ff;
    border: 2px solid #007bff;
    font-weight: bold;
    color: #007bff;
}

.calendar-day.selected-day {
    background-color: #d1e7ff;
    border: 2px solid #0056b3;
    font-weight: bold;
    color: #0056b3;
}

.calendar-day.has-slots a {
    background-color: #28a745;
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.calendar-day.has-slots a:hover {
    background-color: #218838;
}

.calendar-day.past-day {
    background-color: #f0f0f0;
    color: #aaa;
    cursor: not-allowed;
}

.available-slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.slot-item {
    background-color: #e9ecef;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 12px;
    text-align: center;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    color: #333;
}

.slot-item:hover {
    background-color: #cfe2ff;
    border-color: #007bff;
    color: #007bff;
}

.slot-item.selected {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.2);
}

form#appointment_form {
    background-color: #f8f8f8;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    margin-top: 20px;
}

form#appointment_form label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}

form#appointment_form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1em;
    min-height: 100px;
    resize: vertical;
    margin-bottom: 20px;
}

form#appointment_form button {
    background-color: #007bff;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

form#appointment_form button:hover:enabled {
    background-color: #0056b3;
}

form#appointment_form button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* Admin Approbation Medecin (admin_approbation_medecin.php) */
.pending-medecin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-top: 25px;
}

.medecin-pending-card {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    padding: 25px;
    border-top: 5px solid #ffc107;
    /* Highlight pending status */
    display: flex;
    flex-direction: column;
}

.medecin-pending-card h3 {
    color: #007bff;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.5em;
    border-bottom: none;
    padding-bottom: 0;
}

.medecin-pending-card p {
    margin-bottom: 8px;
    color: #555;
    font-size: 0.95em;
}

.medecin-pending-card p strong {
    color: #333;
}

.medecin-pending-card .doc-file-link {
    margin-top: 10px;
    margin-bottom: 15px;
    display: block;
}

.medecin-pending-card .doc-file-link a {
    color: #007bff;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.medecin-pending-card .doc-file-link a:hover {
    color: #0056b3;
}

.medecin-pending-card .actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

.medecin-pending-card .btn-approve {
    background-color: #28a745;
    color: white;
    padding: 10px 18px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

.medecin-pending-card .btn-approve:hover {
    background-color: #218838;
}

.medecin-pending-card .btn-reject {
    background-color: #dc3545;
    color: white;
    padding: 10px 18px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

.medecin-pending-card .btn-reject:hover {
    background-color: #c82333;
}

/* Medecin List (medecins.php) */
.medecin-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.medecin-card {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 25px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.medecin-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.medecin-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
    border: 3px solid #007bff;
}

.medecin-card h3 {
    color: #007bff;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.6em;
}

.medecin-card p {
    color: #555;
    font-size: 0.95em;
    margin-bottom: 8px;
}

.medecin-card .medecin-description {
    font-size: 0.9em;
    color: #777;
    margin-top: 15px;
    min-height: 60px;
    /* Ensure consistent height for descriptions */
    overflow: hidden;
    text-overflow: ellipsis;
}

.medecin-card .btn-primary {
    display: inline-block;
    background-color: #28a745;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    margin-top: 20px;
    transition: background-color 0.3s ease;
}

.medecin-card .btn-primary:hover {
    background-color: #218838;
}

/* My Appointments (mes_rdv.php) */
.rendezvous-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.rendezvous-card {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    padding: 20px;
    border-left: 5px solid;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* Pushes button to bottom */
}

.rendezvous-card.en_attente {
    border-color: #ffc107;
}

/* Yellow for pending */
.rendezvous-card.confirme {
    border-color: #28a745;
}

/* Green for confirmed */
.rendezvous-card.annule {
    border-color: #dc3545;
}

/* Red for cancelled */
.rendezvous-card.termine {
    border-color: #6c757d;
}

/* Grey for completed */
.rendezvous-card.past {
    opacity: 0.8;
}

/* Slightly dim past appointments */

.rdv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.rendezvous-card h4 {
    margin: 0;
    color: #007bff;
    font-size: 1.3em;
}

.rdv-status {
    padding: 5px 10px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 0.85em;
    color: white;
}

.status-en_attente {
    background-color: #ffc107;
}

.status-confirme {
    background-color: #28a745;
}

.status-annule {
    background-color: #dc3545;
}

.status-termine {
    background-color: #6c757d;
}

.rendezvous-card p {
    margin-bottom: 5px;
    color: #555;
    font-size: 0.95em;
}

.rendezvous-card .btn-cancel {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 15px;
    align-self: flex-start;
    /* Aligns button to the left */
    transition: background-color 0.3s ease;
}

.rendezvous-card .btn-cancel:hover {
    background-color: #c82333;
}

/* Profile Page (profil.php) */
.profile-card {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-top: 20px;
}

.profile-card h3 {
    color: #007bff;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.profile-card p {
    margin-bottom: 10px;
    color: #444;
    font-size: 1.1em;
}

.profile-card p strong {
    color: #333;
    display: inline-block;
    min-width: 150px;
    /* Align labels */
}

.profile-photo-container {
    text-align: center;
    margin-bottom: 20px;
}

.profile-photo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #007bff;
    box-shadow: 0 0 10px rgba(0, 123, 255, 0.3);
}

.status-badge {
    padding: 5px 12px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 0.9em;
    color: white;
    margin-left: 10px;
    display: inline-block;
}

.status-approuve {
    background-color: #28a745;
}

.status-en_attente {
    background-color: #ffc107;
}

.status-rejete {
    background-color: #dc3545;
}

.small-info {
    font-size: 0.9em;
    padding: 8px 15px;
    margin-top: 10px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    header nav ul {
        flex-direction: column;
        align-items: center;
    }

    header nav ul li {
        margin: 8px 0;
    }

    .container {
        width: 95%;
        padding: 15px 0;
    }

    h2 {
        font-size: 1.8em;
    }

    .medecin-list,
    .rendezvous-list,
    .pending-medecin-grid,
    .available-slots-grid {
        grid-template-columns: 1fr;
    }

    .medecin-card,
    .rendezvous-card,
    .medecin-pending-card,
    form {
        padding: 20px;
    }

    form input[type="text"],
    form input[type="email"],
    form input[type="password"],
    form input[type="date"],
    form input[type="tel"],
    form textarea,
    form select {
        width: calc(100% - 20px);
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8em;
    }

    h2 {
        font-size: 1.6em;
    }

    .profile-card p strong {
        min-width: unset;
        display: block;
        margin-bottom: 5px;
    }
}