/* =========================================================
   THEME.CSS
   ⚠️ Ne pas toucher aux couleurs ici - voir colors.css
========================================================= */

/* =========================
   FONT MODERNE
========================= */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

/* =========================
   PAGE LOADER
========================= */
#pageLoader{
    position: fixed;
    inset: 0;
    background: var(--background-color);
    z-index: 9999;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}
#pageLoader.loaded{
    opacity: 0;
    visibility: hidden;
}
.loader-spinner{
    width: 46px;
    height: 46px;
    border: 4px solid var(--border-loader);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin{ to{ transform: rotate(360deg); } }

/* =========================
   BODY 
========================= */

html {
    height: 100%;
}

body{
    font-family: 'Poppins', sans-serif;
    color: var(--text-color);
    min-height: 100vh;
    background: var(--background-color);
    overflow-x: hidden;

    /* Layout flex pour coller le footer en bas */
    display: flex;
    flex-direction: column;
}
main{
    flex: 1 0 auto;
}

.footer-custom{
    flex-shrink: 0;
}

/* =========================
   NAVBAR (sticky blur + active link)
========================= */

.navbar{
    background: var(--navbar-bg-gradient) !important;
    box-shadow: 0 4px 18px var(--navbar-shadow);
    border-bottom: 3px solid var(--transparent);
    border-image: linear-gradient(90deg, var(--footer-green), var(--primary-color));
    border-image-slice: 1;
}

.navbar.scrolled{
    background: var(--navbar-bg-gradient) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 6px 20px var(--navbar-scrolled-shadow);
}

.navbar-brand span{
    font-weight: 600;
    letter-spacing: 0.3px;
}

.navbar .nav-link{
    position: relative;
    transition: none !important;
    color: var(--white) !important;
}

.navbar .nav-link:hover{
    color: var(--white) !important;
    transform: none !important;
}

.navbar .nav-link.active{
    color: var(--white) !important;
}

.navbar:hover,
.navbar.scrolled:hover{
    background: var(--navbar-bg-gradient) !important;
}

.navbar .nav-link.active::after{
    content:"";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 0px;
    height: 2px;
    background: var(--footer-green-light);
    border-radius: 2px;
    animation: underlineGrow 0.3s ease;
}

@keyframes underlineGrow{
    from{ transform: scaleX(0); }
    to{ transform: scaleX(1); }
}

/* =========================
   CARD (Glassmorphism)
========================= */

.card{
    border: none !important;
    border-radius: var(--radius-lg) !important;
    background: var(--card-bg) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

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

.card-header{
    background: var(--gradient-hero) !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    font-weight: 600;
    letter-spacing: 0.8px;
    padding: 18px 20px !important;
}

/* =========================
   FORM - FLOATING LABELS + ICONS
========================= */

.floating-group{
    position: relative;
    margin-bottom: 24px;
}

.floating-input{
    height: 52px;
    width: 100%;
    padding: 20px 44px 6px 44px !important;
    border-radius: var(--radius-md) !important;
    border: 1.5px solid var(--border-input) !important;
    background: var(--input-bg) !important;
}

.floating-input:focus{
    border-color: var(--primary-color) !important;
    background: var(--surface-color) !important;
    box-shadow: 0 0 0 4px var(--primary-soft) !important;
}

.floating-label{
    position: absolute;
    top: 50%;
    left: 44px;
    transform: translateY(-50%);
    color: var(--label-muted);
    font-size: 14px;
    pointer-events: none;
    background: var(--transparent);
}

.floating-input:focus ~ .floating-label,
.floating-input:not(:placeholder-shown) ~ .floating-label{
    top: 13px;
    font-size: 11px;
    color: var(--primary-color);
    font-weight: 600;
}

.input-icon{
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--icon-muted);
    font-size: 15px;
    z-index: 2;
}

.floating-group:focus-within .input-icon{
    color: var(--primary-color);
}

.password-toggle{
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--icon-muted);
    cursor: pointer;
    z-index: 2;
    font-size: 14px;
    transition: color 0.2s ease;
}

.password-toggle:hover{
    color: var(--primary-color);
}

/* =========================
   BOUTONS (gradient + shine + spinner)
========================= */

