/* ========= OVERRIDE ULTIME DES TABLES ========= */

/* 1. ÉCRASER LES VARIABLES BOOTSTRAP */
:root, [data-bs-theme] {
    --bs-table-bg: transparent !important;
    --bs-table-color: #e0e0ff !important;
    --bs-table-accent-bg: transparent !important;
    --bs-table-bg-state: transparent !important;
    --bs-table-bg-type: transparent !important;
    --bs-table-border-color: rgba(110, 231, 255, 0.3) !important;
}

/* 2. RÈGLE SPÉCIFIQUE POUR ÉCRASER BOOTSTRAP */
html > body .table > :not(caption) > * > *,
body .table > :not(caption) > * > *,
.table > :not(caption) > * > * {
    background-color: transparent !important;
    color: #e0e0ff !important;
    box-shadow: none !important;
    border-bottom-color: rgba(110, 231, 255, 0.3) !important;
}

/* 3. CELLULES ET EN-TÊTES */
html > body .table td,
html > body .table th,
html > body table td,
html > body table th,
.table td, .table th,
table td, table th {
    background-color: transparent !important;
    color: #e0e0ff !important;
    border-color: rgba(110, 231, 255, 0.3) !important;
}

/* 4. EN-TÊTES DE TABLE */
html > body .table thead th,
html > body table thead th,
.table thead th,
table thead th {
    background: rgba(110, 231, 255, 0.15) !important;
    color: #6ee7ff !important;
    font-weight: 600 !important;
    border-bottom: 2px solid rgba(110, 231, 255, 0.4) !important;
}

/* 5. APPLIQUER AUX TABLES */
html > body .table,
html > body table,
.table, table {
    --bs-table-bg: transparent !important;
    --bs-table-color: #e0e0ff !important;
    background-color: transparent !important;
    color: #e0e0ff !important;
}

/* ========= THÈME COSMIQUE - OVERRIDE PROPRE ========= */

/* Variables */
:root {
    --cosmic-bg: #0a0a0f;
    --cosmic-navbar: #1e1432;
    --cosmic-card: #1c162f;
    --cosmic-text: #e0e0ff;
    --cosmic-accent: #7b68ee;
}

/* Body */
html > body {
    background-color: var(--cosmic-bg) !important;
    color: var(--cosmic-text) !important;
    min-height: 100vh;
}

/* Navbar */
body .navbar,
body nav.navbar,
body .navbar.navbar-expand-lg {
    background: linear-gradient(135deg, var(--cosmic-navbar), #2d1b4d) !important;
    border-bottom: 2px solid var(--cosmic-accent) !important;
    box-shadow: 0 5px 30px rgba(123, 104, 238, 0.4) !important;
}

/* Cards */
body .card,
body .card-body,
body [class*="card"] {
    background: linear-gradient(135deg, var(--cosmic-card), #292043) !important;
    border: 1px solid var(--cosmic-accent) !important;
    color: var(--cosmic-text) !important;
    border-radius: 12px !important;
}

/* Bootstrap overrides */
body .bg-white,
body .bg-light {
    background-color: var(--cosmic-card) !important;
    color: var(--cosmic-text) !important;
}

body .text-dark,
body .text-muted,
body .text-black {
    color: var(--cosmic-text) !important;
}

/* Links */
body a:not(.btn) {
    color: #9d8aff !important;
}

body a:not(.btn):hover {
    color: var(--cosmic-accent) !important;
}

/* Primary buttons */
body .btn-primary {
    background: linear-gradient(135deg, var(--cosmic-accent), #6a5acd) !important;
    border-color: var(--cosmic-accent) !important;
}

/* Forms */
body .form-control,
body .form-select {
    background-color: #151025 !important;
    border-color: var(--cosmic-accent) !important;
    color: var(--cosmic-text) !important;
}

/* ========= OVERRIDE FINAL POUR LES BOUTONS ========= */
.btn-primary:hover {
    background: linear-gradient(135deg, #8a7bf0, #7b68ee) !important;
    border-color: #8a7bf0 !important;
}

/* ========= CORRECTION TITRES ACTUALITÉS ========= */
.news .card-title,
.news h2, .news h3, .news h4,
#news .card-title,
#news h2, #news h3, #news h4 {
    color: #ffffff !important;
}

/* Titres dans les cartes d'actualités */
.card .card-title,
.card h2, .card h3, .card h4,
.card-body .card-title,
.card-body h2, .card-body h3, .card-body h4 {
    color: #ffffff !important;
}

/* SOLUTION MINIMALE POUR CKEDITOR */
.ck-content,
.ck-editor__editable {
    background: white !important;
    color: black !important;
}

.ck-content p,
.ck-editor__editable p {
    color: black !important;
}

/* ========= RÉGLAGE DU LOGO (PC & Mobile) - VERSION FORTE ========= */
.navbar-brand img,
.navbar-brand .d-sm-block,
.site-logo img,
img.logo,
img[src*="logo"],
body img[alt*="Humalya"],
.my-4 {
    max-height: 120px !important;
    width: auto !important;
    height: auto !important;
}

/* ============================================
   CARTE "INFRASTRUCTURE PROFESSIONNELLE" - VPS
   ============================================ */

/* 1. LA CARTE PRINCIPALE - VERSION DATA-CENTER */
.card-vps-rack {
    display: block;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: white;
    padding: 1.5rem;
    min-height: 180px;
    height: 100%;
    
    /* Fond avec overlay sombre + image data-center */
    background: 
        linear-gradient(rgba(10, 20, 40, 0.85), rgba(5, 10, 25, 0.9)),
        url('https://images.unsplash.com/photo-1597852074816-d933c7d2b988?q=80&w=800&auto=format&fit=crop') 
        center / cover !important;
    
    /* Ombre et transition */
    box-shadow: 0 8px 20px rgba(0, 20, 60, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(100, 150, 255, 0.15);
}

/* Effet au survol/touch */
.card-vps-rack:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 30, 80, 0.4);
    border-color: rgba(100, 180, 255, 0.3);
}

/* 2. EFFET "LUMIÈRES LED" SUR LES BORDS */
.card-vps-rack::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent, 
        #00f7ff, 
        #0066ff, 
        #00f7ff, 
        transparent);
    z-index: 1;
    opacity: 0.7;
}

