/**
 * Admin Gestionale Sartoria - Custom Styles
 * Based on Bootstrap 5.3 with AdminLTE-inspired sidebar
 */

/* Variables */
:root {
    --primary-color: #0d6efd;
    --sidebar-bg: #1e1e2d;
    --sidebar-text: #a2a5b9;
    --sidebar-hover: #2d2d3f;
    --sidebar-active: #0d6efd;
    --body-bg: #f8f9fa;
    --card-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* Body */
body {
    background-color: var(--body-bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Wrapper */
.wrapper {
    min-height: 100vh;
    display: flex;
}

/* Sidebar */
.sidebar {
    width: 250px;
    min-height: 100vh;
    background-color: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.sidebar.collapsed {
    width: 0;
    overflow: hidden;
}

.sidebar-brand {
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    background-color: rgba(0, 0, 0, 0.1);
}

.sidebar-brand a {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 600;
    text-decoration: none;
}

.sidebar-brand .brand-icon {
    font-size: 1.5rem;
    margin-right: 0.5rem;
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-nav .nav-section {
    padding: 0.75rem 1rem 0.5rem;
    color: var(--sidebar-text);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

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

.sidebar-nav .nav-link.active {
    background-color: var(--sidebar-hover);
    color: #fff;
    border-left-color: var(--sidebar-active);
}

.sidebar-nav .nav-link i {
    width: 24px;
    margin-right: 0.75rem;
    font-size: 1rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 250px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.sidebar.collapsed + .main-content {
    margin-left: 0;
}

/* Navbar */
.main-navbar {
    height: 60px;
    background-color: #fff;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 999;
}

.main-navbar .navbar-toggle {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #6c757d;
    cursor: pointer;
    padding: 0.5rem;
    margin-right: 1rem;
}

.main-navbar .navbar-toggle:hover {
    color: var(--primary-color);
}

.main-navbar .nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
}

.main-navbar .user-dropdown .dropdown-toggle {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #333;
}

.main-navbar .user-dropdown .dropdown-toggle::after {
    margin-left: 0.5rem;
}

.main-navbar .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 0.5rem;
}

/* Page Content */
.content-wrapper {
    flex: 1;
    padding: 1.5rem;
}

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

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.page-header .breadcrumb {
    background: none;
    padding: 0;
    margin: 0;
}

/* Cards */
.card {
    border: none;
    box-shadow: var(--card-shadow);
    border-radius: 0.5rem;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
}

/* Stats Cards */
.stats-card {
    border-left: 4px solid var(--primary-color);
}

.stats-card.primary { border-left-color: #0d6efd; }
.stats-card.success { border-left-color: #198754; }
.stats-card.warning { border-left-color: #ffc107; }
.stats-card.danger { border-left-color: #dc3545; }
.stats-card.info { border-left-color: #0dcaf0; }

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

.stats-card.primary .stats-icon { background-color: rgba(13, 110, 253, 0.1); color: #0d6efd; }
.stats-card.success .stats-icon { background-color: rgba(25, 135, 84, 0.1); color: #198754; }
.stats-card.warning .stats-icon { background-color: rgba(255, 193, 7, 0.1); color: #ffc107; }
.stats-card.danger .stats-icon { background-color: rgba(220, 53, 69, 0.1); color: #dc3545; }
.stats-card.info .stats-icon { background-color: rgba(13, 202, 240, 0.1); color: #0dcaf0; }

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

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

/* DataTables Customization */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    margin: 0 2px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary-color) !important;
    color: #fff !important;
    border-color: var(--primary-color) !important;
}

/* Tables */
.table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: #6c757d;
}

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

/* Buttons */
.btn {
    font-weight: 500;
}

.btn-action {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

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

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

/* Toast Container */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
}

/* Footer */
.main-footer {
    padding: 1rem 1.5rem;
    background-color: #fff;
    border-top: 1px solid #dee2e6;
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: auto;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e1e2d 0%, #0d6efd 100%);
}

.login-box {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.login-card {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-card .card-body {
    padding: 2rem;
}

.login-logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        width: 0;
        overflow: hidden;
    }
    
    .sidebar.show {
        width: 250px;
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* Connection Alert */
.connection-alert {
    border-radius: 0;
    margin-bottom: 0;
}

/* Action Buttons Group */
.action-buttons {
    display: flex;
    gap: 0.25rem;
}

/* Modal Improvements */
.modal-header {
    border-bottom: 1px solid #dee2e6;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
}

/* Loading Overlay */
.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;
}

/* Status Badges */
.status-badge {
    font-size: 0.75rem;
    padding: 0.25em 0.5em;
}

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

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.quick-action-btn {
    flex: 1;
    min-width: 120px;
    padding: 1rem;
    text-align: center;
    border-radius: 0.5rem;
    text-decoration: none;
    color: #333;
    background: #fff;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
}

.quick-action-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.quick-action-btn i {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 0.5rem;
}
