/* --- POLICES PERSONNALISÉES --- */
@font-face {
    font-family: 'Young Serif';
    src: url('../fonts/YoungSerif-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Boska';
    src: url('../fonts/Boska-Variable.woff2') format('woff2-variations'),
         url('../fonts/Boska-Variable.woff') format('woff-variations');
    font-weight: 100 900;
}
@font-face {
    font-family: 'Boxing';
    src: url('../fonts/Boxing-Regular.woff2') format('woff2'),
         url('../fonts/Boxing-Regular.woff') format('woff');
    font-weight: normal;
}
@font-face {
    font-family: 'Kola';
    src: url('../fonts/Kola-Regular.woff2') format('woff2'),
         url('../fonts/Kola-Regular.woff') format('woff');
    font-weight: normal;
}
@font-face {
    font-family: 'Panchang';
    src: url('../fonts/Panchang-Variable.woff2') format('woff2-variations'),
         url('../fonts/Panchang-Variable.woff') format('woff-variations');
    font-weight: 100 900;
}
@font-face {
    font-family: 'BagelFatOne';
    src: url('../fonts/BagelFatOne-Regular.ttf') format('truetype');
    font-weight: normal;
}
@font-face {
    font-family: 'Micro5';
    src: url('../fonts/Micro5-Regular.ttf') format('truetype');
    font-weight: normal;
}
@font-face {
    font-family: 'MuseoModerno';
    src: url('../fonts/MuseoModerno-VariableFont_wght.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: 'Zodiak';
    src: url('../fonts/Zodiak-Variable.woff2') format('woff2');
    font-weight: 820;
    font-style: normal;
}
@font-face {
    font-family: 'Switzer';
    src: url('../fonts/Switzer-Variable.woff2') format('woff2');
    font-weight: 800;
    font-style: normal;
}

/* --- ANIMATIONS TIMER --- */
@keyframes blink-timer {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
.blink-colon {
    animation: blink-timer 1s step-end infinite;
}

:root, .light-mode { 
    --primary: #84cc16; 
    --primary-rgb: 132, 204, 22;
    --bg: #fffffa; 
    --card-bg: #fffef6; 
    --text: #000000; 
    --text-muted: #4b5563;
    --border-color: #000000;
    --shadow-color: #000000;
    --input-bg: #fffef6;
    --hover-bg: #e5e7eb;
    --ghost-bg: #fffef6;
    --button-bg: #84cc16;
    --button-text: #000000;
    --secondary-btn-bg: #ffffff;
    --radius: 5px;
    --border-width: 2.5px;
    --transition-brutal: 0.15s cubic-bezier(0.25, 0.8, 0.25, 1);
    
    --btn-danger-bg: #fee2e2;
    --btn-danger-text: #dc2626;
    --btn-success-bg: rgba(16, 185, 129, 0.1);
    --btn-success-text: #10b981;
    --btn-warning-bg: rgba(245, 158, 11, 0.1);
    --btn-warning-text: #f59e0b;
    
    --premium-bg: rgba(217, 119, 6, 0.1);
    --premium-text: #d97706;
    --premium-border: rgba(253, 230, 138, 0.4);
    
    --twitch-color: #6441a5;
    
    --btn-border: #000000;
    --btn-shadow: #000000;
}

.dark-mode {
    --primary: #84cc16; 
    --primary-rgb: 132, 204, 22;
    --bg: #181818; 
    --card-bg: #242424; 
    --text: #ffffff; 
    --text-muted: #a1a1aa;
    --border-color: #000000;
    --shadow-color: #000000;
    --input-bg: #1e1e1e;
    --hover-bg: #2d2d30;
    --ghost-bg: #181818;
    --button-bg: #84cc16;
    --button-text: #000000;
    --secondary-btn-bg: #242424;
    
    --btn-danger-bg: #3f1616;
    --btn-danger-text: #f87171;
    --btn-success-bg: rgba(16, 185, 129, 0.15);
    --btn-success-text: #34d399;
    --btn-warning-bg: rgba(245, 158, 11, 0.15);
    --btn-warning-text: #fbbf24;
    
    --premium-bg: rgba(217, 119, 6, 0.15);
    --premium-text: #fbbf24;
    --premium-border: rgba(251, 191, 36, 0.3);
    
    --twitch-color: #a970ff;
    
    --btn-border: #000000;
    --btn-shadow: #000000;
}

body {
    font-family: 'Inter', sans-serif;
}
h1, h2, h3, h4, h5, h6, .brutal-title {
    font-family: 'Young Serif', serif;
}

body { 
    font-family: 'Inter', 'Segoe UI', sans-serif; 
    background: var(--bg); 
    color: var(--text); 
    min-height: 100vh; 
    margin: 0; 
    padding: 0;
    box-sizing: border-box;
    transition: background 0.3s, color 0.3s;
    overflow-x: hidden;
}

/* Hide scrollbars globally but keep functionality */
* {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}
*::-webkit-scrollbar {
    display: none !important;
}

/* --- LAYOUT UNIFIÉ --- */
.container { 
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative;
    min-height: 100vh;
}

/* --- SIDEBAR VERTICALE (ESCAMOTABLE SUR MOBILE) --- */
.dashboard-sidebar {
    width: 280px !important;
    min-width: 280px !important;
    max-width: 280px !important;
    height: 100vh !important;
    background: var(--card-bg);
    border-right: 3px solid var(--text) !important;
    display: flex;
    flex-direction: column;
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden !important;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

.dashboard-sidebar::-webkit-scrollbar {
    display: none !important;
}

.dashboard-sidebar.active {
    left: 0 !important;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden !important; /* Sécurité supplémentaire */
    padding: 0 15px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    box-sizing: border-box;
}

.sidebar-content * {
    box-sizing: border-box;
    max-width: 100%; /* Empêcher les enfants de déborder */
}

 /* Chrome/Safari */

.dashboard-sidebar.active { left: 0; }


.sidebar-header {
    padding: 25px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-logo {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -1px;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 15px;
    display: flex;
    flex-direction: column;
    gap: 25px; /* Espace entre les 3 hauteurs */
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-section-title {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    margin: 0 0 8px 12px;
    letter-spacing: 1px;
}

/* --- BOUTONS NAV STANDARD --- */
.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 5px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
    border: none;
    background: transparent;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 5px;
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
    border: none;
    background: transparent;
    cursor: pointer;
    width: 100%;
    text-align: left;
    text-transform: lowercase;
    box-sizing: border-box;
}

.nav-item:hover {
    transform: scale(1.05);
}

.nav-item.active {
    background: var(--text);
    color: var(--bg);
}

.light-mode .nav-item.active img {
    filter: brightness(0) invert(1);
}

.dark-mode .nav-item.active img {
    filter: brightness(0);
}

.nav-item img {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* --- USER CARD DANS SIDEBAR --- */
.user-sidebar-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--hover-bg);
    border-radius: 5px;
    margin-bottom: 5px;
}

.user-sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.8rem;
}

.user-sidebar-info {
    flex: 1;
    min-width: 0;
}

.user-sidebar-name {
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- BOUTON BURGER --- */
.btn-burger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    margin-right: 15px;
    padding: 0;
}

.btn-close-sidebar {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
}

.btn-close-sidebar img {
    width: 20px;
    height: 20px;
}

@media (min-width: 1025px) {
    .btn-close-sidebar {
        display: none !important;
    }
}

/* --- MAIN CONTENT AREA OVERRIDES --- */
.main-content, .page-content-wrapper {
    display: block !important;
    width: calc(100% - 280px) !important;
    margin-left: 280px !important;
    padding: 30px;
    box-sizing: border-box;
    min-height: 100vh;
    transition: filter 0.3s;
}

.page-content-wrapper {
    padding: 0; /* Remove padding for custom pages */
}

/* Overlay quand la sidebar est ouverte */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 9998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}
.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 1024px) {
    .container { display: block !important; }
    .main-content, .page-content-wrapper { width: 100% !important; margin-left: 0 !important; }
    .main-content { padding: 20px !important; }
    .header-top { padding: 15px 20px !important; }
    
    .dashboard-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: 90vh !important;
        border-right: none !important;
        box-shadow: 0 15px 50px rgba(0,0,0,0.3) !important;
        z-index: 99999;
        transform: translateY(-120%);
        opacity: 0;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    }
    
    .dashboard-sidebar.active {
        left: 0 !important; /* Keep left 0 just in case */
        transform: translateY(0) !important;
        opacity: 1;
    }
    
    /* Center nav items on mobile like index.php */
    .dashboard-sidebar .nav-item {
        justify-content: center !important;
        text-align: center !important;
        font-size: 1.1rem !important;
        padding: 12px 20px !important;
    }
    
    .dashboard-sidebar .user-profile-btn {
        justify-content: center !important;
        text-align: center !important;
    }
}

