/* 
 * FreedHomaPay Dashboard - CSS Standardizzato
 * Template base per tutto il progetto
 */

:root {
    --primary-color: #243a33;
    --secondary-color: #34495e;
    --accent-color: #4eb857;
    --success-color: #2ecc71;
    --warning-color: #f1c40f;
    --danger-color: #e74c3c;
    --info-color: #3498db;
    --logo-green: #4eb857;
    --logo-dark: #243a33;
    --light-bg: #f8f9fa;
    --card-shadow: 0 2px 4px rgba(0,0,0,0.05);
    --card-shadow-hover: 0 4px 8px rgba(0,0,0,0.1);
}

/* ======================
   LAYOUT GENERALE
   ====================== */

body { 
    font-family: 'Segoe UI', Arial, sans-serif;
    background:  var(--light-bg);
    line-height: 1.6;
    color: #333;
}

/* ======================
   CARDS E CONTENITORI
   ====================== */

.card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
    background: white;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--card-shadow-hover);
}

.card-header {
    background: white;
    border-bottom: 2px solid var(--accent-color);
    padding: 1.5rem;
    border-radius: 12px 12px 0 0 !important;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* ======================
   STATISTICHE E METRICHE
   ====================== */

/* Stats grid - Responsive per desktop, normale su mobile */
@media (min-width: 769px) {
    .stats-grid {
        display: flex;
        flex-wrap: nowrap;
        gap: 0.3rem;
        margin-bottom: 1.5rem;
        margin-left: 0.5rem;
        margin-right: 0.5rem;
    }

    .stat-card {
        background: white;
        border-radius: 6px;
        padding: 0.5rem 0.3rem;
        box-shadow: var(--card-shadow);
        border-left: 2px solid var(--accent-color);
        transition: all 0.3s ease;
        text-align: center;
        flex: 1;
        min-width: 0;
    }
}

/* Stats grid - Comportamento normale su mobile */
@media (max-width: 768px) {
    .stats-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 0.8rem;
        margin-bottom: 1.5rem;
        margin-left: 1rem;
        margin-right: 1rem;
    }

    .stat-card {
        background: white;
        border-radius: 8px;
        padding: 1rem;
        box-shadow: var(--card-shadow);
        border-left: 3px solid var(--accent-color);
        transition: all 0.3s ease;
        text-align: center;
    }
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover);
}

.stat-card.success {
    border-left-color: var(--success-color);
}

.stat-card.warning {
    border-left-color: var(--warning-color);
}

.stat-card.danger {
    border-left-color: var(--danger-color);
}

.stat-card.info {
    border-left-color: var(--info-color);
}

/* Font responsivi - compatti su desktop per stare in una riga */
@media (min-width: 769px) {
    .stat-number {
        font-size: 1.3rem;
        font-weight: 700;
        color: var(--primary-color);
        margin: 0;
        line-height: 1;
    }

    .stat-label {
        color: #6c757d;
        font-size: 0.65rem;
        font-weight: 500;
        margin-top: 0.2rem;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.2rem;
    }

    /* Data più piccola su desktop */
    .stat-card div[style*="font-size: 1rem"] {
        font-size: 0.7rem !important;
        margin-bottom: 0.2rem !important;
    }

    /* Valori delle metriche più piccoli su desktop */
    .stat-card .stat-value {
        font-size: 1.1rem !important;
        font-weight: 700;
        margin-bottom: 0;
    }

    /* Titoli delle metriche più piccoli su desktop */
    .stat-card .stat-title {
        font-size: 0.7rem !important;
        font-weight: 600;
        margin-bottom: 0.1rem;
        opacity: 0.85;
    }

    /* Card body più compatto su desktop */
    .stat-card .card-body {
        padding: 0.4rem 0.2rem !important;
    }
}

