/* ===================================================
   TWITCH TOOLS - Unified Stylesheet
   Based on Twitch Clip Player design
   =================================================== */

/* ===== CSS VARIABLES ===== */
:root {
    --bg-dark: #0a0a0f;
    --bg-panel: #12121a;
    --bg-card: #1a1a24;
    --bg-input: #0d0d12;
    --accent: #9147ff;
    --accent-glow: rgba(145, 71, 255, 0.4);
    --accent-hover: #a970ff;
    --success: #00f593;
    --warning: #ffb800;
    --error: #ff4444;
    --bits-color: #f7b916;
    --text: #efeff1;
    --text-muted: #adadb8;
    --border: #2a2a3a
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html {
    font-size: 80%; /* Cela réduit la base de 16px à 12.8px (-20%) */
}

body {
    font-family: 'Space Grotesk', sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* ===== ICONS & FONT AWESOME INTEGRATION (NOUVEAU) ===== */
/* Alignement général des icônes */
i.fa-solid, i.fa-regular, i.fa-brands {
    display: inline-block;
    line-height: 1;
}

/* Ajustement spécifique pour les icônes dans les titres */
h1 i, h2 i, h3 i {
    margin-right: 0.5rem;
    color: var(--accent);
}

/* ===== NAVBAR ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(18, 18, 26, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 1000;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap; /* Empêche le logo de passer à la ligne */
}

.navbar-brand:hover {
    text-decoration: none;
}

.navbar-brand .logo-icon, 
.navbar-brand i { /* Support Font Awesome */
    font-size: 1.5rem;
    color: var(--accent);
}

.navbar-brand span {
    background: linear-gradient(135deg, var(--accent) 0%, #bf94ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 2rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
    text-decoration: none;
}

.nav-link:hover {
    color: var(--text);
    background: var(--bg-card);
    text-decoration: none;
}

.nav-link.active {
    color: var(--accent);
    background: rgba(145, 71, 255, 0.1);
}

/* Modification pour supporter Font Awesome + classe .icon générique */
.nav-link i, 
.nav-link .icon {
    font-size: 1.1rem;
    width: 20px; /* Largeur fixe pour l'alignement vertical */
    text-align: center;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.navbar-spacer {
    flex: 1;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-badge {
    display: inline-block;
    height: 1.1em;
    vertical-align: middle;
    margin-right: 4px;
    margin-bottom: 2px;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    padding-top: 60px;
    min-height: 100vh;
}

.page-background {
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(145, 71, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(0, 245, 147, 0.05) 0%, transparent 50%),
        var(--bg-dark);
}

/* ===== CONTAINERS ===== */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.container-sm {
    max-width: 560px;
}

.container-md {
    max-width: 900px;
}

.container-lg {
    max-width: 1200px;
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
}

.card-header {
    margin-bottom: 1.25rem;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #555;
}

.form-group input[type="color"] {
    padding: 0.5rem;
    height: 44px;
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.help-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.help-text code {
    background: var(--bg-input);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent);
}

.help-text a {
    color: var(--accent);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem; /* Légèrement augmenté pour les icônes */
    padding: 0.875rem 1.5rem;
    background: var(--accent);
    border: none;
    border-radius: 10px;
    color: white;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Support spécifique icônes dans les boutons */
.btn i, .btn .icon {
    font-size: 1.1em; /* Un peu plus grand que le texte */
}

.btn-block {
    width: 100%;
}

.btn-small {
    padding: 0.5rem 0.875rem;
    font-size: 0.85rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-twitch {
    background: #9147ff;
}

.btn-twitch:hover:not(:disabled) {
    background: #a970ff;
}

.btn-success {
    background: var(--success);
    color: #000;
}

.btn-success:hover:not(:disabled) {
    filter: brightness(1.1);
}

.btn-danger {
    background: var(--error);
}

.btn-danger:hover:not(:disabled) {
    filter: brightness(1.1);
}

.btn-warning {
    background: var(--warning);
    color: #000;
}

.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-input);
    border-color: var(--accent);
}

/* Redéfinition générique pour compatibilité */
.icon {
    width: auto;
    height: auto;
    font-size: 1.1rem;
    display: inline-block;
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: var(--bg-input);
    padding: 4px;
    border-radius: 10px;
}

.tab {
    flex: 1;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem; /* Espace pour icône éventuelle */
}

.tab.active {
    background: var(--accent);
    color: white;
}

.tab:hover:not(.active) {
    color: var(--text);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.tab-content.active {
    display: block;
}

/* ===== PAGE TABS (alternative style) ===== */
.page-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    overflow-x: auto;
    background: var(--bg-panel);
}

.page-tab {
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-tab:hover {
    color: var(--text);
}

.page-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.page-tab .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--warning);
    color: #000;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 0.5rem;
}

/* ===== STATUS BADGES ===== */
.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border-radius: 20px;
    font-size: 0.85rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--error);
}

.status-dot.connected {
    background: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== USER BADGE ===== */
.user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem 0.375rem 0.375rem;
    background: var(--bg-card);
    border-radius: 20px;
}

.user-badge img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

/* ===== AUTH STATUS ===== */
.auth-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: 10px;
    margin-bottom: 1.5rem;
}

