/* Styles personnalisés pour l'application de Gestion Prestations & Véhicules */

/* Variables globales - Couleurs de l'entreprise NOUR INTERNATIONAL GROUPE */
:root {
    --primary-color: #FF6B00; /* Orange */
    --secondary-color: #0056B3; /* Bleu foncé */
    --success-color: #28a745;
    --info-color: #17a2b8;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
}

/* Styles généraux */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f5f5f5;
}

/* Fixed header: keep navbar visible while content scrolls */
header .navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1100;
    width: 100%;
    /* allow the navbar to size itself; JS will measure and set --site-header-height */
    height: auto;
}

/* tighten container paddings inside navbar so the header height remains compact */
header .navbar .container-fluid {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

/* Reserve space for the fixed header so page content doesn't hide behind it.
   Use the CSS variable set by JS. Add a small gap for breathing room. */
main, .content-with-sidebar {
    padding-top: calc(var(--site-header-height, 64px) + 0.75rem);
}

/* Sidebar should start below the fixed header; on large screens it's fixed so set top accordingly. */
@media (min-width: 992px) {
    .sidebar {
        top: var(--site-header-height, 64px);
        height: calc(100vh - var(--site-header-height, 64px));
    }
}

/* Reusable brand/title style used both in the header and in the sidebar so
   changing the header style will also affect the sidebar name. */
.site-brand-title {
    color: var(--site-menu-text-color) !important;
    font-weight: 700;
    display: inline-block;
    line-height: 1;
}

.site-brand-title { font-family: var(--site-font, inherit); }

/* Ensure the brand text is readable on dark menu backgrounds */
.site-brand-title {
    color: var(--site-menu-text-color) !important;
}

/* Ensure main page headings have breathing room below the fixed header.
   These selectors target common title containers used in pages (h1, .page-title, .content-header). */
.content-with-sidebar .page-title,
.content-with-sidebar .content-header,
main .page-title,
main h1,
main h2 {
    margin-top: 0.6rem;
    padding-top: 0.2rem;
}

/* A slightly larger top spacing for pages with a prominent hero/title to avoid overlap */
.content-with-sidebar .page-hero,
.content-with-sidebar .page-header {
    margin-top: 0.8rem;
    padding-top: 0.4rem;
}

/* Utiliser une police moderne et légère */
body, button, input, select, textarea {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
    font-size: 14px;
    color: #222;
}

main {
    flex: 1;
}

/* Navbar personnalisée */
.navbar-brand {
    font-weight: bold;
}

.navbar-brand img {
    border-radius: 50%;
}

.navbar .nav-link {
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    transition: all 0.3s ease;
}

.navbar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.navbar .dropdown-menu {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Sidebar pour les écrans larges */
@media (min-width: 992px) {
    .sidebar {
        position: fixed;
        top: 56px;
        bottom: 0;
        left: 0;
        width: 250px;
        padding: 1rem;
        background-color: var(--light-color);
        border-right: 1px solid rgba(0, 0, 0, 0.1);
        overflow-y: auto;
        z-index: 1000;
        box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    }
    
    .sidebar-nav {
        padding-left: 0;
        list-style: none;
    }
    
    .sidebar-nav .nav-link {
        padding: 0.75rem 1rem;
        color: var(--dark-color);
        border-radius: 0.25rem;
        display: flex;
        align-items: center;
        transition: all 0.3s ease;
        position: relative;
    }
    
    .sidebar-nav .nav-link:hover {
        background-color: rgba(255, 107, 0, 0.1); /* Orange avec transparence */
    }
    
    .sidebar-nav .nav-link.active {
        background-color: var(--primary-color); /* Orange */
        color: white;
    }
    
    .sidebar-nav .nav-link.active::before {
        content: "";
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        width: 3px;
        background-color: white;
    }
    
    .sidebar-nav .nav-link i {
        margin-right: 0.75rem;
        width: 20px;
        text-align: center;
    }
    
    .sidebar-nav .nav-link .float-end {
        transition: transform 0.3s ease;
    }
    
    .sidebar-nav .nav-link[aria-expanded="true"] .float-end {
        transform: rotate(180deg);
    }
    
    .content-with-sidebar {
        margin-left: 250px !important;
        padding-top: 1rem;
        /* Ensure main content doesn't get hidden behind the footer on wide screens */
        padding-bottom: 80px; /* leave space for footer */
        /* breathing room from the fixed sidebar */
        padding-left: 1rem;
    }
    
    /* Sous-menu dans la sidebar */
    .sidebar-nav .nav.flex-column {
        padding-left: 0;
        list-style: none;
    }
    
    .sidebar-nav .nav.flex-column .nav-link {
        padding: 0.5rem 1rem 0.5rem 2.5rem;
        font-size: 0.9rem;
    }
    
    .sidebar-nav .nav.flex-column .nav-link.active {
        background-color: rgba(255, 107, 0, 0.1); /* Orange clair */
        color: var(--primary-color); /* Orange */
    }
    
    .sidebar-nav .nav.flex-column .nav-link:hover {
        background-color: rgba(255, 107, 0, 0.05);
    }
    
    .sidebar-nav .nav.flex-column .nav-link i {
        margin-right: 0.5rem;
        font-size: 0.8rem;
    }
}

/* Cartes du tableau de bord */
.dashboard-card {
    transition: transform 0.3s ease;
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

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

.dashboard-card .text-primary {
    color: var(--primary-color) !important;
}

.dashboard-card .text-success {
    color: var(--secondary-color) !important;
}

/* Tableaux de données */
.table-hover tbody tr:hover {
    background-color: rgba(255, 107, 0, 0.05); /* Orange très clair */
}

/* Formulaires */
.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(255, 107, 0, 0.25);
}

/* Styles spécifiques pour la page de connexion */
.auth-center {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    background: linear-gradient(180deg, #ffffff 0%, #f7f9fb 100%);
}

.card.auth-card {
    border-radius: 0.85rem;
    overflow: hidden;
    max-width: 460px;
    width: 100%;
    margin: 0 auto;
    border: 1px solid rgba(17,24,39,0.06);
    box-shadow: 0 8px 30px rgba(17,24,39,0.06);
}

.card.auth-card .card-header.bg-primary {
    background: linear-gradient(90deg, rgba(255,107,0,1) 0%, rgba(230,90,0,1) 100%);
    color: #fff !important;
    text-align: center;
    padding: 1rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.card.auth-card .card-header img {
    max-height: 48px;
    display: inline-block;
    border-radius: 6px;
    background: rgba(255,255,255,0.08);
    padding: 4px;
}

.card.auth-card .card-body {
    padding: 1.75rem 1.5rem;
}

.input-group .input-group-text {
    background-color: #fff;
    border-right: 0;
    color: var(--dark-color);
    border: 1px solid rgba(17,24,39,0.08);
}

.input-group .form-control {
    border-left: 0;
    border: 1px solid rgba(17,24,39,0.08);
}

.form-control, .form-select {
    height: 44px;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
}

.form-label {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.95rem;
}

.btn.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    padding: 0.7rem 1rem;
    font-weight: 700;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(255,107,0,0.12);
    transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.btn.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(255,107,0,0.16);
}

.card-footer small.text-muted {
    color: rgba(0,0,0,0.5);
}

/* Alert credentials box */
.alert-info {
    background-color: #eef7ff;
    border-color: rgba(0,86,179,0.08);
    color: var(--dark-color);
}

@media (max-width: 576px) {
    .card.auth-card { width: 100%; box-shadow: none; border: none; }
    .auth-center { padding: 1rem; min-height: calc(100vh - 60px); }
    .card.auth-card .card-header img { max-height: 40px; }
    .form-control, .form-select { height: 42px; }
}

/* Welcome page styles */
.welcome-page {
    padding: 4rem 1rem;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
}
.welcome-card {
    max-width: 720px;
    background: linear-gradient(180deg, #fff, #f8fafc);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(2,6,23,0.08);
    animation: fadeInUp 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.welcome-title {
    font-weight: 800;
    margin-bottom: 0.25rem;
    font-size: 1.9rem;
    color: var(--dark-color);
    opacity: 0;
    transform: translateY(10px);
}
.welcome-subtitle {
    color: rgba(17,24,39,0.75);
    font-size: 1rem;
    margin-bottom: 0.5rem;
    opacity: 0;
    transform: translateY(10px);
}

.welcome-card { animation: fadeInUp 420ms ease both; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.welcome-success {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-top: 1rem;
    animation: fadeIn 0.5s ease-in-out;
}

.welcome-success .check {
    display: inline-flex;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(40,167,69,0.12);
    color: #28a745;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    animation: scaleIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.3s both;
}

.welcome-message {
    background: linear-gradient(120deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 1.25rem;
    border-radius: 0.75rem;
    margin: 1.5rem 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.03);
    opacity: 0;
    transform: translateY(10px);
}

/* Slightly larger logo */
.welcome-logo { height: 92px; }

.welcome-card .btn-outline-primary {
    border-radius: 8px;
    padding: 0.35rem 0.7rem;
    font-weight: 600;
    color: var(--primary-color);
    border-color: rgba(255,107,0,0.2);
    transition: all 0.3s ease;
}

.welcome-card .btn-outline-primary:hover {
    background: rgba(255,107,0,0.06);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255,107,0,0.15);
}

@keyframes float {
    0% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0); }
}

/* Additional animations */
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.progress-bar-animated {
    animation: progressAnimation 2.2s ease-in-out forwards;
}

@keyframes progressAnimation {
    0% { width: 0; }
    100% { width: 100%; }
}

/* Permissions page styles */
.nav-tabs .nav-link {
    border: 1px solid transparent;
    border-bottom: 3px solid transparent;
    font-weight: 500;
    color: var(--dark-color);
    transition: all 0.3s ease;
}

.nav-tabs .nav-link:hover {
    border-color: transparent transparent rgba(255,107,0,0.3);
    background-color: rgba(255,107,0,0.05);
}

.nav-tabs .nav-link.active {
    border-color: transparent transparent var(--primary-color);
    background-color: rgba(255,107,0,0.1);
    color: var(--primary-color);
}

.card.border-primary {
    border: 1px solid rgba(255,107,0,0.25) !important;
}

.card-header.bg-primary.bg-opacity-10 {
    background-color: rgba(255,107,0,0.1) !important;
}

.table th {
    font-weight: 600;
    color: var(--dark-color);
    border-top: none;
}

.table td, .table th {
    vertical-align: middle;
}

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

.badge.bg-secondary {
    background-color: #6c757d !important;
    font-size: 0.75em;
}

/* Role permissions page styles */
.permission-card {
    transition: all 0.3s ease;
    border: 1px solid rgba(0,0,0,0.125);
}

.permission-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15);
    border-color: var(--primary-color);
}

.permission-card .form-check-input:checked + .form-check-label {
    color: var(--primary-color);
}

.permission-card .form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Boutons */
.btn {
    border-radius: 0.25rem;
    padding: 0.375rem 1rem;
}

.btn-primary {
    background-color: var(--primary-color); /* Orange */
    border-color: var(--primary-color); /* Orange */
}

.btn-primary:hover {
    background-color: #e05a00; /* Orange foncé */
    border-color: #e05a00; /* Orange foncé */
}

.btn-outline-primary {
    color: var(--primary-color); /* Orange */
    border-color: var(--primary-color); /* Orange */
}

.btn-outline-primary:hover {
    background-color: var(--primary-color); /* Orange */
    border-color: var(--primary-color); /* Orange */
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon i {
    margin-right: 0.5rem;
}

/* Alertes et notifications */
.alert {
    border: none;
    border-radius: 0.25rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.alert-primary {
    background-color: rgba(255, 107, 0, 0.2);
    color: var(--dark-color);
}

.alert .alert-heading {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

.badge.bg-primary {
    background-color: var(--primary-color) !important;
}

/* Footer */
footer {
    background-color: var(--light-color);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* App footer refined */
.app-footer {
    background: #fff;
    border-top: 1px solid rgba(17,24,39,0.06);
    box-shadow: 0 -1px 0 rgba(0,0,0,0.02);
}

.app-footer .text-muted {
    color: rgba(17,24,39,0.6) !important;
}

.app-footer a.text-muted {
    text-decoration: none;
    opacity: 0.85;
}

.app-footer a.text-muted:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Ensure footer content aligns well on small screens */
@media (max-width: 767.98px) {
    .app-footer .footer-right {
        text-align: center !important;
        display: block;
    }
    /* Hide desktop sidebar on small screens (we use offcanvas instead) */
    .sidebar {
        display: none !important;
    }

    /* Style the mobile offcanvas to look like the sidebar */
    .offcanvas.offcanvas-start {
        width: 280px;
    }

    .offcanvas .offcanvas-header { padding: 0.75rem 1rem; }
    .offcanvas .offcanvas-body { padding: 0.5rem 1rem; background-color: var(--light-color); }
    .offcanvas .nav-link { color: var(--dark-color); padding: 0.5rem 0.75rem; }
}

/* Styles pour les modules spécifiques */

/* Module Prestations */
.service-card {
    border-left: 4px solid var(--primary-color); /* Orange */
}

.service-card.pending {
    border-left-color: var(--warning-color);
}

.service-card.in-progress {
    border-left-color: var(--info-color);
}

.service-card.completed {
    border-left-color: var(--success-color);
}

/* Module Entrées/Sorties */
.entry-exit-item {
    border-left: 4px solid transparent;
}

.entry-exit-item.entry {
    border-left-color: var(--success-color);
}

.entry-exit-item.exit {
    border-left-color: var(--danger-color);
}

/* Module Véhicules */
.vehicle-status {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}

.vehicle-status.available {
    background-color: var(--success-color);
}

.vehicle-status.in-use {
    background-color: var(--warning-color);
}

.vehicle-status.maintenance {
    background-color: var(--danger-color);
}

/* Responsive design ajustements */
@media (max-width: 991.98px) {
    .content-with-sidebar {
        margin-left: 0;
    }
    
    .sidebar {
        display: none !important;
    }
    
    .navbar-brand img {
        width: 25px;
        height: 25px;
    }
    
    .navbar.bg-primary {
        background-color: var(--secondary-color) !important; /* Bleu foncé sur mobile */
    }
}

@media (max-width: 767.98px) {
    .card-title {
        font-size: 1rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .navbar-brand img {
        width: 20px;
        height: 20px;
    }
    
    .nav-tabs .nav-link {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    .permission-card {
        margin-bottom: 1rem;
    }
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Impression */
@media print {
    .no-print {
        display: none !important;
    /* Reserve extra space at the bottom of the sidebar so it doesn't visually overlap the footer */
    .sidebar::after {
        content: "";
        display: block;
        height: 80px;
    }
    }
    
    .print-only {
        display: block !important;
    }
    
    body {
        background-color: white;
    }
    
    .card {
        border: 1px solid #ddd;
        box-shadow: none;
    }
    
    .sidebar {
        display: none !important;
    }
}