/**
 * Dynamic Management - Stili Principali
 * Font: Poppins
 * Stile: Moderno e Minimalista
 * Organizzato per manutenibilità - Struttura logica
 *
 * INDICE DELLE SEZIONI:
 * 1. Reset e Base
 * 2. Variabili CSS
 * 3. Layout (Sidebar, Main Content)
 * 4. Componenti Base (Buttons, Forms)
 * 5. Componenti UI (Cards, Badges, Alerts)
 * 6. Pagine Specifiche (Login, Dashboard)
 * 7. Componenti Speciali (Editor, Pagination)
 * 8. Responsive Design
 * 9. Utility Classes
 */

/* ========================================
   1. RESET E BASE
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colori dinamici - definiti da header.php */
    --primary: var(--primary, #6366f1);
    --primary-color: var(--primary, #6366f1);
    --primary-dark: var(--primary-dark, #4f46e5);
    --primary-light: var(--primary-light, #8b5cf6);
    
    /* Layout e misure */
    --sidebar-width: 280px;
    --border-radius: 16px;
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Ombre */
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.12);
    --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    backdrop-filter: blur(20px);
}

/* ========================================
   2. VARIABILI CSS E TIPOGRAFIA
   ======================================== */
a:not(.btn):not(.btn-primary):not(.btn-secondary):not(.btn-danger):not(.btn-outline):not(.menu-item):not(.logout-btn):not(.page-link):not(.pagination-btn):not(.tab-btn):not(.btn-icon) {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:not(.btn):not(.btn-primary):not(.btn-secondary):not(.btn-danger):not(.btn-outline):not(.menu-item):not(.logout-btn):not(.page-link):not(.pagination-btn):not(.tab-btn):not(.btn-icon):hover {
    color: var(--primary-dark);
}

@media (min-width: 1025px) {
    body {
        height: 100vh;
        overflow: hidden;
    }
}

/* Previeni scroll quando sidebar aperta su mobile */
body.sidebar-active {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100vh;
}

/* ========================================
   3. LAYOUT PRINCIPALE
   ======================================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* === Sidebar === */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-glass);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--sidebar-border);
    text-align: center;
}

.sidebar-logo {
    max-width: 180px;
    max-height: 60px;
    display: block;
    margin: 0 auto 12px auto;
    object-fit: contain;
}

.sidebar-logo-img {
    max-width: 180px;
    display: block;
}

.app-name {
    font-size: 20px;
    font-weight: 600;
    color: white;
    margin: 0;
}

.app-motto {
    font-size: 13px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
}

.sidebar-menu {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: var(--transition);
    margin: 6px 16px;
    border-radius: var(--border-radius);
    font-weight: 500;
    backdrop-filter: blur(10px);
    border: 1px solid transparent;
}

.menu-item:hover {
    background: var(--sidebar-hover);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    transform: translateX(4px);
    box-shadow: var(--shadow);
}

.menu-item.active {
    background: var(--sidebar-active);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(99, 102, 241, 0.3);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.15);
}

.menu-icon {
    display: none;
}

.menu-text {
    font-size: 14px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    font-size: 14px;
    margin-right: 12px;
}

.user-avatar-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
    border: 2px solid rgba(102, 126, 234, 0.3);
}

.user-details {
    flex: 1;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--sidebar-text);
    margin-bottom: 2px;
}

.user-role {
    font-size: 12px;
    color: var(--sidebar-text);
}

.sidebar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-btn,
.logout-btn {
    padding: 8px;
    border-radius: 8px;
    background: var(--sidebar-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    text-decoration: none;
    color: var(--sidebar-text);
}

.settings-btn:hover,
.logout-btn:hover {
    background: var(--sidebar-active);
    transform: translateY(-1px);
}

.settings-btn.active {
    background: var(--sidebar-active);
}

/* Settings icon SVG styling */
.settings-btn .icon-settings {
    width: 18px;
    height: 18px;
    display: block;
    color: var(--sidebar-text);
    transition: color 0.2s ease, transform 0.15s ease;
}

.settings-btn .icon-settings path,
.settings-btn .icon-settings circle {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.settings-btn:hover .icon-settings,
.settings-btn.active .icon-settings {
    color: var(--primary);
    transform: rotate(90deg);
}

/* Logout icon SVG styling */
.logout-btn .icon-logout {
    width: 18px;
    height: 18px;
    display: block;
    color: var(--sidebar-text);
    transition: color 0.2s ease, transform 0.15s ease;
}

.logout-btn .icon-logout path {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.logout-btn:hover .icon-logout {
    color: var(--primary);
    transform: translateY(-1px) scale(1.02);
}

/* === Main Content === */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(248, 250, 252, 0.1) 100%);
    backdrop-filter: blur(10px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Mobile/Tablet: height auto per permettere scroll naturale */
@media (max-width: 1024px) {
    .main-content {
        height: auto;
        min-height: 100vh;
    }
}

.content-wrapper {
    padding: 32px;
    max-width: 100%;
}

.content-header {
    margin-bottom: 32px;
}

.content-header h1 {
    font-size: 32px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.content-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ========================================
   4. COMPONENTI UI
   ======================================== */

/* === Cards === */
.dashboard-card, .settings-card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

.dashboard-card:hover, .settings-card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 24px;
}

/* === Stats Grid === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--surface-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    padding: 28px;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-glass);
    border: 1px solid var(--glass-border);
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-8px) scale(1.02);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.stat-icon {
    font-size: 40px;
    margin-right: 20px;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

.stat-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
}

/* === Dashboard Grid === */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 500;
}

.empty-state small {
    color: var(--text-secondary);
    font-size: 14px;
}

/* === Activity === */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    padding: 12px;
    border-radius: 8px;
    background: var(--bg-color);
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 16px;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.activity-time {
    font-size: 12px;
    color: var(--text-secondary);
}

/* === Settings Grid === */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.settings-card {
    background: var(--surface-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-glass);
    overflow: hidden;
    border: 1px solid var(--glass-border);
}

.settings-card .card-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.settings-card .card-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #1a202c;
    margin: 0;
}

.settings-card .card-body {
    padding: 20px;
}

.profile-info {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.profile-avatar-wrapper {
    margin-right: 20px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 600;
}

.profile-avatar-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
}

.profile-details h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.profile-details p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
}

.info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.info-value {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
}

