/* Custom Styles for Gestione Bollette */

:root {
    --sidebar-width: 280px;
    --header-height: 60px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8f9fa;
}

/* Header */
.navbar {
    min-height: var(--header-height);
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
}

.sidebar .nav-link {
    font-weight: 500;
    color: #333;
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
}

.sidebar .nav-link:hover {
    color: #0d6efd;
    background-color: #e9ecef;
    border-radius: 0.25rem;
}

.sidebar .nav-link.active {
    color: #0d6efd;
    background-color: #e7f1ff;
    border-radius: 0.25rem;
}

.sidebar .nav-link i {
    font-size: 1.1rem;
}

.sidebar-heading {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
}

/* Main Content */
main {
    min-height: calc(100vh - var(--header-height));
}

.content-header {
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

/* Cards */
.stat-card {
    border-left: 4px solid #0d6efd;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.stat-card .card-title {
    font-size: 0.875rem;
    text-transform: uppercase;
    color: #6c757d;
    font-weight: 600;
    letter-spacing: 0.05rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #212529;
}

.stat-card.card-primary {
    border-left-color: #0d6efd;
}

.stat-card.card-success {
    border-left-color: #198754;
}

.stat-card.card-warning {
    border-left-color: #ffc107;
}

.stat-card.card-danger {
    border-left-color: #dc3545;
}

/* Tables */
.table-responsive {
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: #f8f9fa;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.05rem;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
}

.table tbody tr {
    transition: background-color 0.15s ease;
}

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

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

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
}

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

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

.input-group-text {
    background-color: #f8f9fa;
    font-weight: 500;
}

/* Charts */
.chart-container {
    position: relative;
    height: 300px;
    margin-bottom: 1rem;
}

.chart-container.large {
    height: 400px;
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Badges */
.badge-tipo {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
    font-weight: 600;
}

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

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

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

/* Filter Section */
.filter-section {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 1.5rem;
}

.filter-section .form-label {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

/* Export Section */
.export-preview {
    background-color: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
}

.export-preview.has-data {
    border-color: #198754;
    background-color: #d1e7dd;
}

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

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

/* Responsive */
@media (max-width: 767.98px) {
    .sidebar {
        position: relative;
        height: auto;
    }

    .stat-card {
        margin-bottom: 1rem;
    }

    .chart-container {
        height: 250px;
    }

    .table {
        font-size: 0.875rem;
    }

    .btn-action {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
    }
}

/* Utility Classes */
.text-euro {
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.cursor-pointer {
    cursor: pointer;
}

.border-start-primary {
    border-left: 4px solid #0d6efd !important;
}

.border-start-success {
    border-left: 4px solid #198754 !important;
}

.border-start-warning {
    border-left: 4px solid #ffc107 !important;
}

.border-start-danger {
    border-left: 4px solid #dc3545 !important;
}

/* Toast */
.toast-container {
    z-index: 10000;
}

.toast {
    min-width: 300px;
}

/* Modal */
.modal-backdrop.show {
    opacity: 0.7;
}

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

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

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

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

/* Casa Selector Styles */
.casa-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* Casa color picker buttons */
.casa-color-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    padding: 0;
    border: 2px solid transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.casa-color-btn:hover {
    transform: scale(1.1);
}

.btn-check:checked + .casa-color-btn {
    border-color: #212529;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

/* Tipo Utenza color picker buttons */
.tipo-color-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    padding: 0;
    border: 2px solid transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tipo-color-btn:hover {
    transform: scale(1.15);
}

.btn-check:checked + .tipo-color-btn {
    border-color: #212529;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.15);
    transform: scale(1.1);
}

/* Tipo Utenza color dot */
.tipo-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* Casa selector dropdown */
#casaSelectorBtn {
    text-align: left;
}

#casaDropdownMenu .dropdown-item {
    padding: 0.5rem 1rem;
}

#casaDropdownMenu .dropdown-item.active {
    background-color: #e7f1ff;
    color: #0d6efd;
}

#casaDropdownMenu .dropdown-item:hover:not(.active) {
    background-color: #f8f9fa;
}

/* Sidebar accent with casa color */
.sidebar {
    border-left: 4px solid var(--casa-color, #0d6efd);
}

/* Casa cards */
.card.border-primary {
    border-width: 2px !important;
}

/* Print Styles */
@media print {
    .sidebar,
    .navbar,
    .btn,
    .filter-section {
        display: none !important;
    }

    main {
        margin: 0 !important;
        padding: 0 !important;
    }

    .table {
        font-size: 10pt;
    }
}