/* 3. CONTENU INTERNE */
.card-vps-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* 4. EN-TÊTE AVEC ICÔNE */
.card-vps-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.card-vps-icon {
    font-size: 1.2rem;
    background: rgba(0, 150, 255, 0.2);
    padding: 8px;
    border-radius: 10px;
    border: 1px solid rgba(0, 200, 255, 0.3);
}

/* 5. TITRE ET SOUS-TITRE */
.card-vps-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.card-vps-subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
    line-height: 1.4;
    margin: 0;
    font-weight: 300;
}

/* 6. BOUTON "INSTANTANÉ" DANS LA CARTE */
.card-vps-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.95) !important;
    color: #0066cc !important;
    padding: 10px 22px !important;
    border-radius: 50px;
    font-weight: 700 !important;
    text-decoration: none !important;
    margin-top: 1rem;
    width: fit-content;
    border: 2px solid transparent;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.card-vps-button:hover {
    background: white !important;
    transform: scale(1.05);
    color: #0044aa !important;
    border-color: #00ccff;
    box-shadow: 0 6px 16px rgba(0, 100, 255, 0.3);
}

/* 7. BADGE "INSTANT" */
.card-vps-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 255, 200, 0.15);
    color: #00ffd5;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid rgba(0, 255, 200, 0.3);
    backdrop-filter: blur(5px);
}

/* 8. VERSION MOBILE OPTIMISÉE */
@media (max-width: 768px) {
    .card-vps-rack {
        min-height: 160px;
        padding: 1.2rem;
    }
    
    .card-vps-title {
        font-size: 1.3rem;
    }
    
    .card-vps-button {
        padding: 8px 18px !important;
        font-size: 0.85rem;
    }
}

