/* 
 * Styles principaux du système de gestion clinique
 * 
 * @package Clinic Management System
 * @version 1.0
 */

:root {
    --primary-color: #06A2BB;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --info-color: #0dcaf0;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #06A2BB;
    --dark-color: #212529;
    --medical-blue: #1a73e8;
    --medical-green: #34a853;
    --medical-red: #ea4335;
    --medical-yellow: #fbbc04;
}

/* Styles généraux */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, #06A2BB 100%);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../images/pattern.png');
    background-size: 300px;
    opacity: 0.1;
}

/* Cartes */
.card {
    border: none;
    border-radius: 10px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1) !important;
}

.card-header {
    border-radius: 10px 10px 0 0 !important;
    border-bottom: none;
}

/* Icônes */
.stats-icon, .service-icon, .mission-icon, .tech-icon, .action-icon {
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Boutons */
.btn {
    border-radius: 8px;
    padding: 0.5rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-lg {
    padding: 0.75rem 2rem;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(13, 110, 253, 0.3);
}

/* Boutons de la section hero */
.hero-section .btn-light {
    background-color: white;
    color: var(--primary-color);
    border: 2px solid white;
    font-weight: 600;
}

.hero-section .btn-light:hover {
    background-color: transparent;
    color: white;
    border-color: white;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(255, 255, 255, 0.2);
}

.hero-section .btn-outline-light {
    background-color: transparent;
    color: white;
    border: 2px solid white;
    font-weight: 600;
}

.hero-section .btn-outline-light:hover {
    background-color: white;
    color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(255, 255, 255, 0.2);
}

/* Section titles */
.section-title {
    position: relative;
    padding-bottom: 15px;
    margin-bottom: 30px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background-color: var(--primary-color);
}

/* Navbar */
.navbar {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

.nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background-color: rgba(13, 110, 253, 0.1);
}

/* Footer */
footer {
    background: linear-gradient(135deg, #212529 0%, #343a40 100%);
}

footer a {
    transition: color 0.3s ease;
}

footer a:hover {
    color: var(--primary-color) !important;
}

/* Logo alignment on desktop */
@media (min-width: 992px) {
    /* Align logo to left edge with consistent spacing */
    .navbar > .container {
        padding-left: 0;
    }
    
    .navbar-brand {
        margin-left: -6.5rem;
        margin-right: 2rem;
        padding-left: 0;
    }
    
    /* Ensure navbar content has proper spacing */
    .navbar-collapse {
        flex-grow: 1;
    }
    
    /* Adjust navigation menu spacing */
    .navbar-nav.me-auto {
        margin-left: 1rem;
    }
}

/* Formulaires */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Badges */
.badge {
    padding: 0.5em 0.8em;
    font-weight: 500;
    border-radius: 20px;
}

/* Alertes */
.alert {
    border-radius: 10px;
    border: none;
    padding: 1rem 1.5rem;
}

/* Tableaux */
.table {
    border-radius: 10px;
    overflow: hidden;
}

.table thead th {
    background-color: var(--primary-color);
    color: white;
    border: none;
    font-weight: 600;
}

.table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* Images des médecins */
.doctor-image {
    height: 200px;
    overflow: hidden;
}

.doctor-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.doctor-image:hover img {
    transform: scale(1.05);
}

/* Clinique image dans la section hero */
.hero-section img {
    transition: transform 0.5s ease, box-shadow 0.5s ease;
}

.hero-section img:hover {
    transform: scale(1.02);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

/* Image Plateau dans la page about */
.about-page-image {
    transition: all 0.5s ease;
    border: 5px solid white !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2) !important;
}

.about-page-image:hover {
    transform: translateY(-10px) scale(1.01);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3) !important;
    border-color: var(--primary-color) !important;
}

/* Responsive pour les images about */
@media (max-width: 768px) {
    .about-page-image {
        max-height: 300px !important;
        margin-bottom: 20px;
    }
}

/* Évaluations */
.testimonial-rating {
    color: var(--warning-color);
    font-size: 1.2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 2.5rem;
    }
    
    .stats-icon, .service-icon, .mission-icon, .tech-icon, .action-icon {
        width: 60px;
        height: 60px;
    }
    
    .btn-lg {
        padding: 0.5rem 1.5rem;
        font-size: 1rem;
    }
    
    /* Mobile navbar optimization */
    .navbar {
        padding: 0.5rem 0;
        position: relative;
    }
    
    .navbar-brand {
        font-size: 1.2rem;
        margin-right: auto;
        margin-left: auto;
        text-align: center;
        flex: 1;
        justify-content: center;
        order: 2;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .navbar-toggler {
        position: absolute;
        right: 1rem;
        z-index: 1001;
        order: 3;
    }
    
    /* User menu positioning on mobile */
    .navbar-nav.ms-auto {
        order: 1;
        position: absolute;
        left: 1rem;
        z-index: 1000;
    }
    
    /* Ensure proper spacing between navbar elements */
    .navbar > .container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        position: relative;
        min-height: 56px;
    }
    
    .navbar-collapse {
        background-color: white;
        padding: 1rem;
        border-radius: 0.5rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        margin-top: 0.5rem;
    }
    
    .nav-link {
        padding: 0.75rem 1rem !important;
        margin: 0.25rem 0;
    }
    
    .navbar-nav .btn {
        margin: 0.5rem 0;
        width: 100%;
        text-align: center;
    }
    
    /* Ensure dropdowns don't overflow */
    .dropdown-menu {
        position: static !important;
        float: none;
        width: 100%;
        margin-top: 0;
        border: none;
        box-shadow: none;
    }
    
    /* Fix notification badge positioning */
    .nav-link .badge {
        font-size: 0.7rem;
        padding: 0.25em 0.5em;
    }
    
    /* User dropdown alignment */
    .navbar-nav .dropdown-toggle::after {
        margin-left: 0.5rem;
    }
    
    /* Prevent text overflow in user menu */
    .dropdown-menu .dropdown-item {
        white-space: normal;
        word-wrap: break-word;
    }
}

/* Extra small devices */
@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1.1rem;
        max-width: 70%;
    }
    
    .navbar-toggler {
        padding: 0.25rem 0.5rem;
    }
    
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Ensure logo icon is properly sized */
    .navbar-brand .bg-primary {
        width: 36px;
        height: 36px;
    }
    
    .navbar-brand i {
        font-size: 1rem;
    }
    
    /* Enhanced mobile menu with perfectly centered profile icon */
    .navbar-nav .dropdown-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.5rem;
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Optimize profile icon/avatar for mobile */
    .navbar-nav .dropdown-toggle img {
        width: 32px;
        height: 32px;
        object-fit: cover;
        margin: 0 auto;
    }
    
    .navbar-nav .dropdown-toggle .bg-primary {
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0 auto;
    }
    
    .navbar-nav .dropdown-toggle .bg-primary i {
        font-size: 1rem;
    }
    
    /* Hide user name text on mobile to save space */
    .navbar-nav .dropdown-toggle span.d-none.d-md-inline {
        display: none !important;
    }
    
    /* Ensure dropdown menu doesn't conflict with mobile layout */
    .navbar-nav .dropdown-menu {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        min-width: 200px;
        margin-top: 0.5rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        border: none;
        border-radius: 0.5rem;
    }
    
    /* Mobile menu item spacing */
    .navbar-nav .nav-item {
        margin: 0.25rem 0;
    }
    
    /* Ensure menu operates freely without overlapping */
    .navbar-collapse {
        max-height: 80vh;
        overflow-y: auto;
    }
    
    /* Simplify user dropdown text on mobile */
    .dropdown-menu .dropdown-header strong {
        font-size: 0.9rem;
        text-align: center;
        display: block;
    }
    
    .dropdown-menu .dropdown-header p {
        font-size: 0.8rem;
        text-align: center;
        display: block;
        margin-bottom: 0.5rem;
    }
}