.btn-primary{
    background: var(--gradient-primary) !important;
    border: none !important;
    border-radius: var(--radius-md) !important;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 12px 18px !important;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover{
    box-shadow: var(--shadow-primary-hover);
}

.btn-primary:active{
    transform: translateY(0);
}

.search-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.search-input-group .form-control {
    min-width: 0;
    border-top-right-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
}

.search-input-group .btn-search-group {
    border-top-left-radius: var(--radius-md);
    border-bottom-left-radius: var(--radius-md);
    width: auto !important;
    min-width: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-input-group .btn-search-group i {
    font-size: 1rem;
}

@media (max-width: 767px) {
    .search-input-group {
        gap: 0.35rem;
    }

    .search-input-group .form-control {
        font-size: 0.95rem;
    }

    .search-input-group .btn-search-group {
        width: auto !important;
        min-width: 3.2rem;
        padding: 0.55rem 0.75rem !important;
    }
}

.btn-loading{
    pointer-events: none;
}

.btn-loading .btn-text{
    visibility: hidden;
}

.btn-loading::before{
    content:"";
    position: absolute;
    width: 18px;
    height: 18px;
    top: calc(50% - 9px);
    left: calc(50% - 9px);
    border: 3px solid var(--button-spinner-border);
    border-top-color: var(--button-spinner-top);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* =========================
   PAGE TITLE
========================= */

.page-title{
    color: var(--page-title-color);
    font-size: clamp(2.2rem, 4vw, 3.2rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;

    display: inline-block;
    position: relative;

    margin-bottom: 1rem;
    padding-bottom: 0.75rem;

    text-shadow: 0 2px 8px var(--text-shadow-color);
}

/* =========================
   FOOTER (with animations)
========================= */

.footer-custom{
    background: var(--gradient-dark);
    color: var(--footer-text);
    border-top: 4px solid var(--footer-green);
    padding: 45px 0 0;
    position: relative;
}

.footer-logo{
    display: block;
    margin-left: auto;
    margin-right: auto;
    max-width:180px;
    width:100%;
    height:auto;
    border-radius: 10px;
    box-shadow: 0 6px 20px var(--footer-shadow-lg);
    transition: transform 0.3s ease;
}

.footer-logo:hover{
    transform: scale(1.03);
}

.footer-item{
    position: relative;
}

.footer-item[data-tooltip]:hover::before{
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: var(--primary-color);
    color: var(--tooltip-text);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    box-shadow: 0 4px 10px var(--tooltip-shadow);
    z-index: 10;
    opacity: 0;
    animation: tooltipFade 0.25s ease forwards;
}

@keyframes tooltipFade{
    to{ opacity:1; }
}

.footer-icon{
    width: 54px;
    height: 54px;
    font-size: 22px;
    border-radius: 50%;
    background: var(--transparent) !important;
    color: var(--white) !important;
    border: 1px solid var(--footer-icon-border) !important;
    transition: all 0.3s ease;
}

.footer-item:hover .footer-icon{
    background: var(--footer-green) !important;
    border-color: var(--footer-green) !important;
    transform: scale(1.08) !important;
    box-shadow: none !important;
}

.footer-custom a{
    color: var(--white) !important;
    text-decoration: none !important;
    font-size:15px;
    font-weight:700;
}

.footer-custom a:hover{
    color: var(--white) !important;
    text-decoration: none !important;
}

.footer-bottom{
    background: var(--gradient-footer-bar);
    color: var(--footer-text);
    padding:14px 0;
    font-weight:600;
    margin-top: 35px;
}

.footer-bottom a{
    color: var(--white) !important;
    text-decoration: none !important;
    font-weight:700;
}

.footer-bottom a:hover{
    color: var(--white) !important;
    text-decoration: none !important;
}

/* =========================
   DATATABLES ADAPTATIONS
========================= */
#languesTable td,
#languesTable th {
    white-space: normal !important;
    word-wrap: break-word !important;
}

.dt-buttons .btn {
    padding: 0.375rem 0.75rem !important;
    font-size: 0.875rem !important;
    margin-right: 5px !important;
}

.dataTables_wrapper .dataTables_paginate {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    padding-top: 10px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.3em 0.6em !important;
    font-size: 0.75em !important;
    margin: 0.1em !important;
    min-width: 30px !important;
}

.dataTables_wrapper .dataTables_paginate .previous,
.dataTables_wrapper .dataTables_paginate .next {
    width: auto !important;
    padding: 0.3em 0.8em !important;
}

.dataTables_wrapper {
    width: 100%;
    overflow-x: hidden;
}

.dataTables_jump {
    margin-top: 10px;
    margin-bottom: 10px;
}

.dataTables_jump .dt-page-input {
    width: 80px;
}

@media (max-width: 768px) {
    .dataTables_wrapper .dt-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
        margin-bottom: 10px;
    }
    .dataTables_wrapper .dataTables_length {
        margin-bottom: 10px;
        width: 100%;
    }
    .dataTables_wrapper .dataTables_length select {
        width: auto;
    }
}

/* =========================
   SCROLL TO TOP
========================= */

#scrollTopBtn{
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: var(--scrolltop-text);
    border: none;
    box-shadow: var(--shadow-primary);
    display: none;
    font-size: 18px;
    cursor: pointer;
    z-index: 999;
}

/* =========================
   ALERT MESSAGE RECHERCHE
========================= */

.search-alert {
    background: var(--alert-info-bg);
    color: var(--alert-info-text);
    border: 1px solid var(--alert-border);
    border-radius: 12px;
    padding: 0.8rem 0.95rem;
    margin: 20px auto;
    max-width: 600px;
    text-align: center;
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.5;
    box-shadow: 0 10px 20px var(--alert-info-shadow);
}

.search-alert strong {
    font-weight: 700;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 767px) {
    body::before,
    body::after {
        display: none;
    }

    .navbar {
        padding: 0.4rem 1rem;
    }

    .navbar-brand span {
        font-size: 1rem;
    }

    .navbar .nav-link {
        padding: 0.55rem 0.5rem;
        font-size: 0.95rem;
    }

    .navbar .navbar-collapse {
        padding: 0.75rem 0;
    }

    .page-title {
        font-size: 2rem;
        margin-bottom: 0.75rem;
        padding-bottom: 0.5rem;
    }

    .card {
        margin-bottom: 1rem;
    }

    .card-header {
        padding: 14px 16px !important;
    }

    .card-body {
        padding: 16px;
    }

    .floating-input {
        padding: 16px 40px 8px 40px !important;
        height: 48px;
        font-size: 0.95rem;
    }

    .floating-label {
        left: 40px;
        font-size: 0.9rem;
    }

    .input-icon {
        left: 12px;
    }

    .password-toggle {
        right: 12px;
    }

    .btn-primary {
        width: 100%;
        padding: 11px 16px !important;
        font-size: 0.96rem;
    }

    .footer-custom {
        padding: 30px 0 0;
    }

    .footer-logo {
        max-width: 140px;
    }

    .footer-icon {
        width: 46px;
        height: 46px;
        font-size: 20px;
    }

    .footer-custom a {
        font-size: 0.9rem;
    }

    .footer-bottom {
        padding: 12px 0;
    }

    .search-alert {
        padding: 0.75rem 0.85rem;
        margin: 16px auto;
        max-width: 94%;
        font-size: 0.96rem;
    }

    .dataTables_wrapper {
        overflow-x: auto;
    }

    .dataTables_wrapper .dt-buttons,
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0.65rem;
        align-items: center;
        justify-content: space-between;
    }

    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        margin-bottom: 0.5rem;
    }

    .dt-buttons .btn {
        width: 100%;
        max-width: 100%;
        margin-right: 0 !important;
        font-size: 0.92rem !important;
    }

    .dataTables_wrapper .dataTables_paginate {
        justify-content: center;
    }

    .dataTables_wrapper .dataTables_paginate .paginate_button {
        font-size: 0.82rem !important;
    }
}