/* Font normali su mobile */
@media (max-width: 768px) {
    .stat-number {
        font-size: 1.8rem;
        font-weight: 700;
        color: var(--primary-color);
        margin: 0;
        line-height: 1;
    }

    .stat-label {
        color: #6c757d;
        font-size: 0.75rem;
        font-weight: 500;
        margin-top: 0.3rem;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.3rem;
    }

    /* Valori normali su mobile */
    .stat-card .stat-value {
        font-size: 1.4rem !important;
        font-weight: 700;
        margin-bottom: 0;
    }

    /* Titoli normali su mobile */
    .stat-card .stat-title {
        font-size: 0.9rem !important;
        font-weight: 600;
        margin-bottom: 0.1rem;
        opacity: 0.85;
    }

    /* Card body normale su mobile */
    .stat-card .card-body {
        padding: 0.6rem 0.5rem !important;
    }

    /* Data normale su mobile */
    .stat-card div[style*="font-size: 1rem"] {
        font-size: 1rem !important;
        margin-bottom: 0.3rem !important;
    }
}

.stat-card.success .stat-number {
    color: var(--success-color);
}

.stat-card.warning .stat-number {
    color: var(--warning-color);
}

.stat-card.danger .stat-number {
    color: var(--danger-color);
}

.stat-card.info .stat-number {
    color: var(--info-color);
}

/* ======================
   FILTRI E FORM
   ====================== */

.filters-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--card-shadow);
}

.filters-section .form-label {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 0.75rem;
    transition: all 0.3s ease;
    height: 50px; /* Altezza standard del tema per tutti i campi */
    box-sizing: border-box;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.2rem rgba(78, 184, 87, 0.25);
}

/* ======================
   CAMPI DATA E VALIDAZIONE
   ====================== */

/* Wrapper per campi data con icona calendario */
.date-input-wrapper {
    position: relative;
}

.date-input-wrapper .calendar-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    cursor: pointer;
    z-index: 2;
    padding: 5px;
    border-radius: 3px;
    transition: color 0.2s, background-color 0.2s;
}

.date-input-wrapper .calendar-icon:hover {
    color: #495057;
    background-color: #f8f9fa;
}

.date-input {
    padding-right: 40px !important;
}

