/* ============================================
   TDNV - Modern UI Redesign 2026
   Only applies to user/mobile interface.
   Admin mode is excluded via body.admin-mode
   ============================================ */

/* --- CSS Variables --- */
:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d28;
    --bg-card: rgba(26, 29, 40, 0.85);
    --bg-glass: rgba(255, 255, 255, 0.05);
    --bg-glass-hover: rgba(255, 255, 255, 0.08);
    --border-glass: rgba(255, 255, 255, 0.1);
    --border-glass-hover: rgba(255, 255, 255, 0.2);
    --text-primary: #f0f0f5;
    --text-secondary: #9ca3b4;
    --text-muted: #5c6478;
    --accent-green: #22c55e;
    --accent-green-dim: rgba(34, 197, 94, 0.15);
    --accent-blue: #3b82f6;
    --accent-blue-dim: rgba(59, 130, 246, 0.15);
    --accent-orange: #f59e0b;
    --accent-orange-dim: rgba(245, 158, 11, 0.15);
    --accent-red: #ef4444;
    --accent-red-dim: rgba(239, 68, 68, 0.15);
    --accent-purple: #8b5cf6;
    --accent-purple-dim: rgba(139, 92, 246, 0.15);
    --accent-cyan: #06b6d4;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================
   USER / MOBILE INTERFACE
   ========================================= */

/* --- Font --- */
*:not(.fas):not(.far):not(.fab):not(.fa):not(.fa-solid):not(.fa-regular):not(.fa-brands) {
    font-family: 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif !important;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

{
    margin: 0;
    width: 100%;
    height: 100%;
    font-size: 15px !important;
    background-color: var(--bg-primary) !important;
    background-image: none !important;
    color: var(--text-primary);
    overflow: hidden;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    padding-top: 0 !important;
}

/* Subtle animated gradient background */
body:not(.admin-mode)::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 20% 50%, rgba(34, 197, 94, 0.06) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 20%, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
                radial-gradient(ellipse at 50% 80%, rgba(139, 92, 246, 0.04) 0%, transparent 50%);
    animation: bgShift 20s ease-in-out infinite alternate;
    z-index: -1;
    pointer-events: none;
}

@keyframes bgShift {
    0% { transform: translate(0, 0); }
    100% { transform: translate(3%, -3%); }
}

/* --- Main Containers --- */
#main,
#main2 {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Smooth scrolling */
#main,
#main2 {
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}
#main::-webkit-scrollbar,
#main2::-webkit-scrollbar {
    width: 6px;
}
#main::-webkit-scrollbar-thumb,
#main2::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
}

/* --- Login Page --- */
#login {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    text-align: center;
    overflow-y: auto;
    background: var(--bg-primary);
    display: flex !important;
    align-items: center;
    justify-content: center;
}

#blockLogin {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 90% !important;
    max-width: 380px !important;
    background: var(--bg-card) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    padding: 40px 32px !important;
    border-radius: var(--radius-xl) !important;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.6s ease-out;
}

#blockLogin img {
    height: 100px !important;
    filter: invert(1) brightness(1.1) !important;
    margin-bottom: 8px;
}

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

/* --- Typography --- */
h1 {
    color: var(--text-primary);
    font-size: 2.2em !important;
    font-weight: 700;
    letter-spacing: -0.02em;
}

h5 {
    color: var(--text-primary);
    font-size: 1.4em !important;
    font-weight: 600;
    margin: 12px;
    padding: 0;
}

.labelInput {
    color: var(--accent-green) !important;
    text-transform: uppercase;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 1.5px;
}

/* --- Form Elements (scoped to user interface) --- */
#login input,
#main input,
#main2 input,
.backSombre input,
#fenetreInscription input {
    width: 100%;
    background: var(--bg-glass) !important;
    border: 1px solid var(--border-glass) !important;
    border-radius: var(--radius-sm) !important;
    padding: 12px 16px !important;
    color: var(--text-primary) !important;
    height: 48px !important;
    outline: none;
    font-size: 15px !important;
    text-align: left !important;
    transition: var(--transition);
    margin-top: 6px;
}

