/**
 * Stili custom - Tema Chiaro Professionale
 * Sistema Gestione Referti Medici
 */

:root {
    --primary-color: #0d6efd;
    --primary-dark: #0b5ed7;
    --sidebar-width: 260px;
    --navbar-height: 60px;
    --transition-speed: 0.3s;
}

/* Reset e base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f8f9fa;
    min-height: 100vh;
}

/* Navbar */
.navbar {
    height: var(--navbar-height);
    z-index: 1030;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.navbar-brand {
    font-size: 1.1rem;
}

/* Avatar circle */
.avatar-circle {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height));
    background: #fff;
    border-right: 1px solid #e9ecef;
    overflow-y: auto;
    transition: transform var(--transition-speed) ease;
    z-index: 1020;
}

.sidebar-content {
    padding: 1rem 0;
}

.sidebar-nav {
    padding: 0 0.75rem;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #6c757d;
    letter-spacing: 0.5px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 0.6rem 0.75rem;
    color: #495057;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.sidebar-nav .nav-link i {
    width: 24px;
    font-size: 1.1rem;
    margin-right: 0.75rem;
    text-align: center;
}

.sidebar-nav .nav-link:hover {
    background-color: #f1f3f4;
    color: var(--primary-color);
}

.sidebar-nav .nav-link.active {
    background-color: #e7f1ff;
    color: var(--primary-color);
    font-weight: 500;
}

/* Sidebar overlay mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1019;
}

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

/* Mobile responsiveness */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

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

    .main-content {
        margin-left: 0;
    }
}

/* Cards */
.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 1.25rem;
}

/* Stat cards */
.stat-card {
    padding: 1.25rem;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-label {
    color: #6c757d;
    font-size: 0.875rem;
}

/* Tables */
.table-container {
    background: #fff;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
    font-weight: 600;
    font-size: 0.875rem;
    color: #495057;
    padding: 0.875rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f3f4;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Category badge */
.category-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 500;
    background-color: #f1f3f4;
}

.category-badge i {
    margin-right: 0.4rem;
}

/* Expiry badges */
.badge-expiring {
    background-color: #fff3cd;
    color: #856404;
}

.badge-expired {
    background-color: #f8d7da;
    color: #721c24;
}

/* Upload area */
.upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 0.75rem;
    padding: 3rem;
    text-align: center;
    background: #fafbfc;
    transition: all 0.2s ease;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background: #f0f7ff;
}

.upload-area i {
    font-size: 3rem;
    color: #adb5bd;
    margin-bottom: 1rem;
}

.upload-area.dragover i {
    color: var(--primary-color);
}

.upload-area p {
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.upload-area .upload-hint {
    font-size: 0.875rem;
    color: #adb5bd;
}

/* PDF Preview */
.pdf-preview {
    width: 100%;
    height: 600px;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
}

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

.form-control,
.form-select {
    border-radius: 0.5rem;
    border: 1px solid #dee2e6;
    padding: 0.625rem 0.875rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

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

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

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

/* Login page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo i {
    font-size: 3rem;
    color: var(--primary-color);
}

.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #343a40;
    margin-top: 0.75rem;
}

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

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    color: #dee2e6;
    margin-bottom: 1rem;
}

.empty-state h5 {
    color: #495057;
    margin-bottom: 0.5rem;
}

/* Page header */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #343a40;
    margin-bottom: 0.25rem;
}

.page-header .breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
    font-size: 0.875rem;
}

/* Action buttons in table */
.btn-action {
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
}

/* Toast customization */
.toast {
    border-radius: 0.5rem;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

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

/* File info display */
.file-info {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
    margin-top: 1rem;
}

.file-info i {
    font-size: 2rem;
    color: #dc3545;
    margin-right: 1rem;
}

.file-info .file-name {
    font-weight: 500;
    color: #343a40;
}

.file-info .file-size {
    font-size: 0.875rem;
    color: #6c757d;
}

/* Tags input */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    background: #fff;
    min-height: 44px;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    background: #e7f1ff;
    color: var(--primary-color);
    border-radius: 1rem;
    font-size: 0.875rem;
}

.tag .remove-tag {
    margin-left: 0.5rem;
    cursor: pointer;
    opacity: 0.7;
}

.tag .remove-tag:hover {
    opacity: 1;
}

/* Pagination */
.pagination {
    margin-bottom: 0;
}

.page-link {
    border-radius: 0.375rem;
    margin: 0 0.125rem;
    color: #495057;
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* User management */
.user-card {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.user-avatar-lg {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
}

/* Modal */
.modal-content {
    border: none;
    border-radius: 0.75rem;
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    padding: 1.25rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
}

/* Loading spinner */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Progress bar for upload */
.upload-progress {
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: #e9ecef;
    margin-top: 1rem;
}

.upload-progress .progress-bar {
    transition: width 0.3s ease;
}