/* ========= CORRECTIONS UNIQUEMENT POUR TÉLÉPHONE MOBILE (< 768px) ========= */
@media only screen and (max-width: 767px) {

    /* 1. AFFICHER ET REDIMENSIONNER LE LOGO SUR MOBILE */
    .navbar-brand img {
        display: block !important;
        max-height: 60px !important;
        width: auto !important;
        height: auto !important;
    }
    .navbar-brand .d-sm-none {
        display: none !important;
    }
    
    /* ========= AMÉLIORATION DE LA VISIBILITÉ DU MENU HAMBURGER ========= */

    /* Style du bouton hamburger */
    .navbar-toggler {
        border: 2px solid var(--cosmic-accent, #7B68EE) !important;
        background-color: rgba(123, 104, 238, 0.2) !important;
        padding: 0.5rem 0.75rem !important;
        border-radius: 8px !important;
    }

    .navbar-toggler:hover,
    .navbar-toggler:focus {
        background-color: rgba(123, 104, 238, 0.4) !important;
        border-color: #9370DB !important;
        box-shadow: 0 0 10px rgba(123, 104, 238, 0.6) !important;
    }

    /* Style des barres du hamburger */
    .navbar-toggler-icon {
        background-image: none !important;
        width: 24px !important;
        height: 20px !important;
        position: relative !important;
        display: inline-block !important;
    }

    /* Créer les 3 barres du hamburger */
    .navbar-toggler-icon::before,
    .navbar-toggler-icon::after {
        content: '' !important;
        position: absolute !important;
        width: 100% !important;
        height: 3px !important;
        left: 0 !important;
        background-color: var(--cosmic-accent, #7B68EE) !important;
        transition: all 0.3s ease !important;
    }

    .navbar-toggler-icon::before {
        top: 0 !important;
    }

    .navbar-toggler-icon::after {
        bottom: 0 !important;
    }

    /* Barre du milieu */
    .navbar-toggler-icon {
        background-color: var(--cosmic-accent, #7B68EE) !important;
        height: 3px !important;
        display: block !important;
        margin: 8px 0 !important;
    }

    /* Animation au survol */
    .navbar-toggler:hover .navbar-toggler-icon::before {
        transform: translateY(-2px) !important;
    }

    .navbar-toggler:hover .navbar-toggler-icon::after {
        transform: translateY(2px) !important;
    }

    /* 2. EMPÊCHER LES TITRES, BADGES ET TEXTES DE DÉBORDER */
    .card-title,
    .card h1, .card h2, .card h3, .card h4,
    .badge,
    .lead,
    .text-truncate {
        white-space: normal !important;
        overflow-wrap: break-word !important;
        word-wrap: break-word !important;
    }
    .d-flex.justify-content-center .badge {
        font-size: 0.8rem !important;
        padding: 0.4rem 0.6rem !important;
        display: inline-block;
        margin-bottom: 0.25rem;
    }

    /* 3. OPTIMISATION DES CARTES */
    .card, .well, .dashboard-card {
        margin-bottom: 1rem !important;
        padding: 1rem !important;
    }
    .card-title, .card h3, .card h4 {
        font-size: 1.1rem !important;
        line-height: 1.4;
    }

    /* 4. OPTIMISATION SPÉCIFIQUE DES CARTES PRODUIT */
    .product-card .card-body {
        padding: 1rem !important;
    }
    .product-card .list-group-item {
        font-size: 0.9rem;
        padding: 0.5rem 0.75rem;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    .product-card .btn-lg {
        padding: 0.75rem !important;
        font-size: 1rem !important;
        margin-top: 1rem;
    }

    /* 5. TABLEAU DE BORD & TABLES */
    .table-responsive {
        border: 1px solid rgba(110, 231, 255, 0.2) !important;
        border-radius: 8px;
        margin-bottom: 1rem;
    }
    .table td, .table th {
        padding: 0.5rem !important;
        font-size: 0.9rem;
    }

    /* 6. FORMULAIRES */
    .form-control, .form-select, input[type="text"], input[type="email"], input[type="password"] {
        font-size: 16px !important;
        min-height: 44px !important;
        padding: 0.5rem 0.75rem !important;
    }
    .form-label, label {
        font-weight: 600 !important;
        margin-bottom: 0.25rem !important;
        display: block;
    }

    /* 7. BOUTONS */
    .btn {
        min-height: 44px !important;
        padding: 0.5rem 1.5rem !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    .modal-footer .btn, .card-actions .btn {
        width: 100% !important;
        margin-bottom: 0.5rem;
    }

    /* 8. MODALES */
    .modal-dialog {
        margin: 0.5rem !important;
        max-width: calc(100vw - 1rem) !important;
    }
    .modal-content {
        padding: 1rem !important;
    }

    /* 9. NAVIGATION */
    .navbar-collapse, .offcanvas-body {
        background: var(--cosmic-navbar) !important;
    }

    /* 10. WIDGETS DU TABLEAU DE BORD */
    .dashboard-stats .col, .row .col {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        margin-bottom: 1rem;
    }
    .dashboard-stats h3,
    .dashboard-stats .h2 {
        font-size: 1.5rem !important;
    }
    .small-card .card-body {
        padding: 0.75rem !important;
    }

    /* 11. AMÉLIORATION DU MENU PARTIAL (ADMIN - BOUTON +) */
    .card-actions .btn-action {
        min-height: 44px !important;
        min-width: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    .card-actions .dropdown-menu {
        position: absolute !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        margin-top: 0.5rem !important;
        min-width: 200px !important;
        background: var(--cosmic-card) !important;
        border: 1px solid var(--cosmic-accent) !important;
        z-index: 1050 !important;
    }
    .card-actions .dropdown-menu .menu_body {
        padding: 0.5rem 0 !important;
    }
    .card-actions .dropdown-menu li {
        display: block !important;
        width: 100% !important;
    }
    .card-actions .dropdown-menu a {
        color: #e0e0ff !important;
        padding: 0.75rem 1rem !important;
        display: block !important;
        white-space: nowrap !important;
        border-bottom: 1px solid rgba(123, 104, 238, 0.1) !important;
    }
    .card-actions .dropdown-menu a:hover {
        background: rgba(123, 104, 238, 0.2) !important;
        color: var(--cosmic-accent) !important;
    }
    .card-actions .dropdown-menu li:last-child a {
        border-bottom: none !important;
    }
    
    /* 12. ALIGNEMENT DES BOUTONS COMMANDES ET TICKETS À DROITE */
    .card .btn.order-button,
    .card a.btn[href*="order/service"],
    .card a.btn[href*="support"][href$="support"] {
        margin-left: auto !important;
        display: block !important;
        width: fit-content !important;
        margin-right: 0 !important;
    }

    /* 13. ESPACEMENT AU-DESSUS DU TITRE COMMANDES */
    .btn.order-button + span.h6.m-0.pt-1 {
        margin-top: 1rem !important;
        padding-top: 0.75rem !important;
    }

    /* 14. ALIGNEMENT DES CONTENEURS FLEX À GAUCHE DANS LES CARTES */
    .card .d-flex.justify-content-center,
    .well .d-flex.justify-content-center {
        justify-content: flex-start !important;
        padding-left: 1rem !important;
    }

} /* FIN DU BLOC MOBILE */