/* Validazione visiva per campi data */
.date-input.valid {
    border-color: #28a745;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='m2.3 6.73.2.27.85-.85 1.05-1.05.2-.2-.2-.2-.2-.2-.2.2-.85.85-.45-.45-.2-.2-.2.2-.2.2.2.2z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(2.5rem + 0.375rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.date-input.invalid {
    border-color: #dc3545;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 4.6 2.4 2.4m-2.4 0 2.4-2.4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(2.5rem + 0.375rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Utility per elementi trasparenti */
.text-transparent {
    color: transparent !important;
    user-select: none;
    pointer-events: none;
}

/* ======================
   PULSANTI
   ====================== */

/* Regola base - deve essere più specifica di Bootstrap */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
    border: none;
    min-height: 50px; /* Altezza minima per allineamento con form controls */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ======================
   PULSANTI FILTRO STANDARDIZZATI
   ====================== */

/* Container per i pulsanti filtro */
.filter-buttons-container {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    margin-top: 1.8rem; /* Allineamento con le label dei campi form */
}

/* Pulsante principale filtro */
.btn-filter-primary {
    background: var(--accent-color) !important;
    color: white !important;
    border: 1px solid var(--accent-color) !important;
    padding: 0.5rem 1.2rem !important;
    font-weight: 600 !important;
    min-width: 100px;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
}

.btn-filter-primary:hover {
    background: #389c44 !important;
    border-color: #389c44 !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-filter-primary:focus {
    background: #389c44 !important;
    border-color: #389c44 !important;
    color: white !important;
    box-shadow: 0 0 0 0.2rem rgba(78, 184, 87, 0.25);
}

/* Pulsante reset filtri */
.btn-filter-reset {
    background: transparent !important;
    color: var(--danger-color) !important;
    border: 1px solid var(--danger-color) !important;
    padding: 0.5rem 0.7rem !important;
    font-weight: 500 !important;
    min-width: 44px;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
}

.btn-filter-reset:hover {
    background: var(--danger-color) !important;
    border-color: var(--danger-color) !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-filter-reset:focus {
    background: var(--danger-color) !important;
    border-color: var(--danger-color) !important;
    color: white !important;
    box-shadow: 0 0 0 0.2rem rgba(231, 76, 60, 0.25);
}

/* Icone nei pulsanti filtro */
.btn-filter-primary i,
.btn-filter-reset i {
    font-size: 1rem;
    margin-right: 0.5rem;
}

.btn-filter-reset i {
    margin-right: 0; /* Solo icona per il reset */
}

/* Responsiveness pulsanti filtro */
@media (max-width: 768px) {
    .filter-buttons-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        margin-top: 1rem;
    }
    
    .btn-filter-primary,
    .btn-filter-reset {
        width: 100%;
        min-width: unset;
        justify-content: center;
    }
}

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

.btn-primary.btn-primary:hover {
    background: #389c44;
    transform: translateY(-1px);
}

/* Regole outline con specificità aumentata */
.btn-outline-primary.btn-outline-primary {
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    background-color: transparent;
}

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

.btn-outline-secondary.btn-outline-secondary {
    color: var(--secondary-color);
    border: 1px solid var(--secondary-color);
    background-color: transparent;
}

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

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

.btn-success.btn-success:hover {
    background: #219a52;
    transform: translateY(-1px);
}

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

.btn-warning.btn-warning:hover {
    background: #d4ac0d;
    transform: translateY(-1px);
}

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

.btn-danger.btn-danger:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

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

.btn-info.btn-info:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

/* ======================
   TABELLE
   ====================== */

.table {
    margin-bottom: 0;
    background: transparent;
}

.table thead th {
    background: var(--light-bg);
    border-bottom: 2px solid #dee2e6;
    color: var(--primary-color);
    font-weight: 600;
    padding: 1rem 0.75rem;
    vertical-align: middle;
}

.table tbody tr {
    transition: all 0.2s ease;
}

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

.table td {
    padding: 1rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid #eee;
}

/* ======================
   BADGES E STATUS
   ====================== */

.badge {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

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

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

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

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

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.clickable-status {
    cursor: pointer;
}

.clickable-status:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* ======================
   TITOLI E HEADER
   ====================== */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin: 5px 0 10px;
    gap: 2rem;
}

.page-title {
    color: var(--accent-color);
    font-weight: 700;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-subtitle {
    color: #6c757d;
    font-size: 1rem;
    margin: 0;
    line-height: 1.4;
}

.page-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ======================
   ALERT E MESSAGGI
   ====================== */

.alert {
    border: none;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left-color: var(--success-color);
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-left-color: var(--warning-color);
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border-left-color: var(--danger-color);
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left-color: var(--info-color);
}

/* ======================
   UTILITY CLASSES
   ====================== */

.text-accent {
    color: var(--accent-color) !important;
}

.text-primary-custom {
    color: var(--primary-color) !important;
}

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

.border-accent {
    border-color: var(--accent-color) !important;
}

.shadow-custom {
    box-shadow: var(--card-shadow) !important;
}

.shadow-hover-custom {
    box-shadow: var(--card-shadow-hover) !important;
}

.rounded-custom {
    border-radius: 12px !important;
}

/* ======================
   ANIMAZIONI
   ====================== */

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

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

.slide-up {
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ======================
   RESPONSIVE
   ====================== */

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .page-actions {
        justify-content: stretch;
    }
    
    .page-actions .btn {
        flex: 1;
        text-align: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .filters-section {
        padding: 1rem;
    }
    
    .table-responsive {
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .page-title {
        font-size: 1.5rem;
    }
    
    .stat-number {
        font-size: 1.8rem;
    }
    
    .card-header {
        padding: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
}

/* ======================
   LEGACY COMPATIBILITY
   ====================== */

/* Manteniamo alcuni stili legacy per compatibilità */
.log-container {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.header {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 15px;
    margin: 20px 0 10px 0;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1.2em;
    text-align: center;
}

.subheader {
    background-color: var(--secondary-color);
    color: white;
    padding: 8px 15px;
    margin: 15px 0 10px 0;
    border-radius: 8px;
    font-weight: bold;
}

.log-entry {
    margin: 4px 0;
    padding: 4px;
    border-bottom: 1px dotted #eee;
}

.timestamp {
    color: #888;
    font-size: 0.9em;
    margin-right: 10px;
}

.info {
    color: var(--info-color);
}

.success {
    color: var(--success-color);
    font-weight: bold;
}

.warning {
    color: var(--warning-color);
    font-weight: bold;
}

.error {
    color: var(--danger-color);
    font-weight: bold;
}

.output {
    color: #555;
    margin-left: 20px;
    border-left: 3px solid var(--info-color);
    padding-left: 10px;
    background-color: #f9f9f9;
}

.process-count {
    float: right;
    background-color: #7f8c8d;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8em;
}

.execution-time {
    float: right;
    color: #95a5a6;
    font-style: italic;
    font-size: 0.9em;
}

/* ======================
   SERVIZI FREEDHOME
   ====================== */

/* Layout verticale dei servizi */
.servizi-container-vertical {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

/* Colori specifici per servizi FreedHome */
.bg-rare-azzurro {
    background-color: #3BAFDA !important;
    color: white !important;
}

.bg-rare-blu-navy {
    background-color: #34495E !important;
    color: white !important;
}

.bg-rare-arancione {
    background-color: #F39C12 !important;
    color: white !important;
}

.bg-rare-viola {
    background-color: #8E44AD !important;
    color: white !important;
}

/* Sfumature di verde per percentuali */
.bg-green-dark {
    background-color: #155724 !important;
    color: white !important;
}

.bg-green-medium {
    background-color: #28a745 !important;
    color: white !important;
}

.bg-green-light {
    background-color: #d4edda !important;
    color: #155724 !important;
    border: 1px solid #c3e6cb !important;
}

/* Colore personalizzato per mandato */
.bg-mandato-si {
    background-color: #243a33 !important;
    color: white !important;
}

/* Effetti hover per servizi cliccabili */
.servizio-clickable {
    cursor: pointer;
    transition: all 0.2s ease !important;
    position: relative;
}

.servizio-clickable:hover {
    transform: scale(1.02) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
    opacity: 0.9;
}

.servizio-clickable:active {
    transform: scale(0.95) !important;
}



/* Badge immobili problematici cliccabili */
.immobili-problematici-clickable {
    cursor: pointer;
    transition: all 0.2s ease !important;
    position: relative;
}

.immobili-problematici-clickable:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 3px 8px rgba(220, 53, 69, 0.4) !important;
    z-index: 2;
}

.immobili-problematici-clickable:active {
    transform: scale(0.95) !important;
}

/* Badge immobili attivi cliccabili */
.immobili-attivi-clickable {
    cursor: pointer;
    transition: all 0.2s ease !important;
    position: relative;
}

.immobili-attivi-clickable:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 3px 8px rgba(23, 162, 184, 0.4) !important;
    z-index: 2;
}

.immobili-attivi-clickable:active {
    transform: scale(0.95) !important;
}

/* Badge di stato PM inattivi */
.status-badge.status-inactive.clickable-status {
    opacity: 0.7;
    cursor: help !important;
}

.status-badge.status-inactive.clickable-status:hover {
    opacity: 0.9;
    transform: none !important;
} 

/* Stili per i pulsanti di esportazione */
.export-buttons-section .btn-group .btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 10px 20px;
    transition: all 0.3s ease;
}

.export-buttons-section .btn-group .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.export-buttons-section .dropdown-menu {
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 8px 0;
    margin-top: 8px;
}

.export-buttons-section .dropdown-item {
    padding: 12px 20px;
    transition: all 0.2s ease;
    border-radius: 0;
}

.export-buttons-section .dropdown-item:hover {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    transform: translateX(4px);
}

.export-buttons-section .dropdown-item i {
    width: 20px;
    text-align: center;
}

/* Animazioni per il dropdown */
.export-buttons-section .dropdown-menu[data-bs-popper] {
    animation: dropdownSlide 0.3s ease-out;
}

@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Toast personalizzati per l'esportazione */
.toast-export {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
}

.toast-export .toast-header {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.toast-export .btn-close {
    filter: brightness(0) invert(1);
}

/* Miglioramenti per i pulsanti esistenti */
.btn-success.dropdown-toggle {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.btn-success.dropdown-toggle:hover {
    background: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

/* Responsive per mobile */
@media (max-width: 768px) {
    .export-buttons-section {
        margin-bottom: 20px;
    }
    
    .export-buttons-section .d-flex {
        justify-content: center !important;
    }
    
    .export-buttons-section .btn {
        padding: 8px 16px;
        font-size: 14px;
    }
} 