/* Burger Menu Button from index.php */
.btn-burger-menu {
    display: none;
    background: var(--card-bg);
    border: 2px solid var(--btn-border, var(--text));
    box-shadow: 2px 2px 0 var(--btn-shadow, var(--shadow-color));
    border-radius: 8px;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text);
    z-index: 10001;
    transition: all 0.2s;
}
.btn-burger-menu:hover {
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--btn-shadow, var(--shadow-color));
    background: var(--hover-bg);
}
.btn-burger-menu:active {
    transform: translate(2px, 2px);
    box-shadow: 0 0 0 var(--btn-shadow, var(--shadow-color));
}
.btn-burger-menu svg {
    width: 24px;
    height: 24px;
}

@media (max-width: 1024px) {
    .btn-burger-menu {
        display: flex;
    }
}

/* Suppression des scrolls moches */
.dashboard-sidebar::-webkit-scrollbar {
    width: 0px;
}

.hidden { display: none !important; }
.text-muted { color: var(--text-muted) !important; }
.sub-panel { background: var(--input-bg); border: 1px solid var(--border-color); border-radius: 12px; padding: 15px; }
.border-top { border-top: 1px solid var(--border-color); }

.icon-adaptive { filter: brightness(0); transition: filter 0.2s; }
.dark-mode .icon-adaptive { filter: brightness(0) invert(1); }

