/* ===== VARIABLES CSS - Style inspiré du panel Neuragrow ===== */
:root {
    /* Mode clair */
    --background-color: #ffffff;
    --sub-color: #f8fafc;
    --border-color: #e2e8f0;
    --background-connect: #f1f5f9;
    --title-color: #1e293b;
    --text-color: #64748b;
    --border-color-sub: #e2e8f080;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --background-card: #ffffff;
    --card-h3-color: #374151;
    --chiffre: #1e293b;
}

[data-theme="dark"] {
    /* Mode sombre - Monochrome comme le panel */
    --background-color: rgb(9, 9, 11);
    --sub-color: rgb(24, 24, 27);
    --border-color: #27272a;
    --background-connect: #27272a;
    --title-color: white;
    --text-color: rgb(161, 161, 170);
    --border-color-sub: #27272a80;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --background-card: rgb(24, 24, 27);
    --card-h3-color: rgb(212, 212, 216);
    --chiffre: white;
}

/* ===== RESET ET BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    height: 100vh;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

h1 {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--title-color);
    margin: 0;
    font-size: 1.125rem;
}

h2 {
    color: var(--title-color);
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

h3 {
    color: var(--title-color);
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
}

p {
    color: var(--text-color);
    font-size: .875rem;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 255px;
    height: 100vh;
    background-color: var(--sub-color);
    border-right: solid 1px var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s ease;
    overflow: hidden;
}

.sidebar-header {
    border-bottom: solid 1px var(--border-color-sub);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    position: relative;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.brand-logo {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.brand-logo svg {
    width: 20px;
    height: 20px;
}

.brand-text {
    transition: opacity 0.3s ease, transform 0.3s ease;
    min-width: 0;
}

.brand-slogan {
    margin-top: 0.125rem;
    margin-bottom: 0px;
    font-size: 0.75rem;
    line-height: 1rem;
}

/* Navigation */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    flex: 1;
}

.nav-link {
    padding: 10px 12px;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.2s ease;
    border-radius: .5rem;
    font-size: .875rem;
    line-height: 1.25rem;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    margin-bottom: 4px;
}

.nav-link span {
    transition: opacity 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
}

.nav-link.active {
    background-color: var(--background-connect);
    color: var(--title-color);
    border: solid 1px var(--border-color);
}

.nav-link:hover {
    color: var(--title-color);
    background-color: var(--background-connect);
}

.nav-link svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

/* User Profile dans la sidebar */
.sidebar-user {
    padding: 0px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color-sub);
    background-color: var(--background-card);
    margin: 0;
}

.logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: none;
    border: none;
    border-top: 1px solid var(--border-color-sub);
    color: var(--error-color);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background-color: rgba(239, 68, 68, 0.08);
}

.logout-btn svg {
    width: 18px;
    height: 18px;
}

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #3b82f6;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    margin-right: 12px;
}

.user-initials {
    color: white;
    font-weight: 600;
    font-size: 16px;
    text-transform: uppercase;
}

.user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0px;
    align-items: flex-start;
}

.user-name {
    color: var(--title-color);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1;
    text-align: left;
    width: 100%;
}

.user-id-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
    width: 100%;
}

.user-id {
    color: var(--text-color);
    font-size: 11px;
    font-family: 'Courier New', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.7;
    cursor: pointer;
    transition: opacity 0.2s ease;
    flex: 1;
    min-width: 0;
}

.user-id:hover {
    opacity: 1;
}

.copy-id-btn {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer;
    color: var(--text-color);
    opacity: 0.4;
    transition: all 0.2s ease;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    outline: none !important;
    box-shadow: none !important;
}

.copy-id-btn:hover {
    opacity: 1;
    color: #fff;
    background: none !important;
    border: none !important;
}

.copy-id-btn:active {
    transform: scale(0.9);
    background: none !important;
}

.copy-id-btn:focus {
    outline: none !important;
    box-shadow: none !important;
    background: none !important;
}

.copy-id-btn svg {
    width: 14px;
    height: 14px;
    display: block;
    pointer-events: none;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    background-color: var(--background-color);
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

/* Header avec profil utilisateur */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    color: var(--text-color);
    transition: all 0.2s ease;
}

.mobile-menu-btn:hover {
    color: var(--title-color);
    border-color: var(--primary-color);
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

.header-content h2 {
    margin-bottom: 4px;
    color: var(--title-color);
    font-size: 1.875rem;
    line-height: 2.25rem;
}

.header-content p {
    margin: 0;
    margin-top: .25rem;
    font-size: 1rem;
    color: var(--text-color);
}

/* Profil utilisateur dans le header */
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    color: var(--text-color);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    color: var(--title-color);
    border-color: var(--primary-color);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

.user-dropdown {
    position: relative;
}

.user-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--background-card);
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-dropdown-trigger:hover {
    border-color: var(--primary-color);
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.user-dropdown.active .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: var(--sub-color);
    color: var(--title-color);
}

.dropdown-item svg {
    width: 16px;
    height: 16px;
}

