/* StudioCensea Backend Styles */

/* ===== UNIFORMAZIONE STILI ===== */

/* Header delle pagine standardizzato */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: #495057;
    margin: 0;
}

.page-header h1 i {
    margin-right: 0.5rem;
    color: #6c757d;
}

/* Pulsanti standardizzati */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.15s ease-in-out;
}

.btn i {
    margin-right: 0.375rem;
}

.btn-group .btn {
    margin-right: 0.25rem;
}

.btn-group .btn:last-child {
    margin-right: 0;
}

/* Card standardizzate - Manteniamo solo personalizzazioni non invasive */
.card {
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

/* IMPORTANTE: Forziamo gli stili AdminLTE con !important per override site.css */

/* Supporto per elevation di AdminLTE - DEVE sovrascrivere tutto */
.elevation-1 {
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24) !important;
}

.elevation-2 {
    box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23) !important;
}

.elevation-3 {
    box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23) !important;
}

.elevation-4 {
    box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22) !important;
}

.elevation-5 {
    box-shadow: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22) !important;
}

/* Supporto per card-outline di AdminLTE con !important */
.card-outline {
    border-top: 3px solid #dee2e6 !important;
}

.card-primary.card-outline {
    border-top-color: #007bff !important;
}

.card-secondary.card-outline {
    border-top-color: #6c757d !important;
}

.card-success.card-outline {
    border-top-color: #28a745 !important;
}

.card-info.card-outline {
    border-top-color: #17a2b8 !important;
}

.card-warning.card-outline {
    border-top-color: #ffc107 !important;
}

.card-danger.card-outline {
    border-top-color: #dc3545 !important;
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    padding: 0.75rem 1.25rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #495057;
    margin: 0;
}

.card-title i {
    margin-right: 0.5rem;
    color: #6c757d;
}

/* Tabelle standardizzate */
.table th {
    background-color: #f8f9fa;
    border-top: none;
    font-weight: 600;
    color: #495057;
    font-size: 0.875rem;
}

.table-responsive {
    border-radius: 0.375rem;
}

/* Badge standardizzati */
.badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
}

/* Filtri standardizzati */
.filters-section {
    margin-bottom: 1.5rem;
}

.filters-section .card-body {
    background-color: #f8f9fa;
}

/* Spazio uniforme */
.mb-4 {
    margin-bottom: 1.5rem !important;
}