/* =========================
   RESULTATS DE RECHERCHE
========================= */

.results-row{
    width:100%;
    justify-content:center;
}

.results-row .card{
    width:100%;
}

/* Mobile : 1 colonne */
@media (max-width:767.98px){
    .results-row > .col{
        flex:0 0 100%;
        max-width:100%;
    }
}

/* Tablette portrait : 2 colonnes */
@media (min-width:768px) and (max-width:1023.98px){
    .results-row > .col{
        flex:0 0 50%;
        max-width:50%;
    }
}

/* Tablette paysage : 3 colonnes */
@media (min-width:1024px) and (max-width:1199.98px){
    .results-row > .col{
        flex:0 0 33.333333%;
        max-width:33.333333%;
    }
}

/* Ordinateur : 4 colonnes */
@media (min-width:1200px){
    .results-row > .col{
        flex:0 0 25%;
        max-width:25%;
    }
}
@media (min-width: 768px) and (max-width: 880px) {
    .navbar {
        padding: 0.5rem 1rem;
    }

    .navbar-brand span {
        font-size: 1.05rem;
    }

    .navbar .nav-link {
        padding: 0.6rem 0.65rem;
        font-size: 0.98rem;
    }

    .page-title {
        font-size: 2.35rem;
    }

    .card-header {
        padding: 16px 18px !important;
    }

    .floating-input {
        padding: 18px 42px 8px 42px !important;
        height: 50px;
        font-size: 0.98rem;
    }

    .floating-label {
        font-size: 0.92rem;
    }

    .btn-primary {
        padding: 11px 18px !important;
        font-size: 1rem;
    }

    .footer-custom {
        padding: 35px 0 0;
    }

    .footer-bottom {
        padding: 13px 0;
    }

    .footer-custom a {
        font-size: 0.92rem;
    }

    .dataTables_wrapper .dt-buttons {
        flex-wrap: wrap;
    }
}