/* ===== DASHBOARD STATS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background-color: var(--background-card);
    border: solid 1px var(--border-color);
    border-radius: 12px;
    transition: all 0.2s ease;
    min-width: 0;
}

.stat-card:hover {
    border-color: var(--text-color);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stat-card-header {
    padding: 24px 24px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-card-header h3 {
    font-size: .875rem;
    line-height: 1.25rem;
    color: var(--card-h3-color);
    font-weight: normal;
    margin: 0px;
}

.stat-icon {
    padding: 10px;
    border-radius: .5rem;
    background-color: var(--background-connect);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 20px;
    height: 20px;
    display: block;
    stroke: var(--primary-color);
}

.stat-card-body {
    padding: 0 24px 24px;
}

.stat-value {
    color: var(--chiffre);
    font-size: 1.5rem;
    line-height: 2rem;
    font-weight: bold;
}

.stat-description {
    margin: 0px;
    margin-top: 4px;
    color: var(--text-color);
    font-size: .875rem;
}

/* ===== CHARTS SECTION ===== */
.charts-section {
    margin-top: 32px;
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-container,
.chart-card {
    background-color: var(--background-card);
    border: solid 1px var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.chart-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 20px 24px;
}

.chart-header h2 {
    color: var(--title-color);
    font-size: 1.25rem;
    margin: 0;
    font-weight: 600;
}

.chart-wrapper {
    position: relative;
    width: 100%;
    padding: 20px;
    flex: 1;
    box-sizing: border-box;
    min-height: 0;
}

.chart-canvas {
    width: 100% !important;
    height: 280px !important;
    display: block !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Tooltip pour le graphique */
.chart-tooltip {
    position: absolute;
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--title-color);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.chart-tooltip.active {
    opacity: 1;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--background-card);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    color: var(--title-color);
    border-color: var(--primary-color);
}

.btn svg {
    width: 16px;
    height: 16px;
}

/* ===== CHATBOT CARDS ===== */
.chatbots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.chatbot-card {
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
}

.chatbot-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.chatbot-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.chatbot-info h3 {
    color: var(--title-color);
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.chatbot-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.online {
    background-color: var(--success-color);
}

.status-indicator.offline {
    background-color: var(--error-color);
}

.chatbot-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-item {
    text-align: center;
    padding: 8px;
    background: var(--sub-color);
    border-radius: 6px;
}

.stat-item .value {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--title-color);
}

.stat-item .label {
    font-size: 0.75rem;
    color: var(--text-color);
}

.chatbot-actions {
    display: flex;
    gap: 8px;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    color: var(--title-color);
    font-weight: 500;
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--background-card);
    color: var(--title-color);
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 8px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 32px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Overlay pour menu mobile */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -255px;
        z-index: 1000;
        transition: left 0.3s ease;
    }
    
    .sidebar.mobile-open {
        left: 0;
    }
    
    .main-content {
        padding: 16px;
    }
    
    .main-header {
        margin-bottom: 24px;
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    /* Masquer le bouton theme sur mobile */
    .theme-toggle {
        display: none !important;
    }
    
    .header-content h2 {
        font-size: 1.25rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .chatbots-grid {
        grid-template-columns: 1fr;
    }

    /* Tableau conversations responsive */
    .conversations-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .conversations-table {
        min-width: 600px;
    }

    .conversations-table th,
    .conversations-table td {
        padding: 12px 16px;
        font-size: 0.8125rem;
    }

    .user-avatar-small {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }
}

/* ===== CHATBOTS FULL WIDTH CARDS ===== */
.chatbots-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chatbot-card-full {
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    transition: all 0.2s ease;
}

.chatbot-card-full:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.chatbot-main-info {
    margin-bottom: 20px;
}

.chatbot-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.chatbot-info h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--title-color);
    margin-bottom: 8px;
}

.chatbot-description {
    color: var(--text-color);
    font-size: 0.875rem;
    margin-bottom: 12px;
}

.chatbot-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.chatbot-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-color);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--title-color);
}

/* ===== CHART IMPROVEMENTS ===== */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chart-nav-btn {
    background: var(--sub-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-nav-btn svg {
    stroke: var(--title-color);
    transition: stroke 0.2s ease;
}

.chart-nav-btn:hover:not(:disabled) {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.chart-nav-btn:hover:not(:disabled) svg {
    stroke: white;
}

.chart-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#week-indicator,
#week-indicator-messages {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--title-color);
    min-width: 120px;
    text-align: center;
}

.chart-wrapper {
    position: relative;
}

.chart-axis-indicator {
    position: absolute;
    width: 1px;
    background: var(--primary-color);
    opacity: 0.5;
    display: none;
    pointer-events: none;
}

.chart-tooltip {
    position: fixed;
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    pointer-events: none;
    backdrop-filter: blur(10px);
    min-width: 180px;
}

.tooltip-header {
    font-weight: 600;
    color: var(--title-color);
    margin-bottom: 12px;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.tooltip-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 0.8125rem;
}

.tooltip-item:last-child {
    margin-bottom: 0;
}

.tooltip-color {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.tooltip-label {
    color: var(--text-color);
    flex: 1;
}

.tooltip-value {
    font-weight: 600;
    color: var(--title-color);
    margin-left: 8px;
}

/* ===== CONVERSATIONS TABLE ===== */
.conversations-container {
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.conversations-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--sub-color);
}

.conversations-filters {
    display: flex;
    gap: 12px;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--background-card);
    color: var(--title-color);
    font-size: 0.875rem;
    min-width: 150px;
}

.conversations-page {
    width: 100%;
}

.conversations-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    align-items: center;
    flex-wrap: wrap;
}

.search-bar-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-color);
    opacity: 0.6;
    pointer-events: none;
}

.search-bar {
    flex: 1;
    padding: 10px 16px 10px 38px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--background-card);
    color: var(--title-color);
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.search-bar:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-bar::placeholder {
    color: var(--text-color);
    opacity: 0.6;
}

