/* 
 * Blutech Work Management - Stili personalizzati
 * Bootstrap 5 custom styles
 */

:root {
    --blutech-primary: #0d6efd;
    --blutech-secondary: #6c757d;
    --blutech-success: #198754;
    --blutech-info: #0dcaf0;
    --blutech-warning: #ffc107;
    --blutech-danger: #dc3545;
    --blutech-light: #f8f9fa;
    --blutech-dark: #212529;
}

/* Layout generale */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.3rem;
}

/* Cards personalizzate */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    font-weight: 600;
}

/* Form styling */
.form-control:focus,
.form-select:focus {
    border-color: var(--blutech-primary);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Date input italiana personalizzato */
#data_lavoro {
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

#calendar-btn {
    border-left: 0;
    color: var(--blutech-primary);
    transition: all 0.2s ease;
}

#calendar-btn:hover {
    background-color: var(--blutech-primary);
    color: white;
    border-color: var(--blutech-primary);
}

#calendar-btn:active, #calendar-btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Date picker nascosto - compatibile mobile */
.date-picker-hidden {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
    z-index: -1;
    border: none;
    background: transparent;
}

/* Media query per mobile */
@media (max-width: 768px) {
    #calendar-btn {
        padding: 0.5rem;
        font-size: 1.1rem;
        background-color: #e7f1ff;
        border-color: #0d6efd;
        color: #0d6efd;
    }
    
    #calendar-btn:hover, #calendar-btn:active {
        background-color: #0d6efd;
        color: white;
        border-color: #0d6efd;
    }
    
    /* Su mobile, il date picker può essere temporaneamente visibile */
    .date-picker-hidden[style*="opacity: 0.01"] {
        pointer-events: auto !important;
        z-index: 9999 !important;
        border: 1px solid transparent !important;
        outline: none !important;
    }
    
    /* Forza la visibilità su mobile quando necessario */
    @supports (-webkit-touch-callout: none) {
        .date-picker-hidden[style*="opacity: 0.01"] {
            opacity: 1 !important;
            background: rgba(255, 255, 255, 0.9) !important;
            border: 2px solid #0d6efd !important;
            border-radius: 4px !important;
        }
    }
    
    /* Miglioramento visual del pulsante calendario su mobile */
    .input-group #calendar-btn {
        border-left: 1px solid #ced4da;
        transition: all 0.3s ease;
    }
    
    /* Animazione del pulsante quando premuto */
    #calendar-btn:active {
        transform: scale(0.95);
    }
}

/* Time select dropdown */
#ora_inizio, #ora_fine {
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
}

#ora_inizio:focus, #ora_fine:focus {
    border-color: var(--blutech-primary);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Display ore totali */
#ore_display {
    background-color: #e3f2fd;
    border-color: #1976d2;
    color: #0d47a1;
    border-left: 4px solid var(--blutech-primary);
    margin-top: 1rem;
}

#ore_display i {
    color: var(--blutech-primary);
}

#ore_totali {
    color: var(--blutech-primary);
    font-weight: 700;
    font-size: 1.1rem;
}

/* Cliente search dropdown */
#cliente_search {
    position: relative;
}

#cliente_dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1050;
    margin-top: 2px;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background-color: #fff;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

#cliente_dropdown.show {
    display: block;
}

#cliente_dropdown:not(.show) {
    display: none;
}

.cliente-option {
    padding: 0.75rem 1rem;
    color: #212529;
    text-decoration: none;
    display: block;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.15s ease-in-out;
}

.cliente-option:hover {
    background-color: #f8f9fa;
    color: #212529;
}

.cliente-option:last-child {
    border-bottom: none;
}

.cliente-option strong {
    font-weight: 600;
    color: var(--blutech-primary);
}

.cliente-option small {
    font-size: 0.875rem;
}

/* Validazione cliente */
#cliente_search.is-invalid {
    border-color: var(--blutech-danger);
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Stili per i due campi data affiancati */
.date-inputs-row .col-8 input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.date-inputs-row .col-4 input {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: 0;
}

/* Validazione data */
input.date-invalid {
    border-color: var(--blutech-danger) !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

input.date-valid {
    border-color: var(--blutech-success) !important;
    box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.25) !important;
}

.btn {
    border-radius: 0.375rem;
    font-weight: 500;
}