.auth-status.connected {
    border: 1px solid var(--success);
    background: rgba(0, 245, 147, 0.1);
}

.auth-status.disconnected {
    border: 1px solid var(--border);
}

.auth-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
/* Ajout pour icône "utilisateur" par défaut si pas d'image */
.auth-avatar i {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.auth-info {
    flex: 1;
}

.auth-info .name {
    font-weight: 600;
    font-size: 0.95rem;
}

.auth-info .status {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.auth-status.connected .status {
    color: var(--success);
}

/* ===== INSTRUCTIONS/INFO BOX ===== */
.info-box {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.info-box h3 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.info-box h3 i {
    color: var(--accent);
}

.info-box ol,
.info-box ul {
    padding-left: 1.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.8;
}

.info-box code {
    background: var(--bg-input);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--accent);
    word-break: break-all;
}

/* Collapsible */
.collapsible-header {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.collapsible-header .arrow {
    transition: transform 0.2s;
}

/* Support icône flèche Font Awesome */
.collapsible-header i.fa-chevron-down {
    transition: transform 0.2s;
}

.collapsible-header.open .arrow,
.collapsible-header.open i.fa-chevron-down {
    transform: rotate(180deg);
}

.collapsible-content {
    display: none;
    margin-top: 0.75rem;
}

.collapsible-content.open {
    display: block;
}

/* ===== URL BOX ===== */
.url-box {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.5rem;
}

.url-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    padding: 0.5rem;
}

.url-box input:focus {
    outline: none;
}

/* ===== PREVIEW ===== */
.preview-container {
    background: var(--bg-input);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.preview-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

/* ===== QUEUE SECTION ===== */
.queue-section {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.queue-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.queue-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
}

.queue-actions {
    display: flex;
    gap: 0.5rem;
}

.queue-list {
    max-height: 400px;
    overflow-y: auto;
}

.queue-empty {
    padding: 2.5rem;
    text-align: center;
    color: var(--text-muted);
}

.queue-empty-icon, .queue-empty i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
    display: block;
    color: var(--text-muted);
}

.queue-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    transition: background 0.2s;
}

.queue-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.queue-item:last-child {
    border-bottom: none;
}

.queue-item-content {
    flex: 1;
    min-width: 0;
}

.queue-item-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
    flex-wrap: wrap;
}

.queue-item-user {
    font-weight: 600;
    font-size: 0.9rem;
}