.filter-select {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--background-card);
    color: var(--title-color);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-select:hover {
    border-color: var(--primary-color);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.conversations-table-wrapper {
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.conversations-table-container {
    overflow-x: auto;
}

.conversations-table {
    width: 100%;
    border-collapse: collapse;
}

.conversations-table th {
    background: var(--sub-color);
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    color: var(--title-color);
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
}

.conversations-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    color: var(--text-color);
    font-size: 0.875rem;
}

.conversations-table tbody tr:last-child td {
    border-bottom: none;
}

.conversations-table tbody tr:hover {
    background: var(--sub-color);
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    flex-shrink: 0;
}

.user-info-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name-cell {
    font-weight: 500;
    color: var(--title-color);
    font-size: 0.875rem;
}

.user-username-cell {
    font-size: 0.75rem;
    color: var(--text-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 3px;
}

.user-name {
    font-weight: 500;
    color: var(--title-color);
    font-size: 0.875rem;
}

.user-id {
    font-size: 0.75rem;
    color: var(--text-color);
}

.chatbot-name {
    font-weight: 500;
    color: var(--title-color);
    font-size: 0.875rem;
}

.message-count {
    font-weight: 600;
    color: var(--title-color);
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-active {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.status-redirected {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.status-blocked {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.status-inactive {
    background: rgba(156, 163, 175, 0.1);
    color: #9ca3af;
}

.status-finished {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.credits-value {
    color: var(--primary-color);
    font-weight: 600;
}

.last-message {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-color);
    font-size: 0.875rem;
}

.conversation-date {
    color: var(--text-color);
    font-size: 0.875rem;
}

.conversation-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
}

.action-btn:hover {
    transform: translateY(-1px);
}

.action-btn-delete {
    color: #ef4444;
}

.action-btn-delete:hover {
    background: rgba(239, 68, 68, 0.1);
}

.action-btn-block {
    color: #f59e0b;
}

.action-btn-block:hover {
    background: rgba(245, 158, 11, 0.1);
}

.action-btn-unblock {
    color: #22c55e;
}

.action-btn-unblock:hover {
    background: rgba(34, 197, 94, 0.1);
}

.credits-remaining {
    font-weight: 600;
    color: var(--primary-color);
}

.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 16px 0;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.pagination-info {
    color: var(--text-color);
    font-size: 0.875rem;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pagination-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--background-card);
    color: var(--title-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-text {
    color: var(--title-color);
    font-weight: 500;
    font-size: 0.875rem;
}

.page-info {
    color: var(--title-color);
    font-weight: 500;
    font-size: 0.875rem;
}

.chatbot-created-date {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.05);
    padding: 4px 8px;
    border-radius: 4px;
}

.chatbot-card-full {
    position: relative;
}

@media (max-width: 768px) {
    /* Filtres conversations responsive */
    .conversations-filters {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-bar-wrapper {
        width: 100%;
    }
    
    .filter-select {
        width: 100%;
        min-width: unset;
    }
    
    /* Wrapper avec scroll horizontal pour le tableau */
    .conversations-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .conversations-table {
        min-width: 800px;
    }
    
    .conversations-table th,
    .conversations-table td {
        padding: 12px 10px;
        font-size: 0.8125rem;
    }
    
    /* Réduire la taille de l'avatar sur mobile */
    .user-avatar-small {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }
    
    /* Adapter les boutons d'action */
    .conversation-actions {
        display: flex;
        gap: 6px;
    }
    
    .action-btn {
        padding: 6px;
    }
    
    /* Pagination responsive */
    .pagination-container {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .pagination-info {
        font-size: 0.75rem;
        text-align: center;
    }
    
    .chatbot-created-date {
        position: static;
        margin-top: 8px;
        text-align: center;
    }
}

/* Pour les très petits écrans */
@media (max-width: 480px) {
    .conversations-table {
        min-width: 700px;
    }
    
    .conversations-table th,
    .conversations-table td {
        padding: 10px 8px;
        font-size: 0.75rem;
    }
    
    .user-name-cell {
        font-size: 0.8125rem;
    }
    
    .user-username-cell {
        font-size: 0.6875rem;
    }
}

/* ===== MODAL POPUP ===== */
#telegramConnectionModal {
    display: none !important;
    position: fixed !important;
    z-index: 9999 !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(4px) !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.modal {
    display: none !important;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

#telegramConnectionModal.show {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    align-items: center !important;
    justify-content: center !important;
}

.modal.show {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--background-card);
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.modal-header h3 {
    margin: 0;
    color: var(--title-color);
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--hover-bg);
    color: var(--text-color);
}

.modal-body {
    padding: 0 24px;
}

.modal-footer {
    padding: 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.connection-step {
    display: none;
}

.connection-step.active {
    display: block;
}

.connection-step h4 {
    margin: 0 0 8px 0;
    color: var(--title-color);
    font-size: 1.125rem;
    font-weight: 600;
}

.step-description {
    color: var(--text-color);
    margin-bottom: 24px;
    font-size: 0.875rem;
    line-height: 1.5;
}

.success-message {
    text-align: center;
    padding: 32px 0;
}

.success-icon {
    width: 64px;
    height: 64px;
    background: var(--success-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    margin: 0 auto 16px;
}

.success-message h4 {
    color: var(--success-color);
    margin-bottom: 8px;
}

.success-message p {
    color: var(--text-color);
    margin: 0;
}

/* ===== PROMPT MANAGEMENT PAGE ===== */
.prompt-container {
    max-width: 1000px;
    margin: 0 auto;
}

.prompt-tips {
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary-color);
    border-radius: 8px;
    padding: 20px;
    margin-top: 16px;
}

.prompt-tips h4 {
    margin: 0 0 12px 0;
    color: var(--title-color);
    font-size: 0.95rem;
    font-weight: 600;
}

.prompt-tips ul {
    margin: 0;
    padding-left: 20px;
    list-style: none;
}

.prompt-tips ul li {
    color: var(--text-color);
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 6px;
    position: relative;
    padding-left: 8px;
}

.prompt-tips ul li:before {
    content: "•";
    color: var(--primary-color);
    font-weight: bold;
    position: absolute;
    left: -12px;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

.tip-item {
    background: var(--hover-bg);
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
}

.tip-item strong {
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
}

.tip-item span {
    color: var(--text-color);
    font-size: 0.875rem;
}

.prompt-editor {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
}

.prompt-editor h3 {
    margin: 0 0 16px 0;
    color: var(--title-color);
    font-size: 1.125rem;
    font-weight: 600;
}

.prompt-textarea {
    width: 100%;
    min-height: 400px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.875rem;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.prompt-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.prompt-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
}

.prompt-info {
    color: var(--text-muted);
    font-size: 0.875rem;
}

@media (max-width: 768px) {
    .tips-grid {
        grid-template-columns: 1fr;
    }
    
    .prompt-actions {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
}

/* ===== EDIT CHATBOT PAGE ===== */
.edit-chatbot-container {
    max-width: 800px;
}

.edit-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.edit-header h2 {
    margin: 0;
}

.edit-sections {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.edit-section {
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
}

.edit-section h3 {
    margin-bottom: 16px;
    color: var(--title-color);
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.edit-section h3 i {
    color: var(--primary-color);
    font-size: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.behavior-toggles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check-input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

.form-check-label {
    color: var(--text-color);
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}

.form-text {
    font-size: 12px;
    margin-top: 4px;
}

.text-muted {
    color: var(--text-muted);
}

.vocal-section {
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.vocal-section h4 {
    color: var(--primary-color);
    font-size: 1rem;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.vocal-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
    background: rgba(34, 197, 94, 0.05);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 8px;
    padding: 16px;
}

.edit-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .edit-actions {
        justify-content: stretch;
    }
    
    .edit-actions .btn {
        flex: 1;
        min-width: 0;
    }
}

/* ===== FORM CONTROLS ===== */
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--background-card);
    color: var(--title-color);
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    margin-bottom: 6px;
    color: var(--title-color);
    font-weight: 500;
    font-size: 14px;
}

.form-range {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.form-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
}

.range-value {
    text-align: center;
    margin-top: 8px;
    font-weight: 500;
    color: var(--title-color);
}

/* ===== SETTINGS PAGE ===== */
.settings-container {
    max-width: 800px;
}

.settings-section {
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.settings-section h3 {
    color: var(--title-color);
    font-size: 1.25rem;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.settings-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 16px;
}

.theme-selector {
    display: flex;
    gap: 12px;
}

.theme-option {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--background-card);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.theme-option.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.theme-option:hover {
    border-color: var(--primary-color);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* ===== UTILITIES ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

/* ===== SETTINGS PAGE (NOUVELLE VERSION) ===== */
.settings-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 900px;
}

.settings-card {
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.settings-card-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--sub-color);
}

.settings-card-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.settings-card-title svg {
    color: var(--primary-color);
    flex-shrink: 0;
}

.settings-card-title h3 {
    margin: 0;
    color: var(--title-color);
    font-size: 1.25rem;
    font-weight: 600;
}

.settings-card-description {
    margin: 0;
    color: var(--text-color);
    font-size: 0.875rem;
    line-height: 1.5;
}

.settings-card-body {
    padding: 24px;
}

.settings-section {
    margin-bottom: 0;
}

.settings-section-title {
    color: var(--title-color);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.settings-divider {
    height: 1px;
    background: var(--border-color);
    margin: 24px 0;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    color: var(--title-color);
    font-weight: 500;
    font-size: 0.875rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="url"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--background-card);
    color: var(--title-color);
    font-size: 0.875rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

/* Masquer les spinners des inputs number */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* Input File (Bouton Parcourir) */
.form-group input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--background-card);
    color: var(--title-color);
    font-size: 0.875rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.form-group input[type="file"]::-webkit-file-upload-button {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--primary-color);
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 12px;
}

.form-group input[type="file"]::-webkit-file-upload-button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.form-group input[type="file"]::file-selector-button {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--primary-color);
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 12px;
}

.form-group input[type="file"]::file-selector-button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.input-disabled {
    background: var(--sub-color) !important;
    cursor: not-allowed;
    opacity: 0.7;
}

.form-help {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-color);
    line-height: 1.4;
}

.form-help svg {
    flex-shrink: 0;
    color: var(--primary-color);
}

.form-help a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.form-help a:hover {
    text-decoration: underline;
}

/* Toggle Switch */
.toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 0;
    cursor: pointer;
    user-select: none;
}

.toggle-label span {
    color: var(--title-color);
    font-size: 0.875rem;
    font-weight: 500;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.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(--border-color);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary-color);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-inline {
    display: inline-block;
    margin-left: 12px;
    vertical-align: middle;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
}

.status-connected {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.status-disconnected {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

/* Input with Action Button */
.input-with-action {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-action input {
    padding-right: 44px;
}

.btn-icon {
    position: relative;
    right: 8px;
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: var(--text-color);
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--sub-color);
    color: var(--title-color);
}

.btn-icon svg {
    width: 16px;
    height: 16px;
}

/* Select Input */
.select-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Toggles Grid */
.toggles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
}

/* Collapsible Section */
.collapsible-section {
    margin-bottom: 0;
}

.collapsible-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.collapsible-header:hover {
    opacity: 0.8;
}

.collapsible-header .settings-section-title {
    margin: 0;
}

.collapsible-icon {
    color: var(--text-color);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

/* Quand la section est ouverte */
.collapsible-section.open .collapsible-content {
    max-height: none;
    overflow: visible;
}

.collapsible-section.open .collapsible-icon {
    transform: rotate(180deg);
}

.subsection-title {
    color: var(--title-color);
    font-size: 0.875rem;
    font-weight: 600;
    margin: 16px 0 12px 0;
}

/* Relaunch Messages List */
.relaunch-messages-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
    min-height: 50px; /* Hauteur minimale */
    max-height: none; /* Flexible height - s'adapte au contenu */
    overflow: visible;
}

.relaunch-messages-list .empty-state {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-style: italic;
    background: var(--card-bg);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    margin: 0;
}

.relaunch-message-item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 0;
    background: transparent;
    border-radius: 8px;
    border: none;
    transition: all 0.2s ease;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.relaunch-message-item input {
    flex: 1;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    padding: 12px;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.relaunch-message-item input:hover {
    border-color: var(--primary-color);
}

.relaunch-message-item input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.relaunch-message-item input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Bouton poubelle carré et visible */
.relaunch-message-item .btn-icon,
.relaunch-message-item .btn-danger {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
}

.relaunch-message-item .btn-icon:hover,
.relaunch-message-item .btn-danger:hover {
    background: transparent;
    color: #ef4444;
    transform: scale(1.15);
}

.btn-danger {
    background: transparent;
    border: 1px solid #ef4444;
    color: #ef4444;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
}

.btn-danger:hover {
    background: #ef4444;
    color: white;
    transform: scale(1.05);
}

.btn-sm {
    padding: 8px 12px;
    font-size: 0.875rem;
}

/* Media Upload */
.media-upload-group {
    margin-bottom: 24px;
}

.media-upload-group > label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    color: var(--title-color);
    font-weight: 600;
    font-size: 0.875rem;
}

.media-upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: all 0.2s ease;
}

.media-upload-zone:hover {
    border-color: var(--primary-color);
    background: var(--sub-color);
}

.media-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
    min-height: 120px;
}

.media-preview svg {
    color: var(--text-color);
    opacity: 0.5;
}

.media-preview p {
    margin: 0;
    color: var(--text-color);
    font-size: 0.875rem;
}

.media-preview img,
.media-preview video {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    object-fit: contain;
}

/* Settings Actions */
.settings-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: var(--sub-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    flex-wrap: wrap;
}

.settings-actions .btn {
    flex-shrink: 0;
    min-width: 200px;
    justify-content: center;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
}

.settings-info {
    flex: 1;
    text-align: right;
}

.settings-info small {
    color: var(--text-color);
    font-size: 0.75rem;
}

/* Toast Animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Responsive Settings Page */
@media (max-width: 768px) {
    .settings-page {
        gap: 16px;
    }
    
    .settings-card-header,
    .settings-card-body {
        padding: 16px;
    }
    
    .toggles-grid {
        grid-template-columns: 1fr;
    }
    
    .settings-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .settings-actions .btn {
        width: 100%;
    }
    
    .settings-info {
        text-align: center;
    }
}

/* ===== PAGE MES CHATBOTS ===== */
.chatbots-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.chatbots-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.chatbots-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Carte de chatbot redesignée - Layout horizontal compact */
.chatbot-card {
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px 24px;
    transition: all 0.2s ease;
    display: grid;
    grid-template-columns: 1fr auto auto;
    grid-template-rows: auto auto auto;
    gap: 8px 24px;
    width: 100%;
    align-items: center;
}

.chatbot-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.chatbot-card-header {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.chatbot-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-title h3 {
    color: var(--title-color);
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.chatbot-phone {
    color: var(--text-color);
    font-size: 0.875rem;
    padding: 4px 10px;
    background: var(--sub-color);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
}

.chatbot-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--sub-color);
    border-radius: 6px;
    white-space: nowrap;
    width: fit-content;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-indicator.online {
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
    animation: pulse 2s infinite;
}

.status-indicator.offline {
    background: #ef4444;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.status-text {
    font-size: 0.8125rem;
    color: var(--text-color);
    font-weight: 500;
}

/* Position du statut dans la grille (ligne 3) */
.chatbot-card .chatbot-status {
    grid-column: 1 / 2;
    grid-row: 3 / 4;
}

.chatbot-stats-row {
    display: flex;
    gap: 20px;
    padding-right: 20px;
    border-right: 1px solid var(--border-color);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 80px;
}

.stat-item svg {
    color: var(--primary-color);
    flex-shrink: 0;
    margin-bottom: 2px;
}

.stat-item span {
    color: var(--text-color);
    font-size: 0.8125rem;
    text-align: center;
}

.stat-item .stat-value {
    color: var(--title-color);
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1;
}

/* Style simplifié pour les stats */
.chatbot-stats-simple {
    grid-column: 2 / 3;
    grid-row: 1 / 4;
    display: flex;
    gap: 24px;
    padding-right: 20px;
    border-right: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: var(--text-color);
    align-items: center;
}

.chatbot-stats-simple span {
    white-space: nowrap;
}

.chatbot-actions {
    grid-column: 3 / 4;
    grid-row: 1 / 4;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
}

.btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    width: 38px;
    height: 38px;
}

.btn-action:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.btn-action svg {
    flex-shrink: 0;
}

.btn-action.btn-danger {
    background: var(--card-bg);
    color: #ef4444;
    border-color: var(--border-color);
}

.btn-action.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: white;
    border-color: #ef4444;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.5);
}

.btn-action.btn-success {
    color: var(--success-color);
}

.btn-action.btn-success:hover {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.5);
}

/* Responsive pour mobile */

    
.chatbot-stats-simple {
    border-right: none;
    padding-right: 0;
    justify-content: flex-start;
}

.chatbot-actions {
    justify-content: center;
}


/* État vide */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    background: var(--background-card);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
}

.empty-state svg {
    color: var(--text-color);
    opacity: 0.5;
    margin-bottom: 16px;
}

.empty-state h3 {
    color: var(--title-color);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-color);
    margin-bottom: 24px;
}

.empty-state .btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
    transition: all 0.3s ease;
}

