/* Custom styles for RADIUS Panel */

:root {
    --primary-color: #4f46e5;
    --primary-light: #6366f1;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    --light-color: #f8fafc;
    --navbar-color: #ffffff;
    --navbar-border: #e5e7eb;
    --dark-color: #374151;
    --sidebar-width: 250px;
    --navbar-height: 60px;
}

/* Body and layout */
body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-color);
    color: #334155;
}

/* Login page styles */
.login-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-wrapper .card {
    border: none;
    border-radius: 15px;
}

/* Navigation */
.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--navbar-height);
    bottom: 0;
    left: 0;
    z-index: 100;
    padding: 0;
    background-color: #ffffff;
    border-right: 1px solid #e2e8f0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    min-height: calc(100vh - var(--navbar-height));
    width: var(--sidebar-width);
}

.sidebar-sticky {
    position: relative;
    top: 0;
    height: calc(100vh - 56px);
    padding-top: 0.5rem;
    overflow-x: hidden;
    overflow-y: auto;
}

.sidebar .nav-link {
    color: #64748b;
    padding: 0.875rem 1.25rem;
    border-radius: 8px;
    margin: 0.25rem 0.75rem;
    transition: all 0.2s ease;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.sidebar .nav-link:hover {
    background-color: #f1f5f9;
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    transform: translateX(2px);
}

.sidebar .nav-link.active {
    background-color: #eff6ff;
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.sidebar-link {
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    border-left-color: var(--primary-color);
}

/* Main content */
.main-content {
    margin-top: var(--navbar-height);
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-height: calc(100vh - var(--navbar-height));
}

@media (max-width: 991.98px) {
    .main-content {
        margin-left: 0;
    }
}

/* Cards */
.card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    background-color: #ffffff;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.card-header {
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 12px 12px 0 0;
    font-weight: 600;
    color: var(--dark-color);
    padding: 1rem 1.5rem;
}

/* Dashboard cards with colored accents */
.border-left-primary {
    border-left: 4px solid var(--primary-color) !important;
    background: linear-gradient(135deg, #ffffff 0%, #f0f7ff 100%);
}

.border-left-success {
    border-left: 4px solid var(--success-color) !important;
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
}

.border-left-info {
    border-left: 4px solid var(--info-color) !important;
    background: linear-gradient(135deg, #ffffff 0%, #f0fdfa 100%);
}

.border-left-warning {
    border-left: 4px solid var(--warning-color) !important;
    background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
}

/* Tables */
.table th {
    border-top: none;
    font-weight: 600;
    color: #6b7280;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: #f9fafb;
}

.table-hover tbody tr:hover {
    background-color: rgba(79, 70, 229, .05);
}

.table tbody tr {
    border-bottom: 1px solid #f3f4f6;
    background-color: #ffffff !important;
    color: #374151 !important;
}

.table tbody tr:nth-child(even) {
    background-color: #f8fafc !important;
    color: #374151 !important;
}

/* FORZA RIMOZIONE COMPLETA DI TUTTI I COLORI SCURI */
table tbody tr,
table.table tbody tr,
.table tbody tr,
table tbody tr[class*="dark"],
table tbody tr[class*="bg-"],
.table tbody tr[class*="dark"],
.table tbody tr[class*="bg-"],
.table-hover tbody tr,
.table-striped tbody tr,
.table tbody tr:hover,
.table tbody tr:focus,
.table tbody tr:active {
    background-color: #ffffff !important;
    background: #ffffff !important;
    color: #374151 !important;
}

/* Righe alternate con colore molto chiaro */
table tbody tr:nth-child(even),
table.table tbody tr:nth-child(even),
.table tbody tr:nth-child(even),
.table tbody tr:nth-child(even):hover,
.table tbody tr:nth-child(even):focus,
.table tbody tr:nth-child(even):active {
    background-color: #f8fafc !important;
    background: #f8fafc !important;
    color: #374151 !important;
}

/* Sovrascrive TUTTE le possibili classi scure Bootstrap */
.table-dark,
.table tbody tr.table-dark,
.bg-dark,
.table tbody tr.bg-dark,
.table-dark tbody tr,
.bg-dark tbody tr,
tbody tr.table-dark,
tbody tr.bg-dark,
tr.table-dark,
tr.bg-dark {
    background-color: #ffffff !important;
    background: #ffffff !important;
    color: #374151 !important;
}

/* Forza colori chiari per tutti gli elementi nelle celle */
.table tbody tr * ,
.table tbody tr td,
.table tbody tr th,
table tbody tr *,
table tbody tr td,
table tbody tr th {
    color: #374151 !important;
    background: transparent !important;
}

/* CSS più aggressivo per sovrasccrivere qualsiasi stile inline o classe */
[class*="table"] tbody tr,
div[class*="table"] tbody tr,
.card [class*="table"] tbody tr,
.card-body [class*="table"] tbody tr {
    background-color: #ffffff !important;
    background: #ffffff !important;
    color: #374151 !important;
}

/* Forza stili con specificity massima */
.card .table-responsive .table tbody tr {
    background-color: #ffffff !important;
    background: #ffffff !important;
    color: #374151 !important;
}

.card .table-responsive .table tbody tr:nth-child(even) {
    background-color: #f8fafc !important;
    background: #f8fafc !important;
    color: #374151 !important;
}

.table-light {
    background-color: #f8fafc;
}

/* Righe con colori chiari e delicati */
.table tbody tr.table-light-alternate {
    background-color: #f1f5f9 !important;
    color: #374151;
}

.table tbody tr.table-light-alternate:hover {
    background-color: #e2e8f0 !important;
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    padding: 0.625rem 1.25rem;
}

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

.btn-primary:hover {
    background-color: #1e40af;
    border-color: #1e40af;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(30, 58, 138, 0.3);
}

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

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

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

/* Forms */
.form-control, .form-select {
    border-radius: 0.375rem;
    border: 1px solid #ced4da;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

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

.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

/* Alerts */
.alert {
    border-radius: 0.5rem;
    border: none;
}

.alert-container {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 1050;
    max-width: 400px;
}

/* Badges */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
}

.bg-success {
    background-color: var(--success-color) !important;
}

.bg-danger {
    background-color: var(--danger-color) !important;
}

.bg-warning {
    background-color: var(--warning-color) !important;
}

.bg-info {
    background-color: var(--info-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.bg-secondary {
    background-color: #9ca3af !important;
}

/* Status indicators */
.status-active {
    color: var(--success-color);
}

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

.status-expired {
    color: var(--warning-color);
}

/* Custom utilities */
.text-xs {
    font-size: 0.75rem;
}

.font-weight-bold {
    font-weight: 700 !important;
}

.text-gray-800 {
    color: #5a5c69 !important;
}

/* Animation for loading states */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        top: var(--navbar-height);
        left: -100%;
        transition: left 0.3s ease;
        z-index: 1000;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
        padding: 1.5rem 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .table-responsive {
        border: none;
    }
    
    .btn-group-sm .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
}

/* Print styles */
@media print {
    .navbar, .sidebar, .btn, .alert-container {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        margin-top: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }
}

/* Dark mode support (future enhancement) */
@media (prefers-color-scheme: dark) {
    :root {
        --bs-body-bg: #1a1d23;
        --bs-body-color: #e9ecef;
    }
}

/* Custom scrollbar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Focus indicators for accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Loading spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Custom checkbox and radio styles */
.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* File input styling */
.form-control[type="file"] {
    padding: 0.375rem 0.75rem;
}

/* Progress bars */
.progress {
    height: 0.5rem;
    border-radius: 0.25rem;
}

/* Tooltips and popovers */
.tooltip-inner {
    font-size: 0.875rem;
}

/* Custom spacing */
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }
.gap-5 { gap: 3rem !important; }

/* FORZA FINALE - RIMOZIONE ASSOLUTA DI TUTTI I COLORI SCURI NELLE TABELLE */
/* Questa sezione deve essere sempre alla fine per la massima priorità */

* table tbody tr,
* .table tbody tr,
* [class*="table"] tbody tr {
    background-color: #ffffff !important;
    background: #ffffff !important;
    color: #374151 !important;
}

* table tbody tr:nth-child(even),
* .table tbody tr:nth-child(even),
* [class*="table"] tbody tr:nth-child(even) {
    background-color: #f8fafc !important;
    background: #f8fafc !important;
    color: #374151 !important;
}

/* Sovrascrive con selettore universale ogni possibile stile scuro */
* tbody tr[style*="background"],
* tbody tr[class*="dark"],
* tbody tr[class*="bg-"],
*.table tbody tr[style*="background"],
*.table tbody tr[class*="dark"],
*.table tbody tr[class*="bg-"] {
    background-color: #ffffff !important;
    background: #ffffff !important;
    color: #374151 !important;
}

/* Selettore CSS finale con massima specificità per utenti.html */
html body main .main-content .card .card-body .table-responsive .table tbody tr {
    background-color: #ffffff !important;
    background: #ffffff !important;
    color: #374151 !important;
}

html body main .main-content .card .card-body .table-responsive .table tbody tr:nth-child(even) {
    background-color: #f8fafc !important;
    background: #f8fafc !important;
    color: #374151 !important;
}