/* === Avatar Upload === */
.avatar-upload-section {
    padding: 20px;
    background: var(--surface);
    border-radius: 10px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.avatar-upload {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.avatar-upload-label {
    display: inline-block;
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.avatar-upload-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.avatar-filename {
    font-size: 14px;
    color: var(--text-secondary);
    font-style: italic;
}

/* === Badges === */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-primary {
    background: var(--primary);
    color: white;
}

.badge-secondary {
    background: #6b7280;
    color: white;
}

.badge-success {
    background: var(--success, #10b981);
    color: white;
}

.badge-info {
    background: #3b82f6;
    color: white;
}

/* ========================================
   5. COMPONENTI BASE
   ======================================== */

/* ========================================
   5. COMPONENTI BASE
   ======================================== */

/* === Tables === */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: var(--surface-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table thead {
    background: var(--surface);
}

.data-table thead th {
    background: var(--primary);
    color: white;
    font-weight: 600;
    border: none;
}

.data-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    position: relative;
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

/* Rimuove il bordo inferiore dell'ultima riga */
.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: var(--input-bg);
    transition: background 0.2s ease;
}

.data-table code {
    background: var(--input-bg);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    color: var(--text);
}

/* Colonne speciali */
.data-table th[data-sort],
.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.data-table th[data-sort]:hover,
.data-table th.sortable:hover {
    background: rgba(255, 255, 255, 0.1);
}

.data-table th[data-sort]::after,
.data-table th.sortable::after {
    content: '↕';
    margin-left: 8px;
    opacity: 0.5;
    font-size: 12px;
}

.data-table th[data-sort="asc"]::after,
.data-table th.sortable.sort-asc::after {
    content: '↑';
    opacity: 1;
}

.data-table th[data-sort="desc"]::after,
.data-table th.sortable.sort-desc::after {
    content: '↓';
    opacity: 1;
}

/* Checkbox nelle tabelle */
.data-table th input[type="checkbox"],
.data-table td input[type="checkbox"] {
    margin: 0;
    transform: scale(1.1);
}

/* Status badges nelle tabelle */
.data-table .status-badge {
    font-size: 11px;
    padding: 3px 8px;
}

/* Azioni nelle tabelle */
.data-table .btn-icon {
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.data-table .btn-icon:hover {
    transform: scale(1.1);
}

/* Responsive Tables */
@media (max-width: 768px) {
    .data-table {
        font-size: 12px;
        min-width: 600px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }

    .data-table .status-badge {
        font-size: 10px;
        padding: 2px 6px;
    }

    .data-table .btn-icon {
        padding: 4px;
    }
}

/* Sistema alternativo per mobile: Table as Cards */
.data-table-mobile {
    display: none;
}

@media (max-width: 768px) {
    @supports (display: grid) {
        .data-table.mobile-cards {
            display: none;
        }

        .data-table-mobile {
            display: block;
        }

        .data-table-mobile .table-card {
            background: var(--surface-color);
            border-radius: 8px;
            padding: 16px;
            margin-bottom: 12px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
            border: 1px solid var(--border);
        }

        .data-table-mobile .table-card-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 0;
            border-bottom: 1px solid var(--border-color);
        }

        .data-table-mobile .table-card-row:last-child {
            border-bottom: none;
        }

        .data-table-mobile .table-card-label {
            font-weight: 600;
            color: var(--text-secondary);
            font-size: 12px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .data-table-mobile .table-card-value {
            font-size: 14px;
            color: var(--text-primary);
            font-weight: 500;
        }

        .data-table-mobile .table-card-actions {
            margin-top: 12px;
            padding-top: 12px;
            border-top: 1px solid var(--border);
            display: flex;
            gap: 8px;
            justify-content: flex-end;
        }
    }
}
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: #f7fafc;
    color: #4a5568;
    padding: 10px 20px;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
    transform: translateY(-2px);
}

.dark .btn-secondary {
    background: #2d3748;
    color: #e2e8f0;
    border-color: #4a5568;
}

.dark .btn-secondary:hover {
    background: #374151;
    border-color: #6b7280;
}

.btn-success {
    background: #10b981;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
}

.btn-info {
    background: #3b82f6;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-info:hover {
    background: #2563eb;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: var(--surface-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-glass);
    border: 1px solid var(--glass-border);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 16px;
}

.login-form .form-group {
    margin-bottom: 24px;
}

.login-form label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-form input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1), var(--shadow);
    transform: translateY(-1px);
}

.login-footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--glass-border);
    color: var(--text-secondary);
    font-size: 12px;
}

.login-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.login-footer a:hover {
    text-decoration: underline;
}

.text-sm {
    font-size: 12px;
}

.mb-3 {
    margin-bottom: 16px;
}

.mt-2 {
    margin-top: 8px;
}

/* ========================================
   6. PAGINE SPECIFICHE
   ======================================== */

/* === Login Page === */
.login-page {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-box {
    background: var(--surface-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-glass);
    border: 1px solid var(--glass-border);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 32px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-form {
    margin-bottom: 24px;
}

.login-footer {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    color: var(--text-muted);
    font-size: 12px;
}

/* === Alerts === */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin: 20px 0;
    font-size: 14px;
}

/* === Animation Utilities === */
/* Stagger delays for multiple elements */

.alert-error {
    background: rgba(245, 101, 101, 0.15);
    color: var(--text);
    border: 1px solid rgba(245, 101, 101, 0.3);
}

.alert-error strong {
    color: #f56565;
}

.alert-success {
    background: rgba(72, 187, 120, 0.15);
    color: var(--text);
    border: 1px solid rgba(72, 187, 120, 0.3);
}

.alert-success strong {
    color: #48bb78;
}

/* === Tabs === */
.tabs-container {
    background: var(--surface-color) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-radius: var(--border-radius) !important;
    box-shadow: var(--shadow-glass) !important;
    overflow: visible !important;
    border: 1px solid var(--glass-border) !important;
}

.tabs-header {
    display: flex !important;
    border-bottom: 1px solid var(--glass-border) !important;
    background: var(--glass-bg) !important;
    backdrop-filter: blur(10px) !important;
    overflow-x: scroll !important;
    overflow-y: hidden !important;
    position: relative;
    z-index: 1;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
}

.tab-btn {
    flex: 1 !important;
    padding: 16px 24px !important;
    background: transparent !important;
    border: none !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #718096 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    border-bottom: 3px solid transparent !important;
    white-space: nowrap !important;
    font-family: 'Poppins', sans-serif !important;
    outline: none !important;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

.tab-btn:focus, .tab-btn:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

.tab-btn:focus {
    outline: none !important;
    box-shadow: none !important;
}

.tab-btn:hover {
    color: var(--text-primary) !important;
    background: var(--sidebar-hover) !important;
}

.tab-btn.active {
    color: var(--text-primary) !important;
    border-bottom-color: var(--primary) !important;
    background: #fff !important;
}

.tabs-content {
    padding: 30px !important;
    min-height: 400px !important;
    background: #fff !important;
}

.tab-pane {
    display: none !important;
}

.tab-pane.active {
    display: block !important;
}

/* === Dashboard Placeholder === */
.dashboard-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    background: var(--surface-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-glass);
    margin-top: 24px;
}

.placeholder-content {
    text-align: center;
    padding: 40px;
}

.placeholder-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.6;
}

.placeholder-content h3 {
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 12px;
}

.placeholder-content p {
    color: var(--text-secondary);
    font-size: 16px;
    max-width: 400px;
    margin: 0 auto;
}


/* === Status Badges === */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.status-success {
    background: #c6f6d5 !important;
    color: #22543d !important;
}

.status-badge.status-warning {
    background: #fef3c7 !important;
    color: #713f12 !important;
}

.status-badge.status-error {
    background: #fed7d7 !important;
    color: #742a2a !important;
}

.status-badge.status-neutral {
    background: #e2e8f0 !important;
    color: #64748b !important;
}