.empty-state .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.empty-state .btn-primary svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke-width: 2.5;
    margin: 0;
}

/* ===== MODALS ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--background-card);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content.modal-large {
    max-width: 700px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-icon {
    color: var(--primary-color);
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 1.5rem;
    color: var(--title-color);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--sub-color);
    color: var(--title-color);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--sub-color);
}

/* Phase de connexion */
.connection-phase {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.phase-indicator {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.phase-step {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sub-color);
    border: 2px solid var(--border-color);
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.phase-step.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.phase-step.completed {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.connection-phase h3 {
    text-align: center;
    color: var(--title-color);
    font-size: 1.25rem;
    margin-bottom: 4px;
}

.connection-phase .text-muted {
    text-align: center;
    color: var(--text-color);
    margin-bottom: 8px;
}

/* Configuration modal */
.config-modal-body {
    max-height: 60vh;
}

.config-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.config-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.config-section h3 {
    color: var(--title-color);
    font-size: 1rem;
    margin-bottom: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-group-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
}

.form-group-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-group-checkbox label {
    cursor: pointer;
    color: var(--text-color);
    font-size: 0.875rem;
    margin: 0;
}

/* Prompt editor */
.prompt-editor {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    resize: vertical;
}

/* Boutons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary svg {
    flex-shrink: 0;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--sub-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--background-connect);
    color: var(--title-color);
    border-color: var(--primary-color);
}

/* Form inputs */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: var(--title-color);
    font-size: 0.875rem;
    font-weight: 500;
}

.form-input {
    padding: 10px 14px;
    background: var(--sub-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--title-color);
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input::placeholder {
    color: var(--text-color);
    opacity: 0.5;
}

.form-help {
    color: var(--text-color);
    font-size: 0.75rem;
    margin-top: -4px;
}

.form-help a {
    color: var(--primary-color);
    text-decoration: none;
}

.form-help a:hover {
    text-decoration: underline;
}

textarea.form-input {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

/* ===== CONFIRMATION MODAL ===== */
.confirmation-modal .modal-content {
    max-width: 450px;
}

.confirmation-modal .modal-body {
    text-align: center;
    padding: 32px 24px;
}

.confirmation-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sub-color);
}

.confirmation-icon.warning {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.confirmation-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.confirmation-modal h3 {
    color: var(--title-color);
    font-size: 1.25rem;
    margin-bottom: 12px;
}

.confirmation-modal p {
    color: var(--text-color);
    line-height: 1.6;
}

.confirmation-modal .modal-actions {
    justify-content: center;
    gap: 16px;
}

/* ===== PROMPT EDITOR (FULL PAGE) - VERSION RESPONSIVE ===== */
.prompt-editor-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--background-main);
}

.prompt-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    gap: 24px;
    flex-wrap: wrap;
}