#login input::placeholder,
#main input::placeholder,
#main2 input::placeholder {
    color: var(--text-muted);
}

#login input:focus,
#main input:focus,
#main2 input:focus,
.backSombre input:focus,
#fenetreInscription input:focus {
    box-shadow: 0 0 0 2px var(--accent-green) !important;
    border-color: var(--accent-green) !important;
    background: rgba(34, 197, 94, 0.05) !important;
}

.inputBlack {
    color: var(--text-primary) !important;
    background: var(--bg-glass) !important;
}

.inputBlack:disabled {
    color: var(--text-secondary) !important;
    border: 1px solid var(--border-glass) !important;
    opacity: 0.7;
}

.wrongInput {
    border: 2px solid var(--accent-red) !important;
    background: var(--accent-red-dim) !important;
}

/* --- Buttons (scoped to user interface) --- */
#login button,
#main button,
#main2 button,
.backSombre button,
#fenetreInscription button {
    width: 100%;
    border: none !important;
    padding: 14px 24px !important;
    color: #fff !important;
    background: linear-gradient(135deg, #22c55e, #16a34a) !important;
    height: auto !important;
    min-height: 48px;
    outline: none;
    text-align: center;
    text-transform: uppercase;
    font-weight: 600 !important;
    font-size: 14px !important;
    letter-spacing: 1px;
    cursor: pointer;
    border-radius: var(--radius-sm) !important;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

#login button:hover,
#main button:hover,
#main2 button:hover,
.backSombre button:hover,
#fenetreInscription button:hover {
    background: linear-gradient(135deg, #16a34a, #15803d) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

#login button:active,
#main button:active,
#main2 button:active {
    transform: translateY(0);
    background: linear-gradient(135deg, #15803d, #166534) !important;
}

.backSombre .buttonGreen {
    background: linear-gradient(135deg, #22c55e, #16a34a) !important;
}
.backSombre .buttonRed {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
}
.backSombre .buttonRed:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c) !important;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3) !important;
}
.backSombre .buttonOrange {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
}
.backSombre .buttonDisabled {
    background: linear-gradient(135deg, #4b5563, #374151) !important;
    cursor: not-allowed;
    opacity: 0.6;
}

/* --- Dark Overlay Background --- */
.backSombre {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary) !important;
}

/* --- Top Navigation Bar --- */
h20 {
    width: 100%;
    text-align: center;
    text-transform: uppercase;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-primary);
    background: var(--bg-secondary) !important;
    border-bottom: 1px solid var(--border-glass);
    z-index: 98;
    margin: 0;
    position: absolute;
    top: 0;
    left: 0;
    height: 56px !important;
    padding-top: 18px !important;
    backdrop-filter: blur(10px);
}

.buttonBack {
    position: absolute;
    top: 10px;
    left: 12px;
    z-index: 99;
    height: 36px;
    filter: invert(1) brightness(0.9) !important;
    opacity: 0.7;
    transition: var(--transition);
    cursor: pointer;
}
.buttonBack:hover { opacity: 1; }
.buttonBack:active { filter: invert(1) brightness(0.7) !important; }

/* --- Main User Section --- */
#utilisateur {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100% !important;
    text-align: center;
    overflow-y: auto;
}

/* --- Menu Phone (Main Navigation Grid) --- */
#menuUtilisateur,
#menuInstructeur {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary) !important;
    overflow-y: auto;
}

.menuPhone {
    width: calc(50% - 36px) !important;
    max-width: 200px;
    height: 140px !important;
    float: left;
    margin: 12px !important;
    text-align: center;
    padding: 20px 10px !important;
    font-weight: 700 !important;
    font-size: 16px !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: var(--radius-lg) !important;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border: 1px solid var(--border-glass);
}