/* --- HEADER SIMPLIFIÉ --- */
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }

/* --- BADGES --- */
.badge { padding: 4px 10px; border-radius: 6px; font-size: 0.75em; font-weight: 600; vertical-align: middle; display: inline-flex; align-items: center; border: 1px solid transparent; }

.badge-admin { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.badge-gold { background-color: #fff7d6; color: #926c05; border-color: #fae48e; }
.badge-green { background-color: #e6fffa; color: #047857; border-color: #b2f5ea; } 
.badge-purple { background-color: #f3e8ff; color: #7e22ce; border-color: #d8b4fe; }

/* Badges Licences */
.badge-success { background-color: rgba(16, 185, 129, 0.1); color: #10b981; border-color: rgba(16, 185, 129, 0.2); }
.badge-error { background-color: rgba(239, 68, 68, 0.1); color: #ef4444; border-color: rgba(239, 68, 68, 0.2); }

.premium-glow { border: 1px solid rgba(212, 175, 55, 0.4) !important; box-shadow: 0 4px 20px rgba(212, 175, 55, 0.1) !important; }

/* --- BOUTONS --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--button-bg);
    color: var(--button-text);
    border: var(--border-width) solid var(--btn-border, var(--border-color));
    box-shadow: 4px 4px 0px var(--btn-shadow, var(--shadow-color));
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: 800;
    font-size: 0.9em;
    text-decoration: none;
    cursor: pointer;
    transition: transform var(--transition-brutal), box-shadow var(--transition-brutal), background var(--transition-brutal), filter var(--transition-brutal);
    gap: 8px;
    box-sizing: border-box;
}
.btn:hover {
    filter: brightness(0.9);
}
.btn:active {
    transform: translate(4px, 4px);
    box-shadow: 0px 0px 0px var(--btn-shadow, var(--shadow-color));
}

.btn-icon-only { padding: 10px; width: 42px; height: 42px; border-radius: 50%; }

.btn img { height: 18px; width: auto; display: block; pointer-events: none; }

.btn-primary { background: var(--button-bg); color: var(--button-text); }
.btn-ghost { background: var(--secondary-btn-bg); color: var(--text); }
.btn-danger { background: var(--btn-danger-bg); color: var(--btn-danger-text); }
.btn-success { background: var(--btn-success-bg); color: var(--btn-success-text); }
.btn-warning { background: var(--btn-warning-bg); color: var(--btn-warning-text); }
.btn-ghost { background: var(--ghost-bg); color: var(--text); border: 1px solid var(--btn-border, var(--border-color)); box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
.btn-ghost:hover { background: var(--hover-bg); }

.btn-premium { background: var(--premium-bg); color: var(--premium-text); border: 1px solid var(--premium-border); font-weight: bold; border-radius: 12px; padding: 8px 14px; text-decoration: none; transition: all 0.2s; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.btn-premium:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }

.btn-twitch { background: var(--twitch-color); color: white; width: 100%; }
.btn-twitch:hover { filter: brightness(1.1); }

.btn-round { width: 70px; height: 70px; border-radius: 50%; font-size: 2em; display: flex; align-items: center; justify-content: center; border: none; cursor: pointer; transition: transform 0.1s; flex-shrink: 0; }
.btn-round:active { transform: scale(0.9); }
.btn-round.btn-primary { color: var(--bg); } 

/* --- BARRE DE TRI (ADMIN) --- */
.sort-toolbar { display: flex; background: var(--input-bg); padding: 4px; border-radius: 12px; gap: 4px; border: 1px solid var(--border-color); }
.sort-btn { padding: 8px; border: none; border-radius: 8px; cursor: pointer; background: transparent; transition: all 0.2s ease; display: flex; align-items: center; justify-content: center; }
.sort-btn img { height: 20px; width: auto; opacity: 0.4; transition: opacity 0.2s; }
.sort-btn:hover img { opacity: 0.7; }
.sort-btn.active { background: var(--card-bg); box-shadow: 0 2px 5px rgba(0,0,0,0.05); border: 1px solid var(--border-color); }
.sort-btn.active img { opacity: 1; }

/* --- BENTO GRID LAYOUT --- */
#dashboard-modules-grid { display: grid; grid-template-columns: repeat(auto-fill, 160px); grid-auto-rows: 160px; grid-auto-flow: row; gap: 20px; width: 100%; }
.span-small { grid-column: span 1; grid-row: span 1; }
.span-wide { grid-column: span 2; grid-row: span 1; }
.span-tall { grid-column: span 1; grid-row: span 2; }
.span-large { grid-column: span 2; grid-row: span 2; }

@media (max-width: 768px) {
    #dashboard-modules-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: minmax(150px, auto); }
    .span-wide, .span-tall, .span-large { grid-column: span 1 !important; grid-row: span 1 !important; }
}

/* --- MODE EDITION BENTO/* --- CARD CURSORS & HOVER ACTIONS --- */
.card:not(.add-widget-card) { cursor: grab; }
.card:not(.add-widget-card):active { cursor: grabbing; z-index: 50; }

.brutal-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; display: block; }
.brutal-overlay > div { opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.card:hover .brutal-overlay > div { opacity: 1; pointer-events: auto; }
.brutal-overlay > div.always-visible { opacity: 1 !important; pointer-events: auto !important; }

.share-badge { transition: opacity 0.2s; }
.card:hover .share-badge { opacity: 0; pointer-events: none; }

.edit-actions-top-left { position: absolute; top: 10px; left: 10px; }
.edit-actions-top-center { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); }
.edit-actions-top-right { position: absolute; top: 10px; right: 10px; }
.edit-actions-sizes { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); display: flex; justify-content: center; gap: 6px; padding: 4px; background: var(--card-bg); border-radius: 6px; border: 2px solid var(--btn-border, var(--text)); box-shadow: 2px 2px 0 var(--btn-shadow, var(--shadow-color)); }

.btn-edit-action { background: var(--card-bg); border: 2px solid var(--btn-border, var(--text)); border-radius: 50%; width: 36px; height: 36px; color: var(--text); display: flex; align-items: center; justify-content: center; font-size: 1.1em; box-shadow: 2px 2px 0 var(--btn-shadow, var(--shadow-color)); cursor: pointer; transition: 0.1s; pointer-events: auto; }
.btn-edit-action:hover { background: var(--hover-bg); transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--btn-shadow, var(--shadow-color)); }
.btn-danger-action { color: #000; background: #dc3545; }
.btn-danger-action:hover { background: #ff4d4d; }

.btn-size-selector { background: transparent; border: 2px solid transparent; border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; opacity: 0.5; padding: 0; }
.btn-size-selector:hover { opacity: 0.8; background: var(--hover-bg); border-color: var(--btn-border, var(--text)); }
.btn-size-selector.active { opacity: 1; background: var(--brutal-primary, #84cc16); border-color: var(--btn-border, var(--text)); color: #000; box-shadow: 2px 2px 0 var(--btn-shadow, var(--shadow-color)); }
.btn-size-selector img { width: 16px; height: 16px; pointer-events: none; filter: brightness(0) saturate(100%) invert(0); }
.dark-mode .btn-size-selector:not(.active) img { filter: brightness(0) saturate(100%) invert(1); }

.sortable-ghost { opacity: 0.4; border: 3px dashed var(--primary); }

/* --- CARDS --- */
.card { background: var(--card-bg); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; justify-content: space-between; box-shadow: 4px 4px 0 var(--shadow-color); transition: transform 0.2s, box-shadow 0.2s; border: var(--border-width) solid var(--border-color); position: relative; overflow: hidden; }
.card:hover:not(.add-widget-card) { transform: translateY(-3px) translate(-2px, -2px); box-shadow: 6px 6px 0 var(--shadow-color); z-index: 2; }

.card-title { font-weight: 600; font-size: 1em; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; z-index: 2; }
.card-value { font-size: 3em; font-weight: 800; color: var(--text); line-height: 1; position: relative; z-index: 2; }

.marks-container { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; justify-content: center; width: 100%; position: relative; z-index: 2;}
.mark-div { background-color: currentColor; -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; display: inline-block; transition: width 0.3s, height 0.3s; }

.btn-dashed-add { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 3px dashed var(--border-color); border-radius: var(--radius); background: transparent; color: var(--text-muted); cursor: pointer; transition: all 0.2s; box-sizing: border-box; }
.btn-dashed-add:hover { border-color: var(--primary); color: var(--primary); background: var(--hover-bg); }
.btn-dashed-add.locked { border-color: var(--btn-danger-text); color: var(--btn-danger-text); background: var(--btn-danger-bg); cursor: not-allowed; }

.add-widget-card { order: 9999; }

.btn-delete-excess { position: absolute; top: 8px; right: 8px; z-index: 20; background: var(--btn-danger-bg); border: 1px solid rgba(239, 68, 68, 0.2); border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform 0.2s, background 0.2s; color: var(--btn-danger-text); }
.btn-delete-excess:hover { background: var(--btn-danger-text); color: var(--bg); transform: scale(1.1); }
.btn-delete-excess img { display: none; }

.wysiwyg-content-wrapper { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%; position: relative; z-index: 2; }
.wysiwyg-value { font-size: 2.2rem; font-weight: 800; margin-bottom: 8px; line-height: 1.1; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; transition: font-size 0.3s; }
.wysiwyg-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; transition: font-size 0.3s; }

.mini-goal-bar { width: 100%; height: 6px; background: var(--border-color); border-radius: 3px; margin-bottom: 8px; position: relative; transition: all 0.3s; }
.mini-goal-fill { height: 100%; border-radius: 3px; position: absolute; top:0; left:0; transition: width 0.3s; }
.mini-goal-knob { width: 10px; height: 10px; background: var(--text); border-radius: 50%; position: absolute; top: 50%; transform: translateY(-50%); transition: left 0.3s, transform 0.3s, width 0.3s, height 0.3s; }

.span-large .wysiwyg-value { font-size: 4.5rem !important; }
.span-large .wysiwyg-value[id^="grid-g-val-"] { font-size: 3.5rem !important; } 
.span-large .timer-display-grid { font-size: 3.2rem !important; }
.span-large .wysiwyg-title { font-size: 1.2rem !important; margin-top: 5px; }
.span-large .wysiwyg-content-wrapper img { height: 80px !important; margin-bottom: 20px !important; transition: height 0.3s; }
.span-large .mini-goal-bar { height: 12px; border-radius: 6px; margin-bottom: 15px; }
.span-large .mini-goal-knob { width: 16px; height: 16px; transform: translateY(-50%); }

.module-card { background: var(--card-bg); border-radius: var(--radius); padding: 20px; aspect-ratio: 1/1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; cursor: pointer; box-shadow: 0 4px 20px rgba(0,0,0,0.02); border: 1px solid var(--border-color); transition: transform 0.2s, box-shadow 0.2s; color: var(--text); position: relative; overflow: hidden; }
.module-card:hover { transform: translateY(-5px); box-shadow: 0 10px 30px rgba(0,0,0,0.05); }
.module-card img.module-icon { height: 40px; width: auto; margin-bottom: 12px; }
.module-title { font-size: 1.1em; font-weight: 800; margin-bottom: 5px; }

/* --- MODALES --- */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); backdrop-filter: blur(5px); z-index: 10000; justify-content: center; align-items: center; opacity: 0; transition: opacity 0.3s; }
.modal-overlay.active { opacity: 1; }
.modal-box { background: var(--card-bg); color: var(--text); padding: 30px; border-radius: var(--radius); width: 90%; max-width: 400px; box-shadow: 0 20px 50px rgba(0,0,0,0.2); transform: scale(0.9); border: 1px solid var(--border-color); transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); display: flex; flex-direction: column; max-height: 85vh; overflow-y: auto; }
.modal-box::-webkit-scrollbar { width: 6px; }
.modal-box::-webkit-scrollbar-track { background: transparent; }
.modal-box::-webkit-scrollbar-thumb { background-color: rgba(128,128,128,0.2); border-radius: 20px; }
.modal-box::-webkit-scrollbar-thumb:hover { background-color: rgba(128,128,128,0.4); }
.modal-overlay.active .modal-box { transform: scale(1); }

#modal-detail-overlay .modal-box { aspect-ratio: 3/5; max-width: 360px; justify-content: space-between; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; flex-shrink: 0; }
.modal-title { font-size: 1.5em; font-weight: 800; margin: 0; color: var(--text); }
.big-val-modal { font-size: 6em; font-weight: 900; text-align: center; margin: 10px 0; color: var(--text); flex-grow: 1; overflow-y: auto; overflow-x: hidden; display: flex; align-items: center; justify-content: center; padding: 10px; width: 100%; box-sizing: border-box; }
.big-val-modal:has(.card-value) { overflow: visible; }
.big-val-modal::-webkit-scrollbar { width: 6px; }
.big-val-modal::-webkit-scrollbar-thumb { background-color: rgba(128,128,128,0.2); border-radius: 3px; }
.controls-modal { display: flex; justify-content: center; gap: 30px; margin-top: auto; margin-bottom: 20px; flex-shrink: 0; }

input[type="text"], input[type="email"], input[type="password"], select, textarea, input[type="number"] { width: 100%; padding: 12px; border: 1px solid var(--border-color); border-radius: 12px; box-sizing: border-box; background: var(--input-bg); color: var(--text); font-size: 1em; outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
input:focus, select:focus, textarea:focus { background: var(--card-bg); border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }
input:disabled { opacity: 0.6; cursor: not-allowed; }

.live-preview-box { background: var(--input-bg); border: 1px solid var(--border-color); border-radius: 12px; padding: 20px; margin-bottom: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 120px; }
.widget-choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-top: 20px; }

/* --- ADMIN VIEW --- */
#admin-view { background: var(--card-bg); padding: 20px; border-radius: var(--radius); height: 100%; overflow-y: auto; border: 1px solid var(--border-color); }
.user-row { display: flex; justify-content: space-between; padding: 15px 0; border-bottom: 1px solid var(--border-color); align-items: center; }
.role-select { padding: 8px; border-radius: 8px; border: 1px solid var(--border-color); background: var(--input-bg); color: var(--text); cursor: pointer; }

.admin-tabs { display: flex; gap: 15px; margin-bottom: 25px; padding: 0; background: transparent; width: 100%; }
.admin-tab { padding: 12px 24px; border: 1px solid var(--border-color); border-radius: 5px; background: var(--input-bg); cursor: pointer; font-weight: 700; color: var(--text-muted); font-size: 1em; transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1); display: flex; align-items: center; justify-content: center; text-align: center; gap: 8px; }
.admin-tab:hover { transform: translateY(-2px); color: var(--text); }
.admin-tab:active { transform: scale(0.95); }
.admin-tab.active { background: var(--primary); color: white; border-color: var(--primary); box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3); }
.admin-tab-content { display: none; }
.admin-tab-content.active { display: block; animation: fadeIn 0.3s; }

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

.input-wrapper-relative { position: relative; width: 100%; margin: 15px 0; }
.toggle-pass-icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); cursor: pointer; opacity: 0.5; transition: opacity 0.2s; display: flex; align-items: center; }
.toggle-pass-icon svg { width: 20px; height: 20px; color: var(--text); }