.editor-header-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    min-width: 0;
}

/* NOUVEAU BOUTON RETOUR - Juste une flèche avec hover rond */
.btn-back-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--sub-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-back-arrow:hover {
    background: var(--hover-color);
    transform: translateX(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-back-arrow svg {
    flex-shrink: 0;
}

.editor-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.title-with-icon {
    display: flex;
    align-items: center;
    gap: 12px;
}

.title-with-icon svg {
    color: var(--primary-color);
    flex-shrink: 0;
}

.editor-title h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
}

.editor-title p {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.btn-save {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: var(--primary-color);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    flex-shrink: 0;
}

.btn-save:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-save svg {
    flex-shrink: 0;
}

.prompt-editor-content {
    display: flex;
    flex: 1;
    gap: 24px;
    padding: 24px 32px;
    overflow: hidden;
}

.editor-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--sub-color);
    border-radius: 8px 8px 0 0;
    flex-wrap: wrap;
    gap: 8px;
}

.toolbar-label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
}

.editor-stats {
    font-size: 13px;
    color: var(--text-secondary);
}

.prompt-textarea {
    flex: 1;
    width: 100%;
    padding: 20px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 0 0 8px 8px;
    color: var(--text-color);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    outline: none;
    transition: border-color 0.2s ease;
}