/* Modern menu card colors with gradients */
.menuPhone:nth-child(1) {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.05)) !important;
    border-color: rgba(59, 130, 246, 0.3) !important;
    color: #93bbfc !important;
}
.menuPhone:nth-child(2) {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(34, 197, 94, 0.05)) !important;
    border-color: rgba(34, 197, 94, 0.3) !important;
    color: #86efac !important;
}
.menuPhone:nth-child(3) {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.05)) !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
    color: #fcd34d !important;
}
.menuPhone:nth-child(4) {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(139, 92, 246, 0.05)) !important;
    border-color: rgba(139, 92, 246, 0.3) !important;
    color: #c4b5fd !important;
}
.menuPhone:nth-child(5) {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(6, 182, 212, 0.05)) !important;
    border-color: rgba(6, 182, 212, 0.3) !important;
    color: #67e8f9 !important;
}
.menuPhone:nth-child(6) {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.05)) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: #fca5a5 !important;
}

.menuPhone:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-md);
}
.menuPhone:active {
    transform: scale(0.97);
}

.menuPhone img {
    width: 36px;
    height: 36px;
    opacity: 0.85;
}

/* --- Course Cards --- */
.cours,
.interets,
.blockInscr,
.video {
    float: left;
    position: relative;
    width: calc(100% - 40px) !important;
    max-width: 440px;
    height: auto;
    background: var(--bg-card) !important;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    padding: 20px !important;
    padding-top: 56px !important;
    margin: 12px auto !important;
    text-align: left;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-sm);
    color: var(--text-primary) !important;
    font-size: 14px !important;
    line-height: 22px !important;
    transition: var(--transition);
    animation: fadeInUp 0.4s ease-out;
}

.cours:hover {
    border-color: var(--border-glass-hover);
    box-shadow: var(--shadow-md);
}

.coursTitre {
    position: absolute;
    background: linear-gradient(135deg, var(--bg-secondary), rgba(26, 29, 40, 0.95)) !important;
    color: var(--text-primary) !important;
    padding: 14px 0 !important;
    text-align: center;
    width: 100%;
    left: 0;
    top: 0;
    text-transform: uppercase;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    border-bottom: 1px solid var(--border-glass);
}

.cours h2 {
    position: absolute;
    background: linear-gradient(135deg, var(--accent-blue), #2563eb) !important;
    color: #fff !important;
    padding: 8px 0 !important;
    text-align: center;
    width: 100%;
    left: 0;
    top: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    font-size: 14px;
    margin: 0 !important;
}

.interets h2,
.equipement h2 {
    position: absolute;
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    padding: 10px 0 !important;
    text-align: center;
    width: calc(100% + 2px);
    margin-top: -56px;
    margin-left: -21px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-glass);
}

.prixCours {
    float: right;
    margin-top: 10px;
    background: var(--accent-green-dim);
    color: var(--accent-green) !important;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.programme {
    margin-top: 12px;
    margin-bottom: 0;
    padding: 12px;
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    font-size: 13px;
    line-height: 1.5;
}

.titreParticipants {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 8px;
}

/* --- Course Section --- */
#cours,
#accueil {
    position: absolute;
    top: 60px;
    left: 0;
    width: 100%;
    height: calc(100% - 60px) !important;
    text-align: center;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: flex-start;
}

#listeCours,
#listeMesCours {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    padding-bottom: 20px;
}

/* --- Participant Thumbnails --- */
.vignetteImage {
    width: 60px;
    height: auto;
    text-align: center;
    float: left;
    margin: 4px;
    font-size: 10px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.photoVignette {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border-glass) !important;
    border-radius: 50% !important;
    object-fit: cover;
    transition: var(--transition);
}

.photoProfil {
    border-radius: var(--radius-lg) !important;
    border: 3px solid var(--border-glass) !important;
    width: 50%;
    max-width: 160px;
    max-height: 300px;
    text-align: center;
    height: auto;
    margin: 10px;
    cursor: pointer;
    transition: var(--transition);
}

/* --- News --- */
#listeNews {
    margin-top: 56px !important;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding-bottom: 20px;
}

.news {
    width: calc(100% - 40px) !important;
    max-width: 440px;
    height: auto;
    background: var(--bg-card) !important;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    padding: 24px !important;
    text-align: left;
    border-radius: var(--radius-lg) !important;
    margin: 12px !important;
    color: var(--text-primary) !important;
    box-shadow: var(--shadow-sm);
    float: none !important;
    animation: fadeInUp 0.4s ease-out;
}