/* === Logs Toolbar === */
.logs-toolbar {
    padding: 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.logs-filters {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.filter-group select,
.filter-group input[type="text"] {
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--input-bg);
    transition: all 0.3s ease;
    min-width: 150px;
}

.filter-group select {
    cursor: pointer;
}

.filter-group select:focus,
.filter-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* === Pagination === */
.pagination-container {
    background: var(--surface-color);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-top: 1px solid var(--border);
}

.pagination a.page-link,
.pagination a.page-link:link,
.pagination a.page-link:visited,
.pagination a.page-link:active,
.pagination button.pagination-btn,
button.pagination-btn {
    padding: 10px 20px !important;
    background: var(--primary) !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
    font-family: 'Poppins', sans-serif !important;
    display: inline-block !important;
}

.pagination a.page-link:hover,
.pagination button.pagination-btn:hover,
button.pagination-btn:hover {
    background: var(--primary-dark) !important;
    color: white !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4) !important;
}

.pagination-info {
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
}

/* === Checkbox personalizzati === */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    background: var(--surface-color);
}

input[type="checkbox"]:hover {
    border-color: var(--primary);
}

input[type="checkbox"]:checked {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
}

input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white !important;
    font-size: 14px;
    font-weight: bold;
}

input[type="checkbox"]:focus {
    outline: none;
}

/* === Button Icons === */
.btn-icon {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.3s ease;
    color: #4a5568;
}

.btn-icon svg {
    stroke: #4a5568;
}

[data-theme="dark"] .btn-icon {
    color: #cbd5e0;
}

[data-theme="dark"] .btn-icon svg {
    stroke: #cbd5e0;
}

.btn-icon:hover {
    background: #f7fafc;
    transform: scale(1.1);
}

.btn-icon:hover svg {
    stroke: #2d3748;
}

[data-theme="dark"] .btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .btn-icon:hover svg {
    stroke: #e2e8f0;
}

/* Regole specifiche per edit-user-btn rimosse per permettere colori btn-icon-info */

.btn-icon-danger:hover {
    background: #fed7d7;
    color: #e53e3e;
}

.btn-icon-danger:hover svg {
    stroke: #e53e3e;
}

[data-theme="dark"] .btn-icon-danger:hover {
    background: rgba(245, 101, 101, 0.3);
    color: #fc8181;
}

[data-theme="dark"] .btn-icon-danger:hover svg {
    stroke: #fc8181;
}

/* Stili per btn-icon-warning */
.btn-icon-warning {
    color: #f59e0b;
}

.btn-icon-warning:hover {
    background: #fef3c7;
    color: #d97706;
}

.btn-icon-warning:hover svg {
    stroke: #d97706;
}

[data-theme="dark"] .btn-icon-warning {
    color: #fcd34d;
}

[data-theme="dark"] .btn-icon-warning:hover {
    background: rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

[data-theme="dark"] .btn-icon-warning:hover svg {
    stroke: #fbbf24;
}

[data-theme="dark"] .btn-icon.btn-icon-warning svg {
    stroke: #fcd34d;
}

[data-theme="dark"] .btn-icon.btn-icon-warning:hover {
    background: rgba(252, 211, 77, 0.2);
    color: #fde68a;
}

[data-theme="dark"] .btn-icon.btn-icon-warning:hover svg {
    stroke: #fde68a;
}

.btn-icon-success {
    color: #10b981;
}

.btn-icon-success:hover {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.btn-icon-success:hover svg {
    stroke: #059669;
}

[data-theme="dark"] .btn-icon.btn-icon-success {
    color: #6ee7b7;
}

[data-theme="dark"] .btn-icon.btn-icon-success svg {
    stroke: #6ee7b7;
}

[data-theme="dark"] .btn-icon.btn-icon-success:hover {
    background: rgba(110, 231, 183, 0.2);
    color: #a7f3d0;
}

[data-theme="dark"] .btn-icon.btn-icon-success:hover svg {
    stroke: #a7f3d0;
}

.btn-danger {
    background: #ff3b30;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.4);
}

/* === Modal === */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Blocca completamente lo scroll quando modal è aperto */
body.modal-open {
    overflow: hidden !important;
    height: 100vh !important;
}

body.modal-open .main-content {
    overflow: hidden !important;
}

.modal-container {
    background: var(--surface-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    z-index: 9999;
    border: 1px solid var(--glass-border);
}

.modal-container.modal-size-large {
    max-width: 800px;
}

/* Specific styles for user creation modal to match confirm modal but with white background
   and a slightly more decorative active box */
#userCreateModal .modal-container,
#userEditModal .modal-container {
    background: var(--surface);
    border-color: var(--border);
}

#userCreateModal.modal-overlay.active .modal-container,
#userCreateModal .modal-container.active,
#userEditModal.modal-overlay.active .modal-container,
#userEditModal .modal-container.active {
    transform: translateY(-6px);
    box-shadow: 0 30px 60px rgba(15, 23, 42, 0.18);
    border: 1px solid rgba(99,102,241,0.08);
}

.modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-icon {
    font-size: 32px;
}

.modal-icon.danger {
    color: #f56565;
}

.modal-icon.warning {
    color: #ed8936;
}

.modal-icon.info {
    color: #4299e1;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    flex: 1;
}

.modal-body {
    padding: 24px;
}

.modal-message {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn-cancel {
    background: #e2e8f0;
    color: #4a5568;
}

.modal-btn-cancel:hover {
    background: #cbd5e0;
}

.modal-btn-confirm {
    background: linear-gradient(135deg, #f56565 0%, #c53030 100%);
    color: white;
}

.modal-btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.4);
}

.modal-btn-confirm.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.modal-btn-primary {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.modal-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.modal-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.modal-btn-danger {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    color: white;
    font-weight: 600;
}

.modal-btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.5);
    background: linear-gradient(135deg, #c53030 0%, #9b2c2c 100%);
}

.modal-btn-danger.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.modal-btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    font-weight: 600;
}

.modal-btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.5);
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.modal-btn-warning.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Enhanced View Modal Styles */
#viewRichiestaModal .modal-body {
    padding: 0;
}

#viewRichiestaModal .modal-body > div {
    background: var(--surface-color);
}

#viewRichiestaModal h2,
#viewRichiestaModal h3,
#viewRichiestaModal p,
#viewRichiestaModal span {
    margin: 0;
}

/* Enhanced View Modal Styles - Grammatica */
#viewGrammaticaModal .modal-body {
    padding: 0;
}

#viewGrammaticaModal .modal-body > div {
    background: var(--surface-color);
}

#viewGrammaticaModal h2,
#viewGrammaticaModal h3,
#viewGrammaticaModal h4,
#viewGrammaticaModal p,
#viewGrammaticaModal span {
    margin: 0;
}