.prompt-textarea:focus {
    border-color: var(--primary-color);
}

.prompt-textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.editor-sidebar {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidebar-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.section-header svg {
    color: var(--primary-color);
    flex-shrink: 0;
}

.section-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

.commands-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.command-item {
    padding: 12px;
    background: var(--sub-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.command-item:hover {
    background: var(--hover-color);
    border-color: var(--primary-color);
    transform: translateX(2px);
}

.command-item code {
    display: inline-block;
    padding: 4px 8px;
    background: var(--primary-color);
    color: white;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.command-item p {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablettes (< 1024px) */
@media (max-width: 1024px) {
    .prompt-editor-header {
        padding: 20px 24px;
    }
    
    .prompt-editor-content {
        padding: 20px 24px;
        gap: 20px;
    }
    
    .editor-sidebar {
        width: 280px;
    }
}

/* Tablettes portrait et mobiles (< 768px) */
@media (max-width: 768px) {
    .prompt-editor-header {
        padding: 16px 20px;
        gap: 16px;
    }
    
    .editor-header-left {
        gap: 12px;
    }
    
    .editor-title h2 {
        font-size: 18px;
    }
    
    .editor-title p {
        font-size: 13px;
    }
    
    .btn-save {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .btn-save span {
        display: none; /* Masquer le texte sur mobile */
    }
    
    .prompt-editor-content {
        flex-direction: column;
        padding: 16px 20px;
        gap: 16px;
    }
    
    .editor-sidebar {
        width: 100%;
        order: -1; /* Mettre la sidebar en haut sur mobile */
    }
    
    .editor-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .prompt-textarea {
        font-size: 13px;
        padding: 16px;
    }
}

/* Petits mobiles (< 480px) */
@media (max-width: 480px) {
    .prompt-editor-header {
        padding: 12px 16px;
    }
    
    .btn-back-arrow {
        width: 36px;
        height: 36px;
    }
    
    .btn-back-arrow svg {
        width: 18px;
        height: 18px;
    }
    
    .editor-title h2 {
        font-size: 16px;
    }
    
    .title-with-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .btn-save {
        padding: 10px 16px;
    }
    
    .btn-save svg {
        width: 16px;
        height: 16px;
    }
    
    .prompt-editor-content {
        padding: 12px 16px;
    }
    
    .sidebar-section {
        padding: 16px;
    }
    
    .editor-stats {
        font-size: 12px;
    }
}

/* ===== CONFIG MODAL ===== */
.config-modal .modal-content {
    max-width: 700px;
    max-height: 85vh;
}

.config-section {
    margin-bottom: 32px;
}

.config-section:last-child {
    margin-bottom: 0;
}

.config-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.config-section-header svg {
    color: var(--primary-color);
    flex-shrink: 0;
    align-self: center;
    margin-top: -2px;
}

.config-section-header h3 {
    color: var(--title-color);
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
}

.config-grid {
    display: grid;
    gap: 20px;
}

.config-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.config-item label {
    color: var(--title-color);
    font-weight: 500;
    font-size: 0.9rem;
}

.config-item input,
.config-item select,
.config-item textarea {
    width: 100%;
    padding: 12px;
    background: var(--background-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--title-color);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.config-item input:focus,
.config-item select:focus,
.config-item textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.config-item textarea {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

.config-item-help {
    color: var(--text-color);
    font-size: 0.8rem;
    line-height: 1.4;
}

.config-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--sub-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.config-toggle:hover {
    background: var(--background-main);
}

.config-toggle-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.config-toggle-info h4 {
    color: var(--title-color);
    font-size: 0.95rem;
    font-weight: 500;
}

.config-toggle-info p {
    color: var(--text-color);
    font-size: 0.85rem;
}

/* Toggle switch styles moved to unified definition above */

/* Responsive */
@media (max-width: 768px) {
    .chatbots-grid {
        grid-template-columns: 1fr;
    }
    
    .chatbots-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .chatbots-header .btn-primary {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
        min-height: 48px;
    }
    
    .chatbot-actions {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .prompt-textarea {
        min-height: 250px;
        font-size: 0.85rem;
    }
    
    .template-buttons {
        flex-direction: column;
    }
    
    .template-btn {
        width: 100%;
    }
}

/* ===== PROMPT EDITOR TOOLBAR ===== */
.prompt-editor-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.prompt-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--sub-color);
    border-radius: 8px;
    gap: 16px;
    flex-wrap: wrap;
}

.prompt-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-color);
    font-size: 0.875rem;
}

.stat-separator {
    color: var(--border-color);
}

.prompt-templates {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--background-main);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-icon svg {
    flex-shrink: 0;
}

.prompt-help {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: rgba(59, 130, 246, 0.05);
    border-left: 3px solid var(--primary-color);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-color);
    line-height: 1.5;
}

.prompt-help svg {
    flex-shrink: 0;
    color: var(--primary-color);
    margin-top: 2px;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 16px 20px;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: var(--title-color);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    max-width: 400px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    border-left: 4px solid #10b981;
    background: rgba(16, 185, 129, 0.05);
}

.toast-error {
    border-left: 4px solid #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.toast-info {
    border-left: 4px solid var(--primary-color);
    background: rgba(59, 130, 246, 0.05);
}
.toast-warning {
    border-left: 4px solid #f59e0b;
    background: rgba(245, 158, 11, 0.05);
}

/* ===== DANGER BUTTON ===== */
.btn-danger {
    background-color: var(--error-color);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    color: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.confirmation-icon.danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* ===== CONFIG ITEM SMALL TEXT ===== */
.config-item small {
    color: var(--text-color);
    font-size: 0.8rem;
    line-height: 1.4;
}

/* ===== MODAL ACTIONS ===== */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
}

/* ===== RESPONSIVE TOAST ===== */
@media (max-width: 768px) {
    .toast {
        bottom: 16px;
        right: 16px;
        left: 16px;
        max-width: none;
    }
    
    .prompt-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .prompt-stats {
        justify-content: center;
    }
    
    .prompt-templates {
        justify-content: center;
    }
}
/* ===== PROMPT EDITOR PAGE (Full Screen) ===== */
.prompt-editor-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 64px);
    gap: 0;
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 20px;
}

.editor-title h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--title-color);
}