/* Fix for dashboard header on mobile */
@media (max-width: 768px) {
    .navbar-dark .navbar-toggler {
        border-color: rgba(255, 255, 255, 0.3);
    }
    
    .navbar-dark .navbar-brand {
        padding-left: 0;
        padding-right: 0;
    }
    
    .flex-md-nowrap {
        flex-wrap: wrap !important;
    }
    
    .navbar-dark .form-control {
        margin-top: 0.5rem;
        width: 100%;
        border-radius: 0.25rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.pulse {
    animation: pulse 2s infinite;
}

/* Animation pour les boutons de la hero section */
.hero-section .btn {
    animation: fadeIn 0.8s ease 0.3s both;
}

/* Loader */
.loader {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #0b5ed7;
}

/* Mobile Menu Styles */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 320px;
    max-width: 90%;
    height: 100vh;
    background-color: white;
    z-index: 1050;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mobile-menu-panel.active {
    right: 0;
}

.mobile-menu-header {
    padding: 1rem;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Ensure sufficient color contrast for accessibility */
.mobile-menu-header,
.mobile-menu-header a,
.mobile-menu-header button {
    color: #ffffff !important;
}

.mobile-menu-header .mobile-user-details strong {
    color: #ffffff;
    font-weight: 600;
}

.mobile-menu-header .mobile-user-details small {
    color: rgba(255, 255, 255, 0.9);
    opacity: 0.9;
}

.mobile-menu-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mobile-user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
}

.mobile-user-avatar-default {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

.mobile-user-avatar-default i {
    font-size: 1.5rem;
    color: white;
}

.mobile-user-details {
    display: flex;
    flex-direction: column;
}

.mobile-user-details strong {
    font-size: 1rem;
    font-weight: 600;
}

.mobile-user-details small {
    font-size: 0.8rem;
    opacity: 0.9;
}

.mobile-menu-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
    transition: opacity 0.2s ease;
}

.mobile-menu-close:hover {
    opacity: 0.8;
}

.mobile-menu-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.mobile-menu-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-menu-item {
    margin: 0;
}

.mobile-menu-link {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: #333;
    text-decoration: none;
    transition: background-color 0.2s ease;
    border-left: 3px solid transparent;
}

.mobile-menu-link:hover,
.mobile-menu-link:focus {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

.mobile-menu-close:hover,
.mobile-menu-close:focus {
    opacity: 0.8;
    outline: 2px solid white;
    outline-offset: 2px;
}

/* Focus styles for all interactive elements */
.mobile-menu-link:focus-visible,
.mobile-menu-close:focus-visible,
#mobileMenuToggle:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Fallback for browsers without :focus-visible */
.mobile-menu-link:focus:not(:focus-visible),
.mobile-menu-close:focus:not(:focus-visible),
#mobileMenuToggle:focus:not(:focus-visible) {
    outline: none;
}

.mobile-menu-link i {
    width: 24px;
    margin-right: 1rem;
    font-size: 1.1rem;
    text-align: center;
}

.mobile-menu-link span {
    flex: 1;
    font-size: 1rem;
    font-weight: 500;
}

.mobile-menu-badge {
    background-color: var(--danger-color);
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

.mobile-menu-divider {
    height: 1px;
    background-color: #e9ecef;
    margin: 0.5rem 1.5rem;
}

.mobile-menu-logout {
    color: var(--danger-color);
}

.mobile-menu-logout:hover {
    color: #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
}

.mobile-menu-register {
    color: var(--primary-color);
    font-weight: 600;
}

/* Ensure body doesn't scroll when mobile menu is open */
body.mobile-menu-open {
    overflow: hidden;
}

/* Responsive adjustments for mobile menu */
@media (max-width: 576px) {
    .mobile-menu-panel {
        width: 280px;
        max-width: 85%;
    }
    
    .mobile-menu-link {
        padding: 0.875rem 1.25rem;
    }
    
    .mobile-menu-link i {
        font-size: 1rem;
        margin-right: 0.875rem;
    }
    
    .mobile-user-avatar,
    .mobile-user-avatar-default {
        width: 40px;
        height: 40px;
    }
    
    .mobile-user-details strong {
        font-size: 0.9rem;
    }
    
    .mobile-user-details small {
        font-size: 0.75rem;
    }
}

/* Extra small devices (phones, less than 400px) */
@media (max-width: 400px) {
    .mobile-menu-panel {
        width: 260px;
        max-width: 82%;
    }
    
    .mobile-menu-header {
        padding: 0.75rem;
    }
    
    .mobile-menu-link {
        padding: 0.75rem 1rem;
    }
    
    .mobile-menu-link i {
        font-size: 0.9rem;
        margin-right: 0.75rem;
    }
    
    .mobile-menu-link span {
        font-size: 0.9rem;
    }
}

/* Landscape orientation on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .mobile-menu-panel {
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .mobile-menu-header {
        padding: 0.5rem 1rem;
    }
    
    .mobile-menu-user-info {
        gap: 0.5rem;
    }
    
    .mobile-menu-link {
        padding: 0.5rem 1rem;
        min-height: 40px;
    }
}

/* Hide desktop navbar toggler on mobile when we have custom menu */
@media (max-width: 991.98px) {
    .navbar-toggler[data-bs-toggle="collapse"] {
        display: none;
    }
    
    .navbar-collapse.d-lg-flex {
        display: none !important;
    }
}

/* Show our custom mobile menu toggler */
.navbar-toggler.d-lg-none {
    display: block;
}

/* Enhanced mobile menu toggle button styling */
#mobileMenuToggle {
    border: 2px solid var(--primary-color);
    background: white;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    z-index: 1000;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    min-width: 44px;
    min-height: 44px;
    margin-left: auto;
    margin-right: 0;
}

#mobileMenuToggle:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

#mobileMenuToggle:hover .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, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

#mobileMenuToggle:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

#mobileMenuToggle .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%280, 123, 255, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    width: 1.5em;
    height: 1.5em;
    transition: background-image 0.2s ease;
}

#mobileMenuToggle[aria-expanded="true"] {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

#mobileMenuToggle[aria-expanded="true"] .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, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Ensure proper positioning on mobile */
@media (max-width: 991.98px) {
    #mobileMenuToggle {
        order: 3;
        position: absolute;
        right: 1rem;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .navbar-brand {
        order: 1;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        margin: 0;
    }
    
    /* Hide Bootstrap's default navbar collapse on mobile */
    .navbar-collapse {
        display: none !important;
    }
}

/* Extra small screens */
@media (max-width: 400px) {
    #mobileMenuToggle {
        padding: 0.4rem 0.6rem;
        min-width: 40px;
        min-height: 40px;
        right: 0.75rem;
    }
    
    #mobileMenuToggle .navbar-toggler-icon {
        width: 1.2em;
        height: 1.2em;
    }
    
    .navbar-brand {
        font-size: 1rem;
        max-width: 60%;
        text-align: center;
    }
    
    .navbar-brand .bg-primary {
        width: 32px;
        height: 32px;
    }
    
    .navbar-brand i {
        font-size: 0.9rem;
    }
}

/* General mobile header improvements */
@media (max-width: 767.98px) {
    /* Ensure mobile headers have proper touch targets */
    .navbar-toggler,
    .dashboard-mobile-toggle,
    .mobile-username {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Improve logo centering on mobile */
    .navbar-brand {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Better spacing for mobile header elements */
    .navbar > .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}