.queue-item-bits {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.5rem;
    background: linear-gradient(135deg, var(--bits-color) 0%, #e5a60d 100%);
    color: #000;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
}

.queue-item-message {
    font-size: 0.9rem;
    line-height: 1.4;
    word-break: break-word;
}

.queue-item-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.queue-item-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.approved-section .queue-item {
    border-left: 3px solid var(--success);
}

/* ===== SIDEBAR CARD ===== */
.sidebar-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.sidebar-card h4 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== STAT GRID ===== */
.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.stat-item {
    background: var(--bg-card);
    padding: 0.75rem;
    border-radius: 8px;
    text-align: center;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--bits-color);
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ===== NOW PLAYING ===== */
.now-playing {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.now-playing-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.now-playing-title {
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.now-playing-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== PLAYBACK CONTROLS ===== */
.playback-controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.control-btn {
    flex: 1;
    padding: 0.875rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.control-btn i {
    font-size: 1rem;
}

.control-btn:hover {
    background: var(--bg-input);
    border-color: var(--accent);
}

.control-btn.active {
    background: var(--accent);
    border-color: var(--accent);
}

.control-btn.playing {
    background: var(--success);
    border-color: var(--success);
}

.control-btn.paused {
    background: var(--warning);
    border-color: var(--warning);
    color: #000;
}

/* ===== VOLUME CONTROL ===== */
.volume-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 1.5rem;
}

.volume-control .icon,
.volume-control i {
    flex-shrink: 0;
    color: var(--text-muted);
    width: 20px;
    text-align: center;
}

.volume-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.volume-value {
    font-size: 0.8rem;
    color: var(--text-muted);
    min-width: 35px;
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
}

/* ===== CLIP LIST ===== */
.clip-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.clip-list-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.clip-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

.clip-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.clip-item {
    padding: 0.875rem;
    background: var(--bg-card);
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}

.clip-item:hover {
    border-color: var(--border);
}

.clip-item.active {
    border-color: var(--accent);
    background: rgba(145, 71, 255, 0.1);
}

.clip-item-title {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.clip-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.75rem;
}
.clip-item-meta i {
    font-size: 0.7rem;
    margin-right: 0.25rem;
}

/* ===== CONTROL PANEL (side panel) ===== */
.control-panel {
    position: fixed;
    top: 60px;
    right: 0;
    width: 380px;
    height: calc(100% - 60px);
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.control-panel.open {
    transform: translateX(0);
}

.panel-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

.close-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.close-btn i {
    font-size: 1.2rem;
}

.close-btn:hover {
    background: var(--bg-card);
    color: var(--text);
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.panel-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

/* ===== TOGGLE BUTTON ===== */
.toggle-panel-btn {
    position: fixed;
    top: 76px;
    right: 1rem;
    width: 48px;
    height: 48px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    transition: all 0.2s;
    opacity: 0;
    pointer-events: none;
}

.toggle-panel-btn i {
    font-size: 1.2rem;
}

.toggle-panel-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

.toggle-panel-btn:hover {
    background: var(--bg-card);
    border-color: var(--accent);
}

/* ===== STATUS BAR ===== */
.status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: rgba(18, 18, 26, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    z-index: 50;
    opacity: 0;
    transform: translateY(100%);
    transition: all 0.3s;
}

.status-bar.visible {
    opacity: 1;
    transform: translateY(0);
}

.status-indicator {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    margin-right: 0.5rem;
    animation: pulse 2s infinite;
}

.status-bar .spacer {
    flex: 1;
}

/* ===== LOADING ===== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-small {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== VIDEO CONTAINER ===== */
.video-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.video-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ===== DIVIDER ===== */
.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ===== GRIDS & LAYOUTS ===== */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.grid-sidebar {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-input);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== RESPONSIVE ===== */
/* Ajustement intermédiaire : Masquer le texte des liens mais garder les icônes */
@media (max-width: 1200px) {
    .nav-link span {
        display: none;
    }
    
    .nav-link {
        padding: 0.6rem;
        justify-content: center;
    }
    
    /* Fix icon alignment when text is hidden */
    .nav-link i, 
    .nav-link .icon {
        width: auto;
        margin: 0;
        font-size: 1.25rem;
    }
    
    .grid-2,
    .grid-sidebar {
        grid-template-columns: 1fr;
    }
    
    .control-panel {
        width: 100%;
    }
}

/* Mobile (< 768px) */
@media (max-width: 768px) {
    .navbar {
        padding: 0 0.75rem;
    }
    
    /* On force l'affichage du menu mais en version icônes seules */
    .navbar-nav {
        display: flex;
        margin-left: 0.5rem;
        gap: 0.25rem;
        overflow-x: auto; /* Permet le scroll horizontal si besoin */
        padding-bottom: 0;
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    
    .navbar-nav::-webkit-scrollbar {
        display: none;
    }
    
    /* On s'assure que le texte est bien masqué */
    .nav-link span {
        display: none;
    }
    
    .nav-link {
        padding: 0.5rem;
    }
    
    /* On masque le texte du logo pour gagner de la place */
    .navbar-brand span {
        display: none;
    }
    
    .container {
        padding: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ===== OVERLAY MODE (for bits crawler) ===== */
body.overlay-mode {
    background: transparent !important;
    overflow: hidden;
}

body.overlay-mode .navbar,
body.overlay-mode .main-content {
    display: none !important;
}

/* ===== CRAWLER SPECIFIC ===== */
.preview-crawler {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
}

.preview-text {
    display: block;
    white-space: nowrap;
    padding: 0 20px;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    animation: scrollPreview 10s linear infinite;
}

@keyframes scrollPreview {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

.crawler-band {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.crawler-text {
    position: absolute;
    left: 0;
    top: 0;
    white-space: nowrap;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    will-change: transform;
    padding: 0 30px;
}

/* ===== FULLSCREEN PLAYER ===== */
.player-fullscreen {
    position: fixed;
    inset: 0;
    top: 60px;
    background: #000;
    z-index: 10;
}

/* ===== TEST FORM ===== */
.test-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.test-form input {
    padding: 0.5rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.85rem;
    font-family: inherit;
}

.test-form input:focus {
    outline: none;
    border-color: var(--accent);
}

/* ===== CENTERED SETUP ===== */
.setup-centered {
    min-height: calc(100vh - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.setup-container {
    width: 100%;
    max-width: 560px;
}

.logo {
    text-align: center;
    margin-bottom: 3rem;
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--accent) 0%, #bf94ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* ===== URL LIST CONTAINER ===== */
.url-list-container {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
}

.url-list-container textarea {
    width: 100%;
    min-height: 200px;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    resize: vertical;
}

.url-list-container textarea:focus {
    outline: none;
}

.url-list-container textarea::placeholder {
    color: #444;
}

/* ===== CHAT OVERLAY SPECIFIC ===== */
@import url('https://fonts.googleapis.com/css2?family=Patrick+Hand&display=swap');

.chat-overlay-container {
    position: fixed;
    inset: 0;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.chat-messages::-webkit-scrollbar {
    display: none;
}

.chat-message {
    font-family: 'pain-de-mie', 'Patrick Hand', cursive;
    line-height: 1.4;
    word-wrap: break-word;
    animation: chatFadeIn 0.3s ease-out;
}

@keyframes chatFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-username {
    font-weight: 600;
}

.chat-separator {
    color: #ffffff;
}

.chat-text {
    color: #ffffff;
}

/* Chat preview in dashboard */
.chat-preview-container {
    background: var(--bg-input);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1.25rem;
    min-height: 200px;
    max-height: 300px;
    overflow: hidden;
    position: relative;
}

.chat-preview-container.no-bg {
    background: transparent;
    border: 1px dashed var(--border);
}

.chat-preview-messages {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: 100%;
    overflow-y: auto;
}

.chat-preview-messages.direction-up {
    flex-direction: column-reverse;
    justify-content: flex-end;
}

.chat-preview-message {
    font-family: 'pain-de-mie', 'Patrick Hand', cursive;
    line-height: 1.4;
    animation: chatFadeIn 0.3s ease-out;
}

.chat-preview-message .username {
    font-weight: 600;
}

.chat-preview-message .message-text {
    color: #ffffff;
}

/* Color swatches preview */
.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 2px solid var(--border);
    transition: transform 0.2s;
}

.color-swatch:hover {
    transform: scale(1.2);
}

/* Slider with value display */
.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.slider-container input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s;
}

.slider-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider-value {
    min-width: 50px;
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Toggle switch */
.toggle-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
}

.toggle-label {
    font-size: 0.9rem;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 3px;
    background-color: var(--text-muted);
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent);
    border-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
    background-color: white;
}

/* Font info box */
.font-info {
    background: rgba(145, 71, 255, 0.1);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.25rem;
}

.font-info h4 {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.font-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

/* ===== TAB PANEL ===== */
.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}
/* Ajout pour le profil dans la navbar */
.navbar-user-pill {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-input);   /* Réutilise la couleur des inputs */
    border: 1px solid var(--border); /* Réutilise la bordure standard */
    padding: 0.35rem 1rem 0.35rem 0.35rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-right: 0.5rem;
}

.navbar-user-pill img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--bg-dark);
}

/* Cache le pseudo sur mobile pour garder la place */
@media (max-width: 768px) {
    .navbar-user-pill span { display: none; }
    .navbar-user-pill { padding: 0.35rem; }
}
/* --- CSS POUR LES RÉPONSES --- */

/* Quand un message est une réponse, on change l'affichage pour empiler les éléments */
.chat-line.is-reply {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: rgba(255, 255, 255, 0.03); /* Fond très léger */
    border: 1px solid #3a3a3a; /* Bordure encadrée */
    padding-top: 8px;
    padding-bottom: 8px;
}

/* L'en-tête de la réponse (Le message cité) */
.reply-context {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: #adadb8;
    margin-left: 36px; /* Décalage vers la droite pour aligner sous le pseudo */
    margin-bottom: 4px;
    opacity: 0.8;
    padding-left: 8px;
    border-left: 2px solid var(--text-muted);
}

.reply-icon {
    font-size: 0.7rem;
    color: var(--text-muted);
    transform: rotate(180deg); /* Retourne l'icône share pour faire une flèche de réponse */
}

.reply-text {
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80%;
}

/* Conteneur principal du message (Pseudo + Message) */
.chat-main-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    position: relative;
}


.chat-input-area {
    padding: 1rem;
    border-top: 1px solid var(--border);
    background: #1f1f23;
    flex-shrink: 0;
    display: flex;
    gap: 10px;
    align-items: flex-end; /* Aligner en bas pour les multilignes */
    position: relative;
    z-index: 20;
}

.chat-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 8px;
    transition: border-color 0.2s;
}

.chat-input-wrapper:focus-within {
    border-color: var(--accent);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 8px;
    color: #efeff1;
    font-family: inherit;
    font-size: 0.9rem;
    min-height: 40px;
}
.chat-input:focus { outline: none; }

.chat-btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.chat-btn-icon:hover { color: var(--text); background: rgba(255,255,255,0.1); }

/* Bouton Envoyer relooké */
.chat-btn-send {
    width: 42px;
    height: 42px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
}
.chat-btn-send:hover { background: var(--accent-hover); }
.chat-btn-send:active { transform: scale(0.95); }
.chat-btn-send i { font-size: 1rem; }

/* EMOTE PICKER (Amélioré) */
#emote-picker {
    display: none;
    position: absolute;
    bottom: 80px; /* Un peu plus haut */
    right: 1rem;
    width: 320px;
    height: 350px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 100;
    flex-direction: column;
    overflow: hidden;
}

.picker-header {
    padding: 12px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex; justify-content: space-between; align-items: center;
}

.picker-grid {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); /* Cases un peu plus grandes */
    gap: 8px;
    align-content: start;
}

.picker-emote {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: contain;
    cursor: pointer;
    border-radius: 4px;
    padding: 2px;
    transition: background 0.1s;
}
.picker-emote:hover { background: rgba(255,255,255,0.1); transform: scale(1.1); }

.chat-line.deleted .chat-text {
    text-decoration: line-through;
    opacity: 0.5;
    color: var(--text-muted) !important;
}
.chat-line.deleted {
    background: rgba(239, 68, 68, 0.05); /* Fond rouge très léger */
    border-left-color: var(--error);
}

/* Log de sanction (La ligne "X a banni Y") */
.sanction-log {
    margin: 4px 0;
    padding: 6px 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    color: #ff8a8a;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: fadeIn 0.3s ease-out;
}

.sanction-log strong {
    color: #fff;
    font-weight: 600;
}

.sanction-icon {
    color: var(--error);
    font-size: 1rem;
}

/* Indicateur de Highlight actif sur le Dashboard Streamer */
.highlight-active-banner {
    background: rgba(145, 71, 255, 0.1);
    border: 1px solid var(--accent);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-weight: 600;
}