.btn-primary {
    background-color: var(--blutech-primary);
    border-color: var(--blutech-primary);
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

/* Badges personalizzati */
.badge {
    font-size: 0.75em;
    font-weight: 500;
}

/* Tabelle */
.table {
    margin-bottom: 0;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.table thead th {
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Progress bars */
.progress {
    height: 1rem;
    border-radius: 0.375rem;
}

/* Alerts */
.alert {
    border: none;
    border-radius: 0.5rem;
}

.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: #cff4fc;
    color: #055160;
}

/* Dashboard cards specifiche */
.dashboard-stat-card {
    transition: transform 0.2s;
}

.dashboard-stat-card:hover {
    transform: translateY(-2px);
}

/* Form di inserimento attività */
.activity-form {
    background: #fff;
    border-radius: 0.5rem;
    padding: 1.5rem;
}

/* Lista attività */
.activity-item {
    border-left: 4px solid var(--blutech-primary);
    transition: all 0.2s ease;
}

.activity-item:hover {
    border-left-color: var(--blutech-success);
    background-color: #f8f9fa !important;
}

/* Calendar styling */
.calendar-table {
    font-size: 0.9rem;
}

.calendar-cell {
    height: 120px;
    vertical-align: top;
    padding: 8px;
    border: 1px solid #dee2e6;
}

.calendar-cell:hover {
    background-color: #f8f9fa;
}

/* Modal personalizzazioni */
.modal-header {
    border-bottom: 1px solid #dee2e6;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
}

/* Navigation attiva */
.navbar-nav .nav-link.active {
    font-weight: 600;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 0.375rem;
}

/* Statistiche cards */
.stats-card {
    text-align: center;
    padding: 1.5rem;
    border-radius: 0.5rem;
    color: white;
}

.stats-card h3 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stats-card small {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Client management */
.client-card {
    border-left: 4px solid var(--blutech-info);
}

.client-card.inactive {
    border-left-color: var(--blutech-secondary);
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-stat-card {
        margin-bottom: 1rem;
    }
    
    .table-responsive {
        font-size: 0.9rem;
    }
    
    .btn {
        font-size: 0.9rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Spaziatura verticale migliorata per mobile */
    .card {
        margin-bottom: 1.5rem !important;
    }
    
    .row > [class*="col-"] {
        margin-bottom: 1rem;
    }
    
    .row > [class*="col-"]:last-child {
        margin-bottom: 0;
    }
    
    /* Spaziatura extra per le statistiche */
    .stats-card {
        margin-bottom: 1rem;
    }
    
    /* Form spacing */
    .mb-3 {
        margin-bottom: 1.5rem !important;
    }
    
    /* Activity items spacing */
    .activity-item {
        margin-bottom: 1rem !important;
    }
    
    /* Calendar cells spacing */
    .calendar-cell {
        min-height: 100px;
        padding: 0.5rem;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .card-header h5 {
        font-size: 1rem;
    }
    
    .stats-card h3 {
        font-size: 2rem;
    }
    
    .btn-group .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
    
    /* Spaziatura extra per schermi molto piccoli */
    .card {
        margin-bottom: 2rem !important;
    }
    
    .container-fluid, .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Padding interno ridotto ma spaziatura esterna aumentata */
    .card-body {
        padding: 0.75rem;
    }
    
    /* Spacing tra sezioni */
    .row {
        margin-bottom: 1rem;
    }
    
    /* Modal spacing su mobile */
    .modal-body {
        padding: 1rem;
    }
    
    /* Users management cards */
    .user-card {
        margin-bottom: 1.5rem !important;
    }
}

/* Loading spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner-border-custom {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

/* Utility classes */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.shadow-hover {
    transition: box-shadow 0.15s ease-in-out;
}

.shadow-hover:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Footer */
footer {
    margin-top: auto;
    border-top: 1px solid #dee2e6;
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    .modal,
    footer {
        display: none !important;
    }
    
    .card {
        border: 1px solid #dee2e6 !important;
        box-shadow: none !important;
    }
    
    .table {
        font-size: 0.8rem;
    }
}

/* Dark mode support (future implementation) */
@media (prefers-color-scheme: dark) {
    :root {
        --bs-body-bg: #212529;
        --bs-body-color: #fff;
    }
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}