.editor-title p {
    margin: 4px 0 0 0;
    font-size: 0.875rem;
    color: var(--text-color);
}

.editor-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
    flex: 1;
    min-height: 0;
}

.editor-main {
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.editor-main .form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.prompt-textarea {
    flex: 1;
    width: 100%;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--background-color);
    color: var(--title-color);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    min-height: 400px;
}

.prompt-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.editor-stats {
    display: flex;
    gap: 20px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: var(--text-color);
}

.editor-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.sidebar-section {
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.sidebar-section h4 {
    margin: 0 0 16px 0;
    font-size: 1rem;
    color: var(--title-color);
}

.prompt-examples-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.example-card {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.example-card:hover {
    border-color: var(--primary-color);
    background: var(--sub-color);
    transform: translateX(4px);
}

.example-card h5 {
    margin: 0 0 4px 0;
    font-size: 0.875rem;
    color: var(--title-color);
}

.example-card p {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-color);
}

.tips-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tips-list li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
    font-size: 0.875rem;
    color: var(--text-color);
}

.tips-list li:before {
    content: '�';
    position: absolute;
    left: 8px;
    color: var(--primary-color);
    font-weight: bold;
}

@media (max-width: 1024px) {
    .editor-content {
        grid-template-columns: 1fr;
    }
    
    .editor-sidebar {
        order: -1;
    }
}


/* ===== FIX TOGGLES - Supprimer le double rond blanc ===== */
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary-color);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* ===== FILE UPLOAD WRAPPER ===== */
.file-upload-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.file-upload-wrapper .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.file-upload-wrapper .file-name {
    color: var(--text-color);
    font-size: 0.875rem;
    font-style: italic;
}

/* ===== BOUTONS TOGGLE (PAUSE/PLAY) ===== */
.btn-action.btn-toggle {
    background: var(--sub-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-action.btn-toggle.is-running {
    color: var(--error-color);
}

.btn-action.btn-toggle.is-running:hover {
    background: rgba(239, 68, 68, 0.5);
    border-color: var(--error-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.5);
}

/* ===== INDICATEUR DE MODIFICATIONS NON SAUVEGARDÉES ===== */
.unsaved-changes-indicator {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.4);
    z-index: 9999;
    animation: slideDown 0.3s ease-out;
}

.unsaved-changes-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
}

.unsaved-changes-content svg {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Ajustements pour les boutons d'actions */
.settings-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.btn-action.btn-toggle.is-stopped {
    color: var(--success-color);
}

.btn-action.btn-toggle.is-stopped:hover {
    background: rgba(16, 185, 129, 0.5);
    border-color: var(--success-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.5);
}

/* ===== BOUTON DELETE ===== */
.btn-action.btn-delete {
    background: var(--sub-color);
    border: 1px solid var(--border-color);
    color: var(--error-color);
}

.btn-action.btn-delete:hover {
    background: rgba(239, 68, 68, 0.5);
    border-color: var(--error-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.5);
}

/* ===== ANIMATIONS POUR LES BOUTONS ===== */
@keyframes pulse-red {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.2);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }
}

@keyframes pulse-green {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.2);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
}

@keyframes pulse-blue {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.2);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(59, 130, 246, 0);
    }
}

.btn-action.btn-toggle.is-running:hover {
    animation: pulse-red 1.5s infinite;
}

.btn-action.btn-toggle.is-stopped:hover {
    animation: pulse-green 1.5s infinite;
}

.btn-action.btn-delete:hover {
    animation: pulse-red 1.5s infinite;
}

/* Animation pour les boutons config et prompt */
.btn-action:not(.btn-toggle):not(.btn-delete):hover {
    animation: pulse-blue 1.5s infinite;
}


/* ===================================
   CRÉATION DE CHATBOT - ÉTAPES
   =================================== */