@media (min-width: 881px) and (max-width: 1024px) {
    .navbar {
        padding: 0.6rem 1.25rem;
    }

    .navbar-brand span {
        font-size: 1.1rem;
    }

    .navbar .nav-link {
        padding: 0.7rem 0.8rem;
        font-size: 1rem;
    }

    .page-title {
        font-size: 2.7rem;
    }

    .card-header {
        padding: 18px 20px !important;
    }

    .floating-input {
        padding: 18px 44px 8px 44px !important;
        height: 52px;
        font-size: 1rem;
    }

    .floating-label {
        font-size: 0.95rem;
    }

    .btn-primary {
        padding: 12px 20px !important;
        font-size: 1rem;
    }

    .footer-custom {
        padding: 38px 0 0;
    }

    .dataTables_wrapper .dt-buttons {
        justify-content: flex-start;
        gap: 0.8rem;
    }

    .dt-buttons .btn {
        font-size: 0.95rem !important;
    }
}

@media (min-width: 1025px) and (max-width: 1200px) {
    .navbar {
        padding: 0.7rem 1.5rem;
    }

    .navbar-brand span {
        font-size: 1.15rem;
    }

    .navbar .nav-link {
        padding: 0.8rem 0.9rem;
        font-size: 1.02rem;
    }

    .page-title {
        font-size: 2.9rem;
    }

    .card-header {
        padding: 20px 22px !important;
    }

    .btn-primary {
        padding: 12px 22px !important;
        font-size: 1.02rem;
    }

    .footer-custom {
        padding: 40px 0 0;
    }

    .footer-custom a {
        font-size: 0.98rem;
    }
}

@media (min-width: 1201px) and (max-width: 1366px) {
    .navbar {
        padding: 0.8rem 1.75rem;
    }

    .navbar .nav-link {
        padding: 0.85rem 1rem;
        font-size: 1.05rem;
    }

    .page-title {
        font-size: 3.1rem;
    }

    .card {
        margin-bottom: 1.15rem;
    }

    .footer-custom {
        padding: 42px 0 0;
    }

    .footer-custom a {
        font-size: 1rem;
    }

    .dataTables_wrapper {
        overflow-x: visible;
    }
}

@media (min-width: 2400px) {
    .page-title {
        font-size: 4rem;
        letter-spacing: -0.05em;
    }

    .navbar {
        padding: 1rem 2rem;
    }

    .navbar .nav-link {
        padding: 1rem 1.1rem;
        font-size: 1.05rem;
    }

    .card {
        margin-bottom: 1.4rem;
    }

    .card-header {
        padding: 22px 24px !important;
    }

    .btn-primary {
        padding: 13px 24px !important;
        font-size: 1.1rem;
    }

    .footer-custom {
        padding: 50px 0 0;
    }

    .footer-bottom {
        padding: 16px 0;
    }

    .footer-custom a {
        font-size: 1rem;
    }
}

/* =========================
   NAVBAR APP MODE (Recherche/Tableau/Admin) - PAS sur login
========================= */

.navbar-app-mode .nav-link i {
    font-size: 0.9em;
}

/* =========================
   TOGGLE RECHERCHE EXACTE - plus visible
========================= */

.form-switch-lg .form-check-input {
    width: 3.2em;
    height: 1.7em;
    cursor: pointer;
}

.form-switch-lg .form-check-input:checked {
    background-color: var(--footer-green) !important;
    border-color: var(--footer-green) !important;
}

.form-switch-lg .form-check-label {
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
}

.form-switch-lg .badge {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 6px 14px;
    border-radius: 999px;
    color: var(--white);
    box-shadow: var(--shadow-soft);
}

.badge-on {
    background-color: var(--success-color);
}

.badge-off {
    background-color: var(--text-muted);
}

/* =========================
   BOUTON SPEAKER (text-to-speech)
========================= */

.btn-speak {
    background: none;
    border: none;
    color: var(--btn-speak-color);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 50%;
}

.btn-speak:active {
    transform: scale(0.95);
}

.results-row{
    width: calc(100% + 24px);
    margin-left: -12px;
    margin-right: -12px;
}
.navbar-toggler {
    border-color: rgba(255,255,255,0.5);
}

.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(255,255,255,1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2.5' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}