.color-options { display: flex; gap: 10px; margin-top: 10px; }
.color-radio { display: none; } 
.color-label { width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: transform 0.2s; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.color-label:hover { transform: scale(1.1); }
.color-radio:checked + .color-label { border-color: var(--text); transform: scale(1.15); box-shadow: 0 4px 10px rgba(0,0,0,0.2); }

@keyframes bounce { 0% { transform: scale(1); } 50% { transform: scale(1.3); } 100% { transform: scale(1); } }
.bounce { animation: bounce 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

.hex-input-wrapper { position: relative; display: flex; align-items: center; width: 100%; }
.hex-prefix { position: absolute; left: 12px; color: var(--text-muted); font-weight: 700; font-family: monospace; font-size: 1.1em; pointer-events: none; user-select: none; }
.hex-field { padding-left: 28px !important; font-family: monospace; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }

.guest-modal-content { text-align: center; }
.guest-icon { font-size: 3rem; margin-bottom: 15px; display: block; }
.guest-buttons { display: flex; gap: 15px; margin-top: 25px; justify-content: center; }

.maintenance-list { display: flex; flex-direction: column; gap: 15px; background: var(--input-bg); padding: 20px; border-radius: 5px; border: 1px solid var(--border-color); margin-top: 10px; }
.maintenance-item { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 5px; border-radius: 8px; transition: background 0.2s; }
.maintenance-item:hover { background: var(--hover-bg); }
.maintenance-item input { width: 18px; height: 18px; cursor: pointer; }

.btn-floating-feedback { position: fixed; bottom: 30px; right: 30px; width: 60px; height: 60px; background-color: var(--primary); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; border: none; transition: transform 0.2s, box-shadow 0.2s; z-index: 90; }
.btn-floating-feedback:hover { transform: scale(1.1); }


/* --- BINGO STYLES (Edit & Play Mode) --- */
.bingo-grid { display: grid; gap: 6px; width: 100%; aspect-ratio: 1/1; margin-top: 15px; }
.bingo-grid-3 { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); }
.bingo-grid-4 { grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr); }
.bingo-grid-5 { grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(5, 1fr); }