/* Indicateur d'étapes */
.creation-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    padding: 0 20px;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 0 0 auto;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--sub-color);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.step.active .step-number {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.step.completed .step-number {
    background: var(--success-color, #10b981);
    border-color: var(--success-color, #10b981);
    color: white;
}

.step-label {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.step.active .step-label {
    color: var(--primary-color);
    font-weight: 600;
}

.step.completed .step-label {
    color: var(--success-color, #10b981);
}

.step-line {
    height: 2px;
    width: 60px;
    background: var(--border-color);
    margin: 0 10px;
    position: relative;
    top: -20px;
    transition: all 0.3s ease;
}

.step-line.completed {
    background: var(--success-color, #10b981);
}

/* Boîte d'information */
.info-box {
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.info-box.warning {
    background: rgba(245, 158, 11, 0.05);
    border-color: rgba(245, 158, 11, 0.2);
}

.info-box svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--primary-color);
}

.info-box.warning svg {
    color: #f59e0b;
}

.info-box p {
    margin: 0;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
}

.info-box strong {
    color: var(--primary-color);
    font-weight: 600;
}

.info-box.warning strong {
    color: #f59e0b;
}

/* Icône de succès */
.success-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 50%;
    animation: successPulse 2s ease-in-out infinite;
}

.success-icon svg {
    color: var(--success-color, #10b981);
}

@keyframes successPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
}

/* Message de succès */
.success-message {
    text-align: center;
    margin-bottom: 20px;
}

.success-message h3 {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.success-message p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

/* Boutons de la modal de création */
.modal-footer.creation-footer {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.modal-footer.creation-footer .btn {
    flex: 1;
}

.modal-footer.creation-footer .btn:only-child {
    width: 100%;
}


/* ===== PROMPT TAGS INFO ===== */
.prompt-tags-info {
    margin-top: 24px;
    padding: 20px;
    background: var(--sub-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.tags-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.tags-header svg {
    color: var(--primary-color);
    flex-shrink: 0;
}

.tags-header h4 {
    color: var(--title-color);
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.tags-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.tag-item {
    padding: 12px;
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.tag-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.tag-item code {
    display: block;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-color);
    background: rgba(59, 130, 246, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 6px;
}

.tag-item p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-color);
    line-height: 1.4;
}

.form-help {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-color);
    line-height: 1.5;
}

.form-help svg {
    flex-shrink: 0;
    color: var(--primary-color);
    margin-top: 2px;
}


/* ===== RESPONSIVE MODALS - MOBILE SLIDE-UP ===== */
@media (max-width: 768px) {
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }
    
    .modal-content {
        max-width: 100%;
        width: 100%;
        max-height: 85vh;
        border-radius: 20px 20px 0 0;
        animation: slideUpMobile 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .modal-content.modal-large {
        max-width: 100%;
    }
    
    @keyframes slideUpMobile {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
    
    /* Ajouter une barre de glissement en haut de la modal sur mobile */
    .modal-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: var(--border-color);
        border-radius: 2px;
    }
    
    .modal-header {
        position: relative;
        padding-top: 32px;
    }
    
    /* Ajuster le body pour le scroll sur mobile */
    .modal-body {
        max-height: calc(85vh - 140px);
        -webkit-overflow-scrolling: touch;
    }
    
    .config-modal-body {
        max-height: calc(85vh - 140px);
    }
}

/* Pour les très petits écrans */
@media (max-width: 480px) {
    .modal-content {
        max-height: 90vh;
    }
    
    .modal-body {
        max-height: calc(90vh - 140px);
        padding: 16px;
    }
    
    .config-modal-body {
        max-height: calc(90vh - 140px);
    }
    
    .modal-header {
        padding: 28px 16px 16px;
    }
    
    .modal-actions {
        padding: 16px;
        flex-direction: column-reverse;
    }
    
    .modal-actions button {
        width: 100%;
    }
    
    /* Ajuster les grilles de formulaire sur mobile */
    .form-row {
        grid-template-columns: 1fr;
    }
    
    /* Ajuster les tags spéciaux sur mobile */
    .special-tags-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== NOTIFICATIONS ===== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    background: var(--background-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    min-width: 300px;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success {
    border-left: 4px solid var(--success-color);
}

.notification-error {
    border-left: 4px solid var(--error-color);
}

.notification-info {
    border-left: 4px solid var(--primary-color);
}

.notification-warning {
    border-left: 4px solid var(--warning-color);
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--title-color);
    font-size: 0.875rem;
}

/* Responsive notifications */
@media (max-width: 768px) {
    .notification {
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: calc(100% - 20px);
    }
}


/* Modal de changement de mot de passe */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--background-card);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.warning-message {
    background: #fff3cd;
    color: #856404;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #ffc107;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-help {
    display: block;
    margin-top: 6px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.form-actions .btn {
    flex: 1;
}

/* Animation de chargement pour le bouton de test */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spinning {
    animation: spin 1s linear infinite;
}


/* ========================================
   Styles pour l'ID du chatbot avec icône de copie
   ======================================== */
.chatbot-id-badge {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-color);
    font-family: 'Courier New', monospace;
    width: fit-content;
}

.chatbot-id-text {
    user-select: all;
    cursor: text;
    opacity: 0.6;
}

.btn-icon-tiny {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    color: var(--text-color);
    opacity: 0.4;
    transition: opacity 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-tiny:hover {
    opacity: 1;
}

.btn-icon-tiny:active {
    transform: scale(0.95);
}


/* ===== RESPONSIVE DESIGN ===== */


@media (max-width: 480px) {
    /* Très petits écrans */
    .chatbot-card {
        padding: 12px !important;
    }
    
    .stat-item {
        flex: 1 1 100% !important;
    }
    
    .chatbot-actions {
        justify-content: center !important;
    }
}

@media (max-width: 768px) {
    /* Cartes de chatbot en mode mobile */
    .chatbot-card {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto auto auto auto auto !important;
        gap: 10px !important;
        padding: 16px !important;
    }
    
    /* Header prend toute la largeur */
    .chatbot-card-header {
        grid-column: 1/2 !important;
        grid-row: 1/2 !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 4px !important;
    }
    
    /* Titre et téléphone en colonne */
    .chatbot-card-header .chatbot-title {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 4px !important;
    }
    
    .chatbot-card-header h3 {
        font-size: 16px !important;
        margin: 0 !important;
    }
    
    .chatbot-card-header .chatbot-phone {
        font-size: 13px !important;
        opacity: 0.8 !important;
    }
    
    /* ID Badge en dessous, sur sa propre ligne */
    .chatbot-id-badge {
        grid-column: 1/2 !important;
        grid-row: 2/3 !important;
        font-size: 11px !important;
        padding: 4px 8px !important;
        width: fit-content !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
    }
    
    /* Statut en dessous de l'ID */
    .chatbot-status {
        grid-column: 1/2 !important;
        grid-row: 3/4 !important;
    }
    
    /* Stats prennent toute la largeur, sur leur propre ligne */
    .chatbot-stats,
    .chatbot-stats-simple {
        grid-column: 1/2 !important;
        grid-row: 4/5 !important;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 12px !important;
        justify-content: flex-start !important;
        padding: 8px 0 !important;
    }
    
    .chatbot-stats-simple span {
        font-size: 13px !important;
        white-space: nowrap !important;
    }
    
    .stat-item {
        flex: 1 1 calc(50% - 6px) !important;
        min-width: 120px !important;
    }
    
    /* Actions en bas, pleine largeur */
    .chatbot-actions {
        grid-column: 1/2 !important;
        grid-row: 5/6 !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        justify-content: flex-start !important;
    }
    
    .chatbot-actions .btn-icon,
    .chatbot-actions .btn-action {
        flex: 0 0 auto !important;
    }
    
    /* Ajuster la taille des boutons sur mobile */
    .btn-icon {
        width: 40px !important;
        height: 40px !important;
    }
}