/* Layout responsive standardizzato */
@media (max-width: 768px) {
    .page-header .d-flex {
        flex-direction: column;
        align-items: stretch !important;
    }
    
    .page-header h1 {
        margin-bottom: 1rem;
        text-align: center;
        font-size: 1.5rem;
    }
    
    .btn-group {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
    }
    
    .btn-group .btn {
        margin: 0.125rem;
        min-width: 120px;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .filters-section .form-inline {
        flex-direction: column;
    }
    
    .filters-section .form-group {
        margin-bottom: 0.5rem;
        width: 100%;
    }
    
    .filters-section .form-control {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .page-header h1 {
        font-size: 1.25rem;
    }
    
    .btn-sm {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }
    
    .card-header {
        padding: 0.5rem 0.75rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
}

.brand-image {
    width: 33px;
    height: 33px;
}

/* Logo Styling */
.brand-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.5rem;
    transition: width 0.3s ease-in-out;
    overflow: hidden;
    white-space: nowrap;
    height: auto;
    min-height: 4.5rem;
}

.brand-image-expanded {
    max-width: calc(80% - 1rem) !important;
    max-height: 57px !important;
    width: auto !important;
    height: auto !important;
    display: block;
    margin: 0 auto;
    object-fit: contain;
}

.brand-image-collapsed {
    max-height: 32px !important;
    max-width: 32px !important;
    width: auto !important;
    height: auto !important;
    display: block;
    margin: 0 auto;
    object-fit: contain;
}

/* Centra il logo quando la sidebar è collassata */
.sidebar-collapse .brand-link {
    padding: 1rem 0.5rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 4.5rem; /* Allinea con l'altezza del brand-link */
}

/* Nasconde completamente l'immagine non utilizzata per evitare sovrapposizioni */
.sidebar-collapse .brand-image-expanded {
    display: none !important;
}

.sidebar-collapse .brand-image-collapsed {
    display: block !important;
}

/* Stili per i sottomenu */
.nav-treeview {
    padding-left: 1rem; /* Indentazione dei sottomenu */
}

.nav-treeview .nav-link {
    padding-left: 2rem; /* Padding aggiuntivo per i link dei sottomenu */
    font-size: 0.9rem; /* Font leggermente più piccolo */
}

.nav-treeview .nav-icon {
    font-size: 0.8rem; /* Icone più piccole per i sottomenu */
}

.brand-text {
    font-weight: 300 !important;
}

/* Dashboard cards */
.small-box {
    border-radius: 0.375rem;
}

/* Fix per le icone delle small-box che si spostano */
.small-box {
    position: relative !important;
    overflow: hidden !important;
}

.small-box .icon {
    transition: opacity 0.3s ease !important;
    color: rgba(0, 0, 0, 0.15) !important;
    z-index: 0 !important;
}

/* Fix icon positioning - keep AdminLTE defaults but with controlled animation */
.small-box .icon > i,
.small-box .icon > i.fa,
.small-box .icon > i.fas,
.small-box .icon > i.far,
.small-box .icon > i.fab,
.small-box .icon > i.fal,
.small-box .icon > i.fad,
.small-box .icon > i.ion {
    position: absolute !important;
    right: 15px !important;
    top: 20px !important;
    font-size: 70px !important;
    transition: transform 0.3s ease !important;
    transform-origin: center center !important;
}

/* CRITICAL: Override AdminLTE hover with controlled scale */
.small-box:hover .icon > i,
.small-box:hover .icon > i.fa,
.small-box:hover .icon > i.fas,
.small-box:hover .icon > i.far,
.small-box:hover .icon > i.fab,
.small-box:hover .icon > i.fal,
.small-box:hover .icon > i.fad,
.small-box:hover .icon > i.ion,
.small-box:hover .icon > svg {
    /* Subtle scale with rotation for elegant effect */
    transform: scale(1.05) rotate(3deg) !important;
    -webkit-transform: scale(1.05) rotate(3deg) !important;
    color: rgba(0, 0, 0, 0.2) !important;
}

.small-box .inner {
    position: relative !important;
    z-index: 1 !important;
}

/* Grid improvements */
.table th {
    border-top: none;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-responsive {
    border-radius: 0.375rem;
}

/* Cards */
.card {
    box-shadow: 0 0 1px rgba(0,0,0,.125), 0 1px 3px rgba(0,0,0,.2);
    border: none;
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid rgba(0,0,0,.125);
    padding: 0.75rem 1.25rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

/* Buttons */
.btn {
    border-radius: 0.25rem;
    font-weight: 500;
}

.btn-group-sm > .btn, .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Application buttons - AdminLTE style */
.btn-app {
    border-radius: 3px;
    position: relative;
    padding: 15px 5px;
    margin: 0 0 10px 10px;
    min-width: 80px;
    height: 60px;
    text-align: center;
    color: #666;
    border: 1px solid #ddd;
    background-color: #f4f4f4;
    display: inline-block;
    transition: all 0.3s ease;
}

.btn-app:hover {
    background: #f0f0f0;
    color: #444;
    border-color: #aaa;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-app > i {
    font-size: 20px;
    display: block;
    margin-bottom: 5px;
}

.btn-app.bg-primary {
    color: #fff !important;
    background-color: #007bff !important;
    border-color: #007bff;
}

.btn-app.bg-success {
    color: #fff !important;
    background-color: #28a745 !important;
    border-color: #28a745;
}

.btn-app.bg-warning {
    color: #212529 !important;
    background-color: #ffc107 !important;
    border-color: #ffc107;
}

.btn-app.bg-danger {
    color: #fff !important;
    background-color: #dc3545 !important;
    border-color: #dc3545;
}

.btn-app.bg-info {
    color: #fff !important;
    background-color: #17a2b8 !important;
    border-color: #17a2b8;
}

.btn-app.bg-secondary {
    color: #fff !important;
    background-color: #6c757d !important;
    border-color: #6c757d;
}

.btn-app.bg-primary:hover {
    background-color: #0056b3 !important;
    border-color: #0056b3;
}

.btn-app.bg-success:hover {
    background-color: #218838 !important;
    border-color: #1e7e34;
}

.btn-app.bg-warning:hover {
    background-color: #e0a800 !important;
    border-color: #d39e00;
}

.btn-app.bg-danger:hover {
    background-color: #c82333 !important;
    border-color: #bd2130;
}

.btn-app.bg-info:hover {
    background-color: #138496 !important;
    border-color: #117a8b;
}

.btn-app.bg-secondary:hover {
    background-color: #5a6268 !important;
    border-color: #545b62;
}

/* Forms */
.form-control {
    border-radius: 0.25rem;
}

.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* File input styling */
.form-control-file {
    padding: 0.375rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    background-color: #fff;
}

/* Alerts */
.alert {
    border: none;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* Sidebar */
.main-sidebar {
    box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
}

.nav-sidebar .nav-link {
    border-radius: 0.25rem;
    margin: 0.1rem 0.5rem;
}

.nav-sidebar .nav-link.active {
    background-color: #007bff !important;
    color: white !important;
}

/* Content wrapper */
.content-wrapper {
    background-color: #f8f9fa;
}

.content-header {
    padding: 15px 0;
}

.content-header h1 {
    font-size: 1.8rem;
    font-weight: 400;
    margin: 0;
}

/* Breadcrumbs */
.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "/";
    color: #6c757d;
}

/* Status badges */
.badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.375rem 0.5rem;
}

/* Login page */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    margin: 7% auto;
}

.login-logo {
    font-size: 2.1rem;
    font-weight: 300;
    margin-bottom: 0.9rem;
    text-align: center;
    color: white;
}

.login-card-body {
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 20px;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .content-header h1 {
        font-size: 1.5rem;
    }
    
    .small-box .inner h3 {
        font-size: 2rem;
    }
    
    .card-tools .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }
}

/* Custom animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 40px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.card {
    animation: fadeInUp 0.5s ease-out;
}

/* Loading states */
.btn:disabled {
    cursor: not-allowed;
}

.table-loading {
    position: relative;
}

.table-loading::after {
    content: "Caricamento...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255,255,255,0.9);
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: 500;
}

/* ===== EMAIL SYSTEM - TABLER-LIKE STYLES ===== */

/* Ghost buttons */
.btn-ghost-secondary { background:transparent; border:none; color:#64748b; padding:0.35rem 0.75rem; border-radius:0.375rem; transition:all 0.15s; }
.btn-ghost-secondary:hover { background:#e2e8f0; color:#1e293b; }
.btn-ghost-primary { background:transparent; border:none; color:#007bff; padding:0.35rem 0.75rem; border-radius:0.375rem; transition:all 0.15s; }
.btn-ghost-primary:hover { background:#dbeafe; color:#0056b3; }
.btn-ghost-success { background:transparent; border:none; color:#28a745; padding:0.35rem 0.75rem; border-radius:0.375rem; transition:all 0.15s; }
.btn-ghost-success:hover { background:#d1f4e0; color:#1e7e34; }
.btn-ghost-danger { background:transparent; border:none; color:#dc3545; padding:0.35rem 0.75rem; border-radius:0.375rem; transition:all 0.15s; }
.btn-ghost-danger:hover { background:#fee2e2; color:#c82333; }
.btn-ghost-warning { background:transparent; border:none; color:#d39e00; padding:0.35rem 0.75rem; border-radius:0.375rem; transition:all 0.15s; }
.btn-ghost-warning:hover { background:#fef3c7; color:#b54708; }

/* Avatar (Tabler-like) */
.avatar { width:2.5rem; height:2.5rem; border-radius:0.5rem; display:inline-flex; align-items:center; justify-content:center; font-weight:600; font-size:0.875rem; flex-shrink:0; }
.avatar-sm { width:2rem; height:2rem; font-size:0.75rem; border-radius:0.375rem; }
.avatar-md { width:2.5rem; height:2.5rem; }
.bg-blue-lt { background:#dbeafe; color:#2563eb; }
.bg-red-lt { background:#fee2e2; color:#dc2626; }
.bg-green-lt { background:#d1f4e0; color:#15803d; }
.bg-orange-lt { background:#ffedd5; color:#c2410c; }
.bg-azure-lt { background:#d1ecf8; color:#0c63a4; }
.bg-secondary-lt { background:#e2e8f0; color:#475569; }
.bg-warning-lt { background:#fef0c7; color:#b54708; }

/* Badge light variants */
.badge.bg-primary { background-color:#007bff !important; }
.badge-sm { font-size:0.6875rem; padding:0.2em 0.5em; }

/* Datagrid (Tabler-like detail grid) */
.datagrid { display:grid; grid-template-columns:repeat(auto-fill, minmax(200px, 1fr)); gap:0.75rem; }
.datagrid-item {}
.datagrid-title { font-size:0.6875rem; text-transform:uppercase; letter-spacing:0.04em; color:#64748b; margin-bottom:0.15rem; font-weight:600; }
.datagrid-content { font-size:0.8125rem; color:#1e293b; }

/* Vertical rule */
.vr { display:inline-block; width:1px; height:1.5rem; background:#dee2e6; vertical-align:middle; }

/* Input icon wrapper */
.input-icon { position:relative; }
.input-icon .input-icon-addon { position:absolute; left:0.75rem; top:50%; transform:translateY(-50%); color:#94a3b8; z-index:2; pointer-events:none; }
.input-icon input { padding-left:2.25rem; }

/* Mail sidebar clean */
.mail-sidebar .nav-link { padding:0.5rem 0.75rem; border-radius:0.375rem; color:#495057; font-weight:500; font-size:0.8125rem; display:flex; align-items:center; transition:all 0.15s; margin-bottom:2px; }
.mail-sidebar .nav-link:hover { background:#e9ecef; color:#212529; }
.mail-sidebar .nav-link.active { background:#007bff; color:#fff; }
.mail-sidebar .nav-link.active .badge { background:rgba(255,255,255,0.2) !important; color:#fff !important; }
.mail-sidebar .nav-link i { width:1.25rem; text-align:center; margin-right:0.5rem; font-size:0.875rem; }

/* Mail table clean */
.mail-table { table-layout:fixed; margin:0; }
.mail-table td { vertical-align:middle; padding:0.5rem; border-bottom:1px solid #f1f5f9; font-size:0.8125rem; }
.mail-table tr:hover { background:#f8f9fa; }
.mail-table tr.unread { background:#f0f6ff; font-weight:600; }
.mail-table tr.unread:hover { background:#e8f1fc; }
.mail-table a.mail-link { color:#212529; text-decoration:none; }
.mail-table a.mail-link:hover { color:#007bff; }

/* Star/flag button */
.star-btn { color:#cbd5e1; transition:color 0.15s; text-decoration:none; }
.star-btn:hover { color:#f59e0b; text-decoration:none; }
.star-btn.active { color:#f59e0b; }

/* Account list items */
.account-item { display:flex; align-items:center; padding:0.5rem 0.75rem; border-bottom:1px solid #f1f5f9; color:#495057; text-decoration:none; font-size:0.8125rem; transition:background 0.1s; }
.account-item:hover { background:#f8f9fa; color:#212529; text-decoration:none; }
.account-item.active { background:#eff6ff; color:#007bff; }
.account-dot { width:8px; height:8px; border-radius:50%; display:inline-block; margin-right:0.5rem; flex-shrink:0; }

/* Sidebar action list */
.action-list .list-group-item { padding:0.5rem 0.75rem; font-size:0.8125rem; border:none; border-bottom:1px solid #f1f5f9; }
.action-list .list-group-item:hover { background:#f8f9fa; }
.action-list .list-group-item i { width:1.25rem; text-align:center; }

/* Attachment item */
.attachment-item { display:flex; align-items:center; padding:0.5rem; border:1px solid #dee2e6; border-radius:0.375rem; transition:border-color 0.15s; }
.attachment-item:hover { border-color:#94a3b8; }

/* Dropzone */
.dropzone-area { border:2px dashed #cbd5e1; border-radius:0.5rem; padding:1.5rem; text-align:center; cursor:pointer; transition:border-color 0.2s, background 0.2s; background:#fafbfc; }
.dropzone-area:hover { border-color:#007bff; background:#f0f6ff; }

/* ===== STILI EMAIL PLAIN TEXT ===== */
/* Uniforma la visualizzazione delle email plain text con il resto del sistema */
.email-plain-text,
.message-body-text,
pre.email-content {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif !important;
    font-size: 14px;
    line-height: 1.6;
    color: #212529;
    white-space: pre-wrap;
    word-wrap: break-word;
    background: none;
    border: none;
    margin: 0;
    padding: 0;
}

/* Rimuove font monospace da tutti i pre nelle email */
.email-view pre,
.message-view pre,
.card-body pre {
    font-family: inherit !important;
}