/* Play Mode Cells (Dynamique via THEME) */
.bingo-cell {
    border: 2px solid var(--border-color); border-radius: 8px;
    display: flex; align-items: center; justify-content: center; text-align: center;
    font-weight: 700; cursor: pointer;
    transition: all 0.2s; padding: 4px; overflow: hidden; word-break: break-word; line-height: 1.2;
}
/* Th��me Sombre (D��faut) */
.bingo-grid-theme-dark .bingo-cell { background: #1e1e1e; color: #ffffff; border-color: #2d2d2d; }
.bingo-grid-theme-dark .bingo-cell:hover { border-color: var(--primary); }
/* Th��me Clair */
.bingo-grid-theme-light .bingo-cell { background: #ffffff; color: #1f2937; border-color: #e5e7eb; }
.bingo-grid-theme-light .bingo-cell:hover { border-color: var(--primary); }

/* Case coch��e & Victoire */
.bingo-cell.checked { background: var(--win-color, var(--primary)) !important; color: white !important; border-color: var(--win-color, var(--primary)) !important; box-shadow: 0 4px 10px rgba(0,0,0,0.2); }
.bingo-cell.bingo-win-cell { box-shadow: 0 0 20px var(--win-color, var(--primary)); filter: brightness(1.3); z-index: 10; transform: scale(1.05); border-color: #fff !important; }

/* Edit Mode Input Cells */
.b-cell-input {
    width: 100%; height: 100%; text-align: center;
    border-radius: 8px; box-sizing: border-box;
    padding: 5px; font-weight: 600; font-family: 'Inter', sans-serif;
    transition: font-size 0.1s, border-color 0.2s;
    overflow: hidden; display: flex; align-items: center; justify-content: center;
    cursor: text; user-select: text; word-break: break-word;
}
.bingo-grid-theme-dark .b-cell-input { background: #252525; color: #ffffff; border: 2px solid #2d2d2d; }
.bingo-grid-theme-light .b-cell-input { background: #f9fafb; color: #1f2937; border: 2px solid #e5e7eb; }

.b-cell-input:focus { border-color: var(--primary) !important; outline: none; box-shadow: 0 0 10px rgba(59, 130, 246, 0.1); }
.b-cell-input[contenteditable]:empty::before { content: "Texte..."; color: var(--text-muted); pointer-events: none; }


/* --- BINGO MINI GRID (DASHBOARD) --- */
.bingo-standard-wrap { display: flex; flex-direction: column; align-items: center; width: 100%; justify-content: center; height: 100%; }
.bingo-mini-wrap { display: none; flex-direction: column; width: 100%; height: 100%; align-items: center; justify-content: flex-start; padding-top: 5px; box-sizing: border-box; }
.span-large .bingo-standard-wrap { display: none !important; }
.span-large .bingo-mini-wrap { display: flex !important; }

.bingo-mini-wrap .bingo-grid {
    gap: 4px;
    padding: 0;
    margin: 0 auto;
    width: 85%; /* R��duction de la taille pour s'assurer que le titre rentre */
    height: auto;
    aspect-ratio: 1/1;
    pointer-events: none; /* D��sactive l'interaction (survol et clic) sur la mini-grille */
}
.bingo-mini-wrap .bingo-cell {
    border-width: 2px;
    border-radius: 6px;
    padding: 2px;
    box-shadow: none !important; /* Retire l'ombre */
    transform: none !important; /* Emp��che les animations de d��formation sur le dashboard */
}

@media (max-width: 768px) {
    .header { padding: 0; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
    .header-actions { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
    .header-actions a[href="subscribe.php"], 
    .header-actions button[title="Mon Profil"], 
    .header-actions button[title="Administration"], 
    .user-info .user-pseudo { display: none !important; }
    .user-info { margin-right: 0; gap: 5px; }
}
/* Modern Switch */
.switch { position: relative; display: inline-block; width: 46px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--input-bg, #262626); transition: background-color 0.25s ease; border: 1px solid var(--border-color, #404040); border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 2px; top: 2px; background-color: #ffffff; transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1); border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
input:checked + .slider { background-color: var(--primary, #10b981); border-color: var(--primary, #10b981); }
input:checked + .slider:before { transform: translateX(22px); }