.view-grammatica-details .view-section {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.view-grammatica-details .view-section:last-child {
    border-bottom: none;
}

.view-grammatica-details .view-row {
    padding: 12px 0;
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.view-grammatica-details .view-row strong {
    min-width: 140px;
    color: var(--text-muted);
    font-weight: 600;
}

.view-grammatica-details h4 {
    font-size: 1.1em;
    margin-bottom: 16px !important;
    color: var(--text-primary);
}

.view-grammatica-details .view-text-content {
    line-height: 1.8;
    color: var(--text-primary);
}

.view-grammatica-details .view-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ========================================
   8. RESPONSIVE DESIGN
   ======================================== */

/* Hamburger Menu Button */
.hamburger-btn {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1100;
    background: var(--primary-color);
    border: none;
    border-radius: 8px;
    width: 48px;
    height: 48px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: var(--transition);
}

.hamburger-btn span {
    display: block;
    width: 24px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

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

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

.sidebar-overlay.active {
    display: block;
}

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 280px;
    }
    
    .hamburger-btn {
        display: flex;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.sidebar-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .content-wrapper {
        padding: 80px 32px 32px 32px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile (max-width: 768px) */
@media (max-width: 768px) {
    .hamburger-btn {
        top: 16px;
        left: 16px;
        width: 44px;
        height: 44px;
    }
    
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        height: 100vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        position: fixed;
        top: 0;
        left: 0;
    }
    
    .sidebar.sidebar-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .content-wrapper {
        padding: 70px 16px 24px 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .dashboard-grid, .settings-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .card, .settings-card {
        border-radius: 12px;
    }
    
    .card-header, .settings-card .card-header {
        padding: 16px;
    }
    
    .card-header h2 {
        font-size: 18px;
    }
    
    .card-body, .settings-card .card-body {
        padding: 16px;
    }
    
    /* Tabs Responsive */
    .tabs-header {
        overflow-x: scroll !important;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        display: flex;
        flex-wrap: nowrap !important;
        scroll-behavior: smooth;
    }
    
    /* Scrollbar per tabs su webkit */
    .tabs-header::-webkit-scrollbar {
        height: 4px;
    }
    
    .tabs-header::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .tabs-header::-webkit-scrollbar-thumb {
        background: var(--glass-border);
        border-radius: 4px;
    }
    
    .tab-btn {
        min-width: 120px !important;
        padding: 14px 20px !important;
        font-size: 14px !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        flex: 0 0 auto !important;
        cursor: pointer !important;
        touch-action: manipulation !important;
        pointer-events: auto !important;
    }
    
    .tabs-content {
        padding: 16px;
    }
    

    
    /* Forms Responsive */
    .form-group {
        margin-bottom: 16px;
    }
    
    .form-group label {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Previene zoom su iOS */
        padding: 12px 14px;
        min-height: 44px; /* Touch-friendly */
    }
    
    .form-group textarea {
        min-height: 100px;
    }
    
    /* Buttons Touch-Friendly */
    .btn, .btn-primary, .btn-secondary, .btn-danger {
        min-height: 44px;
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .btn-icon {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Filters Mobile */
    .logs-filters, .users-filters, .interactions-filters {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-group select,
    .filter-group input {
        width: 100%;
    }
    
    /* Pagination Mobile */
    .pagination {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .pagination-info {
        text-align: center;
        order: -1;
    }
    
    .pagination-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* User Info Sidebar */
    .user-info {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .user-details {
        text-align: center;
    }
    
    /* Modal/Dialog Mobile */
    .modal-content {
        width: calc(100% - 32px);
        margin: 16px;
        max-height: calc(100vh - 32px);
        overflow-y: auto;
    }
    
    /* Avatar Upload */
    .avatar-upload {
        flex-direction: column;
        gap: 12px;
    }
    
    .avatar-upload-label {
        width: 100%;
        text-align: center;
    }
    
    /* Profile Info */
    .profile-info {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }
    
    .profile-avatar-wrapper {
        margin: 0 auto;
    }
}

/* ========================================
   7. COMPONENTI SPECIALI
   ======================================== */

/* === Toast Notifications === */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    pointer-events: none;
}

@media (max-width: 768px) {
    .toast-container {
        top: 70px; /* Sotto hamburger button */
        right: 16px;
        left: 16px;
        max-width: none;
    }
}

.toast {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 320px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    border-left: 4px solid;
}

@media (max-width: 768px) {
    .toast {
        min-width: auto;
        width: 100%;
        transform: translateY(-100px);
    }
    
    .toast.toast-show {
        transform: translateY(0);
    }
}

.toast.toast-show {
    opacity: 1;
    transform: translateX(0);
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
    line-height: 1;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #64748b;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
    flex-shrink: 0;
    line-height: 1;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1e293b;
}

/* Toast Types */
.toast-success {
    border-left-color: #10b981;
    background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 100%);
}

.toast-error {
    border-left-color: #ef4444;
    background: linear-gradient(135deg, #fef2f2 0%, #ffffff 100%);
}

.toast-warning {
    border-left-color: #f59e0b;
    background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
}

.toast-info {
    border-left-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
}

/* ============================================================================
   API KEYS MANAGEMENT
   ============================================================================ */

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--hover-bg, rgba(0, 0, 0, 0.05));
}

.btn-icon-danger {
    color: var(--error-color, #ef4444);
}

.btn-icon-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.btn-icon-warning {
    color: var(--warning-color, #f59e0b);
}

.btn-icon-warning:hover {
    background: rgba(245, 158, 11, 0.1);
}

.btn-icon-info {
    color: #3b82f6;
}

.btn-icon-info:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.btn-icon-info:hover svg {
    stroke: #3b82f6;
}

[data-theme="dark"] .btn-icon-info {
    color: #3b82f6;
}

[data-theme="dark"] .btn-icon-info:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

[data-theme="dark"] .btn-icon-info:hover svg {
    stroke: #3b82f6;
}

.btn-icon-primary {
    color: #06b6d4;
}

.btn-icon-primary:hover {
    background: rgba(6, 182, 212, 0.1);
    color: #06b6d4;
}

.btn-icon-primary:hover svg {
    stroke: #06b6d4;
}

[data-theme="dark"] .btn-icon-primary {
    color: #22d3ee;
}

[data-theme="dark"] .btn-icon-primary:hover {
    background: rgba(34, 211, 238, 0.1);
    color: #22d3ee;
}

[data-theme="dark"] .btn-icon-primary:hover svg {
    stroke: #22d3ee;
}

#api-keys-table code {
    font-family: 'Courier New', monospace;
    background: var(--input-bg, #f3f4f6);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
}

/* ============================================================================
   UTILITY CLASSES - Rimozione stili inline
   ============================================================================ */

/* Display */
.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-inline-block { display: inline-block; }

/* Flex utilities */
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-start { display: flex; align-items: center; }
.flex-end { display: flex; align-items: center; justify-content: flex-end; }
.flex-column { flex-direction: column; }
.flex-1 { flex: 1; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-1rem { gap: 1rem; }

/* Text alignment */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right !important; }

/* Spacing - Padding */
.p-0 { padding: 0; }
.p-16 { padding: 16px; }
.p-20 { padding: 20px; }
.p-24 { padding: 24px; }
.p-32 { padding: 32px; }
.p-40 { padding: 40px; }
.pt-24 { padding-top: 24px; }
.pb-24 { padding-bottom: 24px; }
.pt-1-5rem { padding-top: 1.5rem; }
.padding-vertical-12 { padding: 0.75rem 2rem; }

/* Spacing - Margin */
.m-0 { margin: 0; }
.m-auto { margin: 0 auto; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mt-0-5rem { margin-top: 0.5rem; }
.mt-1-5rem { margin-top: 1.5rem; }
.mb-6 { margin-bottom: 6px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-0-5rem { margin-bottom: 0.5rem; }
.mb-0-75rem { margin-bottom: 0.75rem; }
.mb-1rem { margin-bottom: 1rem; }
.mb-2rem { margin-bottom: 2rem; }
.mr-0-5rem { margin-right: 0.5rem; }

/* Colors */
.color-white { color: white !important; }
.color-primary { color: var(--primary-color); }
.color-success { color: var(--success-color, #10b981); }
.color-danger { color: var(--danger-color, #ef4444); }
.color-warning { color: var(--warning-color, #f59e0b); }
.color-muted { color: var(--text-muted); }
.color-text { color: var(--text-color); }
.color-718096 { color: #718096; }
.color-667eea { color: #667eea; }
.color-2d3748 { color: #2d3748; }

/* Font sizes */
.fs-11 { font-size: 11px; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-14 { font-size: 14px; }
.fs-15 { font-size: 15px; }
.fs-16 { font-size: 16px; }
.fs-32 { font-size: 32px; }
.fs-48 { font-size: 48px; }
.fs-2rem { font-size: 2rem; }
.fs-2-5rem { font-size: 2.5rem; }
.fs-0-85rem { font-size: 0.85rem; }
.fs-0-9rem { font-size: 0.9rem; }
.fs-0-95rem { font-size: 0.95rem; }
.fs-1rem { font-size: 1rem; }
.fs-1-1rem { font-size: 1.1rem; }

/* Font weight */
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* Border */
.border-top { border-top: 1px solid var(--border-color, #e2e8f0); }
.border-radius-8 { border-radius: 8px; }
.border-radius-12 { border-radius: 12px; }

/* Width */
.w-100 { width: 100%; }
.w-32 { width: 32px; }
.w-120 { width: 120px; }
.max-w-150 { max-width: 150px; }
.max-w-180 { max-width: 180px; }
.max-w-200 { max-width: 200px; }
.max-w-250 { max-width: 250px; }

/* Height */
.max-h-80 { max-height: 80px; }

/* Opacity */
.opacity-30 { opacity: 0.3; }

/* Cursor */
.cursor-not-allowed { cursor: not-allowed; }
.cursor-pointer { cursor: pointer; }

/* Position */
.position-relative { position: relative; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-ellipsis { 
    overflow: hidden; 
    text-overflow: ellipsis; 
    white-space: nowrap;
}

/* White space */
.white-space-nowrap { white-space: nowrap; }
.white-space-pre-wrap { white-space: pre-wrap; }

/* Word break */
.word-break-all { word-break: break-all; }

/* Line height */
.lh-1-5 { line-height: 1.5; }
.lh-1-8 { line-height: 1.8; }

/* Text decoration */
.text-decoration-none { text-decoration: none; }

/* Text transform */
.text-uppercase { text-transform: uppercase; }

/* List style */
.list-disc { list-style: disc; }
.pl-24 { padding-left: 24px; }
.pl-1-25rem { padding-left: 1.25rem; }

/* Avatar preview */
.avatar-preview {
    max-width: 150px;
    border-radius: 50%;
    border: 3px solid var(--primary-color, #667eea);
}

/* Favicon preview */
.favicon-preview {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

/* Logo preview */
.logo-preview {
    max-width: 200px;
    max-height: 80px;
}

/* Icon in upload area */
.upload-icon {
    font-size: 2.5rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: block;
}

/* File selected indicator */
.file-selected-text {
    margin: 0.5rem 0;
    color: var(--text-color);
    font-weight: 500;
}

/* Check circle icon */
.check-circle-icon {
    color: var(--success-color, #10b981);
}

/* Warning icon */
.warning-icon {
    color: var(--warning-color, #f59e0b);
}

/* Large emoji/icon */
.emoji-large {
    font-size: 48px;
    margin-bottom: 8px;
}

/* Form sections */
.form-section {
    margin-bottom: 24px;
    padding: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

/* Section title */
.section-title {
    margin: 0 0 16px 0;
    font-size: 16px;
}

/* Settings section */
.settings-section {
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
}

.settings-section-icon {
    font-size: 2rem;
    color: var(--primary-color);
}

.settings-section-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.settings-section-description {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
}

/* Button styles */
.btn-save {
    color: white !important;
    padding: 0.75rem 2rem;
    font-weight: 500;
}

/* Code block */
.code-block {
    display: block;
    padding: 0.75rem;
    background: var(--input-bg, var(--card-bg));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: monospace;
    font-size: 13px;
    color: var(--text-color);
}

.code-inline {
    background: var(--input-bg, var(--card-bg));
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    color: var(--text-color);
}

/* Toggle switch customizations */
.toggle-switch-custom {
    position: relative;
    display: inline-block;
    width: 66px;
    height: 38px;
}

.toggle-input-hidden {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

/* Cache info */
.cache-status-icon {
    font-size: 32px;
}

.redis-connected {
    color: #10b981;
}

.redis-warning {
    color: #f59e0b;
}

.redis-error {
    color: #ef4444;
}

/* Grid layouts */
.grid-2-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Filters bar */
.logs-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Header info */
.header-info-count {
    margin: 8px 0 0 0;
    font-size: 13px;
    color: #718096;
}

/* Avatar section heading */
.avatar-section-heading {
    font-size: 16px;
    margin-bottom: 12px;
    color: #2d3748;
}

/* Profile info separator */
.profile-info-separator {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

/* Theme form actions */
.theme-form-actions {
    display: flex;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* Theme info box */
.theme-info-list {
    margin: 0.5rem 0 0 1.25rem;
    padding: 0;
    line-height: 1.8;
}

/* Modal warning */
.modal-warning-text {
    color: #e53e3e;
    margin-top: 12px;
    font-size: 14px;
}

/* Backup settings */
.backup-card-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Small text */
.small-text {
    display: block;
    margin-top: 8px;
    color: #718096;
}

/* Link style for 404 */
.link-primary {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

/* Sidebar logo sizing */
.sidebar-logo-img {
    max-width: 180px;
    display: block;
}

/* Form actions button container */
.form-actions-btn-container {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

/* 2FA Actions */
.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.form-actions .btn {
    flex: 1;
    min-width: 200px;
    justify-content: center;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    padding: 12px 20px;
}

@media (max-width: 768px) {
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
        min-width: 100%;
    }
}

/* Upload status */
.upload-status {
    margin-top: 0.5rem;
}

/* Cache toggle container */
.cache-toggle-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: var(--surface);
    border-radius: 12px;
    border: 2px solid var(--border);
    transition: all 0.3s ease;
}

.cache-toggle-label-container {
    flex: 1;
}

.cache-toggle-label {
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    display: block;
    font-size: 15px;
}

.cache-toggle-description {
    color: var(--text-secondary);
    display: block;
    line-height: 1.5;
}

.cache-toggle-ttl {
    color: var(--text-muted);
    font-size: 12px;
}

/* Import form */
.import-form {
    margin: 0;
}

/* Max backups control */
.max-backups-control {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

/* Info box sections */
.info-box-flex {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Step 4 setup */
.setup-step4-container {
    text-align: center;
    padding: 20px 0;
}

.setup-step4-text {
    margin-bottom: 20px;
    color: #666;
    font-size: 14px;
}

/* Additional utility classes for JS generated content */
.status-span-danger { color: var(--danger-color, #ef4444); }
.status-span-success { color: var(--success-color, #10b981); }
.status-span-primary { color: var(--primary-color); }

/* Table loading and error states */
.table-loading,
.table-error,
.table-empty {
    text-align: center;
    padding: 40px;
}

.table-error {
    color: var(--danger-color, #c33);
}

/* Font sizes for small code */
.fs-12 { font-size: 12px; }

/* Padding 32 */
.p-32 { padding: 32px; }

/* ========================================
   2FA (Two-Factor Authentication) Styles
   ======================================== */

.qr-code-box {
    background: white;
    padding: 20px;
    border-radius: 12px;
    display: inline-block;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.qr-code-img {
    display: block;
    max-width: 256px;
    height: auto;
}

.secret-key {
    display: inline-block;
    background: var(--surface-color);
    padding: 12px 20px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    letter-spacing: 2px;
    border: 1px solid var(--border-color);
    word-break: break-all;
}

.backup-codes-container {
    background: var(--surface-color);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    min-height: 300px;
}

.backup-codes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 12px;
    grid-auto-rows: minmax(50px, auto);
}

.backup-code {
    display: block;
    background: var(--card-bg);
    color: var(--text);
    padding: 14px 12px;
    min-height: 50px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    border: 2px solid var(--border-color);
    letter-spacing: 1px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.backup-code:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

/* Modal backup codes - max height sul body per scroll interno */
#backup-codes-modal .modal-container {
    max-width: 700px;
}

#backup-codes-modal .modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

/* Spacing per card 2FA */
.mt-20 {
    margin-top: 20px;
}

/* Spinner loader */
.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive 2FA */
@media (max-width: 768px) {
    .backup-codes-grid {
        grid-template-columns: 1fr;
    }
    
    .qr-code-box {
        max-width: 100%;
    }
    
    .qr-code-img {
        max-width: 200px;
    }
}

/* === Quill Editor Styling === */
.ql-editor {
    color: #1a1a1a !important;
    min-height: 300px;
}

.ql-editor p,
.ql-editor h1,
.ql-editor h2,
.ql-editor h3,
.ql-editor h4,
.ql-editor h5,
.ql-editor h6,
.ql-editor span,
.ql-editor li,
.ql-editor div {
    color: #1a1a1a !important;
}

.ql-editor.ql-blank::before {
    color: #888 !important;
}

.ql-toolbar {
    background: #f5f5f5;
    border-color: #ddd !important;
    border-radius: 8px 8px 0 0;
}

.ql-container {
    border-color: #ddd !important;
    border-radius: 0 0 8px 8px;
}

/* ============================================================================
   UTILITY CLASSES - Rimozione stili inline
   ============================================================================ */

/* Margin & Padding */
.m-0 { margin: 0; }
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-4 { margin-bottom: 4px; }
.mb-6 { margin-bottom: 6px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mb-30 { margin-bottom: 30px; }
.mb-32 { margin-bottom: 32px; }
.mr-half { margin-right: 0.5rem; }
.p-20 { padding: 20px; }
.p-24 { padding: 24px; }
.pt-24 { padding-top: 24px; }
.pb-16 { padding-bottom: 16px; }
.px-20 { padding-left: 20px; padding-right: 20px; }

/* Flexbox */
.flex { display: flex; }
.flex-center-center { display: flex; align-items: center; justify-content: center; }
.flex-align-center { display: flex; align-items: center; }
.flex-justify-between { display: flex; justify-content: space-between; }
.flex-space-between-center { display: flex; justify-content: space-between; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

/* Grid */
.grid-2-cols-gap-20 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2-cols-gap-1rem { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-gap-1rem { display: grid; gap: 1rem; }

/* Text */
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-weight-600 { font-weight: 600; }
.font-weight-700 { font-weight: 700; }
.font-size-12 { font-size: 12px; }
.font-size-13 { font-size: 13px; }
.font-size-14 { font-size: 14px; }
.font-size-15 { font-size: 15px; }
.font-size-16 { font-size: 16px; }
.font-size-18 { font-size: 18px; }
.font-size-32 { font-size: 32px; }
.font-size-48 { font-size: 48px; }
.line-height-1-5 { line-height: 1.5; }
.line-height-1-6 { line-height: 1.6; }
.line-height-1-8 { line-height: 1.8; }
.white-space-nowrap { white-space: nowrap; }
.white-space-pre-wrap { white-space: pre-wrap; }
.word-break-all { word-break: break-all; }

/* Colors */
.color-primary { color: var(--primary); }
.color-success { color: var(--success); }
.color-warning { color: var(--warning); }
.color-danger { color: var(--danger); }
.color-text { color: var(--text-color); }
.color-text-secondary { color: var(--text-secondary); }
.color-text-muted { color: var(--text-muted); }
.color-error { color: var(--error-color); }

/* Backgrounds */
.bg-card { background: var(--card-bg); }
.bg-surface { background: var(--surface); }
.bg-input { background: var(--input-bg); }

/* Borders */
.border-2-primary { border: 2px solid var(--border); }
.border-2-success { border: 2px solid #10b98133; }
.border-2-warning { border: 2px solid #fbbf2433; }
.border-left-4-primary { border-left: 4px solid var(--primary); }
.border-left-3-warning { border-left: 3px solid var(--warning, #ffc107); }
.border-radius-8 { border-radius: 8px; }
.border-radius-12 { border-radius: 12px; }
.border-top-1 { border-top: 1px solid var(--border-color); }
.border-1 { border: 1px solid var(--border-color); }

/* Dimensions */
.width-100 { width: 100%; }
.max-width-50 { max-width: 50%; }
.flex-basis-50 { flex: 0 0 50%; }
.height-300 { height: 300px; }
.min-height-300 { min-height: 300px; }
.max-width-900 { max-width: 900px; }

/* Display */
.display-none { display: none; }
.display-block { display: block; }
.display-inline-block { display: inline-block; }

/* Position */
.position-relative { position: relative; }
.position-absolute { position: absolute; }

/* Opacity */
.opacity-30 { opacity: 0.3; }

/* Overflow */
.overflow-hidden { overflow: hidden; }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

/* Specific Components */
.settings-section {
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
}

.settings-card-mb {
    margin-bottom: 20px;
}

.settings-card-mt {
    margin-top: 1.5rem;
}

.backup-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.backup-card {
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    background: var(--surface);
}

.backup-card-icon {
    font-size: 32px;
}

.backup-card-title {
    margin: 0;
    font-size: 18px;
}

.backup-card-subtitle {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.backup-card-description {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.info-box-gradient {
    padding: 16px;
    background: linear-gradient(135deg, rgba(99,102,241,0.1) 0%, rgba(139,92,246,0.1) 100%);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
}

.loading-container {
    text-align: center;
    padding: 40px;
}

.empty-state-container {
    display: none;
    text-align: center;
    padding: 40px 20px;
}

.empty-state-icon {
    font-size: 48px;
    opacity: 0.3;
}

.empty-state-text {
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 14px;
}

.modal-container-large {
    max-width: 900px;
}

.quill-container {
    height: 300px;
    background: #ffffff;
    border: 1px solid var(--input-border);
    border-radius: 8px;
}

.quill-container .ql-toolbar.ql-snow {
    background: #f8f9fa;
    border-bottom: 1px solid #e2e8f0;
}

.quill-container .ql-editor {
    background: #ffffff !important;
    color: #1e293b !important;
    font-size: 14px;
    line-height: 1.6;
}

.quill-container .ql-editor.ql-blank::before {
    color: #94a3b8 !important;
    font-style: italic;
}

.quill-container .ql-snow .ql-stroke {
    stroke: #334155 !important;
}

.quill-container .ql-snow .ql-fill {
    fill: #334155 !important;
}

.quill-container .ql-snow .ql-picker-label {
    color: #334155 !important;
}

.quill-container .ql-toolbar.ql-snow .ql-picker-label:hover .ql-stroke,
.quill-container .ql-toolbar.ql-snow button:hover .ql-stroke,
.quill-container .ql-toolbar.ql-snow button.ql-active .ql-stroke {
    stroke: #6366f1 !important;
}

.quill-container .ql-toolbar.ql-snow .ql-picker-label:hover .ql-fill,
.quill-container .ql-toolbar.ql-snow button:hover .ql-fill,
.quill-container .ql-toolbar.ql-snow button.ql-active .ql-fill {
    fill: #6366f1 !important;
}

.form-label-bold {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    display: block;
}

.form-label-small {
    color: var(--text-color);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    display: block;
}

.form-small-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    display: block;
}

.form-small-text-quarter {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.25rem;
    display: block;
}

.flex-input-group {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.btn-save-backup {
    white-space: nowrap;
    color: white !important;
    padding: 0.625rem 1.25rem;
    height: auto;
}

.cron-command-code {
    display: block;
    padding: 0.75rem;
    background: var(--input-bg, var(--card-bg));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: monospace;
    font-size: 13px;
    color: var(--text-color);
    white-space: pre-wrap;
    word-break: break-all;
}

.inline-code {
    background: var(--input-bg, var(--card-bg));
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    color: var(--text-color);
}

.inline-code-box {
    background: rgba(0,0,0,0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.table-icon-primary {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

.card-body-no-padding {
    padding: 0;
}

.cache-toggle-switch {
    position: relative;
    display: inline-block;
    width: 66px;
    height: 38px;
}

.cache-toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: var(--surface);
    border-radius: 12px;
    border: 2px solid var(--border);
    transition: all 0.3s ease;
}

.cache-toggle-wrapper.active {
    border-color: #10b98133;
}

.cache-toggle-wrapper.warning {
    border-color: #fbbf2433;
}

.cache-toggle-content {
    flex: 1;
}

.cache-toggle-title {
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    display: block;
    font-size: 15px;
}

.cache-toggle-description {
    color: var(--text-secondary);
    display: block;
    line-height: 1.5;
}

.cache-toggle-meta {
    color: var(--text-muted);
    font-size: 12px;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 38px;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.15), 0 1px 3px rgba(0,0,0,0.1);
}

.toggle-slider.enabled {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.toggle-slider.disabled {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
}

.toggle-slider.not-available {
    background: linear-gradient(135deg, #d1d5db 0%, #9ca3af 100%);
}

.toggle-knob {
    position: absolute;
    height: 30px;
    width: 30px;
    left: 4px;
    bottom: 4px;
    background: var(--input-bg);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 3px 8px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #10b981;
}

.toggle-knob.enabled {
    transform: translateX(28px);
}

.avatar-preview-container {
    margin: 16px 0;
}

.status-cell {
    text-align: center;
}

.table-loading-message {
    text-align: center;
    padding: 40px;
}

.table-empty-message {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.table-empty-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.table-code-cell {
    font-size: 12px;
}

.btn-icon-colored-pause {
    color: #fcd34d !important;
}

.btn-icon-colored-play {
    color: #6ee7b7 !important;
}

.svg-stroke-pause {
    stroke: #fcd34d !important;
}

.svg-stroke-play {
    stroke: #6ee7b7 !important;
}

.status-loading {
    color: var(--primary);
}

.status-error {
    color: var(--danger);
}

.info-box-section {
    margin-bottom: 24px;
}

.form-group-mt {
    margin-top: 1.5rem;
}

.form-group-mb {
    margin-bottom: 24px;
}

.form-mt {
    margin-top: 24px;
}

.section-divider {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.section-title {
    font-size: 16px;
    margin-bottom: 12px;
}

.list-styled {
    list-style: disc;
    padding-left: 24px;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.8;
}

.warning-box {
    margin-top: 8px;
    font-size: 12px;
    padding: 8px;
    background: var(--warning-bg, #fff3cd);
    border-left: 3px solid var(--warning, #ffc107);
    border-radius: 4px;
}

.file-info-text {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.bulk-actions-container {
    display: none;
    gap: 8px;
}

.filter-actions-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.lemmi-stats {
    color: var(--success);
}

.lemmi-stats-bozze {
    color: var(--warning);
}

/* ============================================================================
   ADDITIONAL UTILITY CLASSES - Extended
   ============================================================================ */

/* Gap utilities */
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-075rem { gap: 0.75rem; }
.gap-1rem { gap: 1rem; }

/* Border utilities */
.border-color { border-color: var(--border-color); }
.border-primary { border-color: var(--primary); }

/* Text decoration */
.text-decoration-none { text-decoration: none; }

/* Pointer events */
.pointer-events-none { pointer-events: none; }

/* Transform utilities */
.transform-translateX-28 { transform: translateX(28px); }

/* Transition utilities */
.transition-all-03s { transition: all 0.3s ease; }
.transition-all-04s { transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); }

/* Box shadow utilities */
.box-shadow-inset { box-shadow: inset 0 2px 6px rgba(0,0,0,0.15), 0 1px 3px rgba(0,0,0,0.1); }
.box-shadow-toggle { box-shadow: 0 3px 8px rgba(0,0,0,0.25); }

/* Specific element styles */
[data-align="right"] {
    text-align: right !important;
}

/* JavaScript-generated table cell styling */
.js-table-cell-center {
    text-align: center;
    padding: 40px;
}

.js-empty-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.js-status-loading {
    color: var(--primary);
}

.js-status-error {
    color: var(--danger);
}

/* Cache Redis Toggle */
.cache-toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: var(--surface);
    border-radius: 12px;
    border: 2px solid var(--border);
    transition: all 0.3s ease;
}

.cache-toggle-wrapper.redis-enabled {
    border-color: #10b98133;
}

.cache-toggle-wrapper.redis-warning {
    border-color: #fbbf2433;
}

.cache-toggle-content {
    flex: 1;
}

.cache-toggle-label {
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    display: block;
    font-size: 15px;
}

.cache-toggle-description {
    color: var(--text-secondary);
    display: block;
    line-height: 1.5;
}

.cache-toggle-meta {
    color: var(--text-muted);
    font-size: 12px;
}

.redis-status-icon {
    font-size: 32px;
}

.redis-status-text-success {
    color: #10b981;
}

.redis-status-text-warning {
    color: #f59e0b;
}

.redis-status-text-error {
    color: #ef4444;
}

.cache-info-title {
    font-size: 16px;
    margin-bottom: 12px;
}

.cache-info-list {
    list-style: disc;
    padding-left: 24px;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.8;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 66px;
    height: 38px;
}

.toggle-switch.disabled {
    cursor: not-allowed;
}

.toggle-switch.enabled {
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 38px;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.15), 0 1px 3px rgba(0,0,0,0.1);
}

.toggle-slider.disabled-bg {
    background: linear-gradient(135deg, #d1d5db 0%, #9ca3af 100%);
}

.toggle-slider.enabled-bg {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.toggle-slider.inactive-bg {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
}

.toggle-knob {
    position: absolute;
    height: 30px;
    width: 30px;
    left: 4px;
    bottom: 4px;
    background: var(--input-bg);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 3px 8px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #10b981;
}

.toggle-knob.checked {
    transform: translateX(28px);
}

/* Backup & Form Labels */
.form-label-bold {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    display: block;
}

.form-label-small {
    color: var(--text-color);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    display: block;
}

.form-text-muted {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    display: block;
}

.mt-1-5 {
    margin-top: 1.5rem;
}

.cron-command-display {
    display: block;
    padding: 0.75rem;
    background: var(--input-bg, var(--card-bg));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: monospace;
    font-size: 13px;
    color: var(--text-color);
    white-space: pre-wrap;
    word-break: break-all;
}

.inline-code {
    background: var(--input-bg, var(--card-bg));
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    color: var(--text-color);
}

.text-strong-color {
    color: var(--text-color);
}

/* Additional form styling */
.form-control-width-100 {
    width: 100%;
}

.select-width-100 {
    width: 100%;
}

/* Grid utilities for specific layouts */
.grid-cron-time {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* File upload area */
.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    background: var(--input-bg, var(--card-bg));
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-remove-file {
    background: none;
    border: none;
    color: var(--danger-color, #ef4444);
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: underline;
    padding: 0.25rem 0.5rem;
}

.import-file-input {
    width: 100%;
    padding: 12px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    background: var(--input-bg, var(--card-bg));
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    transition: all 0.3s ease;
}

.import-file-input:hover {
    border-color: var(--primary-color);
    background: var(--hover-bg);
}

/* Lemma Edit Page - Form & Repeaters */
.lemma-form {
    max-width: 1200px;
    margin: 0 auto;
}

.lemma-form .settings-card {
    margin-bottom: 20px;
}

.content-header a.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.content-header a.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* === Forms === */
.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
}

.form-group small {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.required {
    color: var(--error-color);
}

.repeater-list,
.repeater-list-complex {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.repeater-item {
    display: flex;
    gap: 8px;
    align-items: center;
}

.repeater-item input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.repeater-item-complex {
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface-color);
    cursor: move;
    transition: all 0.2s ease;
}

.repeater-item-complex.dragging {
    opacity: 0.5;
    border-color: var(--primary);
}

.repeater-item-complex.drag-over {
    border-top: 3px solid var(--primary);
}

.repeater-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.repeater-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.drag-handle {
    cursor: grab;
    color: var(--text-secondary);
    padding: 4px;
    display: flex;
    align-items: center;
}

.drag-handle:active {
    cursor: grabbing;
}

/* 404 Error Page */
.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
    text-align: center;
    padding: 60px 20px;
}

.error-icon-wrapper {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-glass);
}

.error-icon {
    font-size: 60px;
}

.error-code {
    font-size: 120px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin: 0 0 20px 0;
    text-shadow: none;
}

.error-title {
    font-size: 32px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 15px 0;
}

.error-message {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto 40px;
    line-height: 1.6;
}

.error-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 50px;
}

.error-btn {
    padding: 14px 28px;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
}

.error-btn span {
    display: inline-block;
}

.error-btn-primary {
    background: var(--primary);
    color: white !important;
    box-shadow: 0 4px 20px var(--primary-shadow);
    border-color: var(--primary);
}

.error-btn-primary span {
    color: white !important;
}

.error-btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px var(--primary-shadow);
    color: white !important;
}

.error-btn-primary svg {
    color: white !important;
    stroke: white !important;
}

.error-btn-secondary {
    background: var(--surface);
    color: var(--text) !important;
    border: 1px solid var(--border);
}

.error-btn-secondary span {
    color: var(--text) !important;
}

.error-btn-secondary:hover {
    background: var(--glass-bg);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glass);
    color: var(--text) !important;
}

.error-btn-secondary svg {
    color: var(--text) !important;
    stroke: var(--text) !important;
}

.error-btn svg {
    width: 18px;
    height: 18px;
}

.error-suggestions {
    margin-top: 20px;
    padding: 30px;
    background: var(--surface);
    border-radius: var(--border-radius);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-glass);
}

.error-suggestions h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 20px 0;
}

.error-suggestions ul {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

.error-suggestions li {
    padding: 12px 0;
    color: var(--text-secondary);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.error-suggestions li svg {
    width: 20px;
    height: 20px;
    color: var(--primary);
    flex-shrink: 0;
}

.error-suggestions a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.error-suggestions a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Login Page Overrides */
.login-page {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --surface-color: #ffffff;
    --text-primary: #1a202c;
    --text-secondary: #718096;
    --text-muted: #a0aec0;
    --border-color: #e2e8f0;
    --glass-border: rgba(226, 232, 240, 0.5);
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --border-radius: 16px;
    --transition: all 0.3s ease;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Theme Settings Page */
.radio-group {
    display: flex;
    flex-direction: row;
    gap: 1rem;
}

.radio-option {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--surface);
    flex: 1;
}

.radio-option:hover {
    border-color: var(--primary);
    background: var(--input-bg);
}

.radio-option:has(input[type="radio"]:checked) {
    border-color: var(--primary);
    border-width: 2px;
}

.radio-option input[type="radio"] {
    margin-top: 0.25rem;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    outline: none !important;
    border: none !important;
}

.radio-option input[type="radio"]:focus {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

.radio-option input[type="radio"]:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

.radio-option input[type="radio"]:checked {
    accent-color: var(--primary);
}

.radio-label {
    flex: 1;
}

.color-picker-wrapper {
    display: flex;
    gap: 1rem;
    align-items: stretch;
}

.color-picker {
    width: 20% !important;
    height: 50px !important;
    min-width: 80px !important;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

.color-input {
    flex: 1;
    padding: 0.75rem 1rem;
    height: 50px;
    border: 2px solid var(--input-border);
    border-radius: 8px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 1rem;
    font-weight: 500;
    max-width: 200px;
    background: var(--input-bg);
    color: var(--input-text);
    box-sizing: border-box;
}

.info-box {
    background: var(--input-bg);
    border-left: 4px solid var(--primary);
    padding: 1.25rem;
    border-radius: 6px;
}

.info-box ul {
    list-style-type: disc;
}

.login-page .btn-primary {
    background: #667eea !important;
    color: white !important;
}

.login-page .btn-primary:hover {
    background: #5a67d8 !important;
}

.login-page .login-box {
    background: white !important;
    color: #1a202c !important;
}

.login-page .login-header h1 {
    color: #1a202c !important;
}

.login-page .login-header p {
    color: #718096 !important;
}

.login-page .form-group label {
    color: #1a202c !important;
}

.login-page .form-group input {
    background: white !important;
    color: #1a202c !important;
    border-color: #e2e8f0 !important;
}

.login-page .login-footer p {
    color: #a0aec0 !important;
}

.login-page .alert-error {
    background: #fed7d7 !important;
    color: #742a2a !important;
    border: 1px solid #fc8181 !important;
}

.drag-handle svg {
    width: 16px;
    height: 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding: 20px;
    background: var(--surface-color);
    border-radius: 8px;
}

/* ========================================
   9. UTILITY CLASSES E OVERRIDE
   ======================================== */

/* Utility classes distribuite nel file per praticità d'uso */
#api-key-value {
    width: 100%;
}