h33 {
    font-weight: 700 !important;
    font-size: 18px !important;
    color: var(--text-primary);
    margin: 0 0 8px 0 !important;
    padding: 0 !important;
    display: block;
}

/* --- Historique --- */
#listeHistorique {
    margin-top: 56px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding-bottom: 20px;
}

/* --- Settings / Profile --- */
#reglages {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100% !important;
    text-align: center;
    overflow-y: auto;
    background: none !important;
}

#reglages .interets {
    max-width: 440px;
    margin: 70px auto 20px auto !important;
}

#reglages table td {
    padding: 6px 4px;
    color: var(--text-secondary);
    font-size: 14px;
    vertical-align: middle;
}

/* --- Inscription --- */
#fenetreInscription {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary) !important;
    overflow-y: auto;
}

#blockInscr {
    width: calc(100% - 32px) !important;
    max-width: 420px !important;
    background: var(--bg-card) !important;
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    padding: 32px !important;
    border-radius: var(--radius-xl) !important;
    box-shadow: var(--shadow-lg);
    margin-top: 20px;
}

.infoBlanc {
    color: var(--text-secondary) !important;
    font-size: 13px;
    font-style: normal !important;
    line-height: 1.6;
    padding: 12px 16px;
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
}

/* --- Loader --- */
#loader {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 17, 23, 0.8) !important;
    backdrop-filter: blur(4px);
    z-index: 9999999999;
}

/* --- Misc --- */
.backSombre hr,
#main hr,
#main2 hr {
    border: none !important;
    height: 1px !important;
    background: var(--border-glass) !important;
    margin: 16px 0 !important;
}

img[src="images/disconnect.png"] {
    filter: invert(1) brightness(0.8) !important;
    opacity: 0.6;
    transition: var(--transition);
    height: 28px !important;
}
img[src="images/disconnect.png"]:hover {
    opacity: 1;
}

.backSombre a,
#login a,
#main a,
#main2 a {
    color: var(--accent-blue);
    text-decoration: none;
}

::selection {
    background: rgba(34, 197, 94, 0.3);
    color: #fff;
}

/* --- SweetAlert2 Dark Theme (user only) --- */
.swal2-popup {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-glass) !important;
    border-radius: var(--radius-xl) !important;
    backdrop-filter: blur(20px);
}
.swal2-title {
    color: var(--text-primary) !important;
}
.swal2-content,
.swal2-html-container {
    color: var(--text-secondary) !important;
}

/* --- Responsive Desktop --- */
@media screen and (min-width: 640px) {
    #blockLogin {
        margin: auto;
    }
    .menuPhone {
        width: 180px !important;
        height: 150px !important;
        margin: 16px !important;
    }
    #listeCours,
    #listeMesCours,
    #listeNews,
    #listeHistorique {
        max-width: 960px;
        margin: 0 auto;
    }
}

/* --- Responsive Mobile --- */
@media screen and (max-width: 640px) {
    #blockLogin {
        width: 85% !important;
        padding: 28px 24px !important;
    }
    .menuPhone {
        width: calc(50% - 24px) !important;
        height: 120px !important;
        margin: 8px !important;
        font-size: 13px !important;
    }
    .menuPhone img {
        width: 30px;
        height: 30px;
    }
    .cours,
    .news {
        width: calc(100% - 24px) !important;
        margin: 8px auto !important;
    }
    h20 {
        font-size: 14px;
        height: 50px !important;
        padding-top: 16px !important;
    }
}

/* --- Animations --- */
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

.cours:nth-child(1), .news:nth-child(1) { animation-delay: 0s; }
.cours:nth-child(2), .news:nth-child(2) { animation-delay: 0.05s; }
.cours:nth-child(3), .news:nth-child(3) { animation-delay: 0.1s; }
.cours:nth-child(4), .news:nth-child(4) { animation-delay: 0.15s; }
.cours:nth-child(5), .news:nth-child(5) { animation-delay: 0.2s; }
