﻿/* ========================================
   UNIFORM PAGES STYLES
   Stili comuni per tutte le pagine Index uniformate
   ======================================== */

/* ========================================
   CONTACT AVATAR SMALL
   ======================================== */
.contact-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--crm-primary), var(--crm-primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

/* ========================================
   CAMPAIGN CARDS
   ======================================== */
.campaign-card {
    transition: all 0.3s ease;
    border-left: 5px solid var(--crm-primary);
}

    .campaign-card:hover {
        transform: translateY(-5px);
        box-shadow: var(--crm-shadow-hover);
    }

.campaign-stats {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
}

.stat-box {
    padding: 10px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--crm-primary);
}

.stat-label {
    font-size: 11px;
    color: #7f8c8d;
    text-transform: uppercase;
}

/* ========================================
   LIST CARDS
   ======================================== */
.list-card {
    transition: all 0.3s ease;
    border-left: 5px solid var(--crm-primary);
}

    .list-card:hover {
        transform: translateY(-5px);
        box-shadow: var(--crm-shadow-hover);
    }

.list-stats {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
}

.summary-stat {
    padding: 20px;
}

    .summary-stat h3 {
        font-size: 32px;
        font-weight: 700;
        color: var(--crm-dark);
    }

/* ========================================
   TABLE ENHANCEMENTS
   ======================================== */
.table-hover tbody tr {
    cursor: pointer;
}

.table tbody td {
    vertical-align: middle;
}

/* Badge styles for status */
.badge {
    font-weight: 600;
    padding: 6px 12px;
    font-size: 11px;
}

/* ========================================
   BUTTON GROUPS
   ======================================== */
.btn-group-sm .btn {
    padding: 4px 8px;
    font-size: 12px;
}

/* ========================================
   FILTER CARDS
   ======================================== */
.card .input-group-text {
    background: white;
    border-right: none;
}

.card .form-control {
    border-left: none;
}

    .card .form-control:focus {
        border-left: none;
        box-shadow: none;
    }

.card .input-group:focus-within .input-group-text {
    border-color: var(--crm-primary);
}

/* ========================================
   EMPTY STATE
   ======================================== */
.card-body .fa-inbox,
.card-body .fa-bullhorn,
.card-body .fa-list-alt {
    opacity: 0.3;
}

/* ========================================
   PAGINATION ENHANCED
   ======================================== */
.pagination {
    margin-bottom: 0;
}

.page-link {
    border-radius: 8px;
    margin: 0 3px;
    border: 1px solid #dee2e6;
    color: var(--crm-primary);
    font-weight: 500;
}

    .page-link:hover {
        background: var(--crm-primary);
        color: white;
        border-color: var(--crm-primary);
        transform: translateY(-2px);
        box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
    }

.page-item.active .page-link {
    background: linear-gradient(135deg, var(--crm-primary) 0%, var(--crm-primary-dark) 100%);
    border-color: var(--crm-primary);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.page-item.disabled .page-link {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   CARD HEADER ENHANCEMENTS
   ======================================== */
.card-header h5 {
    margin: 0;
    font-weight: 600;
    color: var(--crm-dark);
}

.card-header .badge {
    font-size: 12px;
}

/* ========================================
   INVOICE SPECIFIC
   ======================================== */
.text-end strong {
    color: var(--crm-dark);
}

/* Highlight overdue dates */
.text-danger {
    font-weight: 600;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */
@media (max-width: 768px) {
    /* Stack buttons vertically on mobile */
    .page-actions {
        flex-direction: column;
        width: 100%;
    }

        .page-actions .btn {
            width: 100%;
            margin-bottom: 10px;
        }

    /* Make tables scrollable on mobile */
    .table-responsive {
        border: none;
    }

    /* Adjust campaign/list cards */
    .campaign-card,
    .list-card {
        margin-bottom: 15px;
    }

    /* Simplify stat cards on mobile */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

    .stat-card {
        min-height: 150px;
    }

    /* Stack filter form elements */
    .card-body .row.g-3 > div {
        margin-bottom: 15px;
    }
}

@media (max-width: 576px) {
    /* Single column for stats on very small screens */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* Full width cards */
    .campaign-card,
    .list-card {
        width: 100%;
    }

    /* Adjust button groups */
    .btn-group {
        display: flex;
        flex-wrap: wrap;
    }

        .btn-group .btn {
            flex: 1;
        }
}

/* ========================================
   ANIMATION CLASSES
   ======================================== */
/* slideInUp SENZA movimento: solo dissolvenza (niente translateY
   per evitare lo "scatto" della pagina al caricamento). */
@keyframes slideInUp {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.card,
.stat-card {
    animation: slideInUp 0.3s ease-out both;
}

/* Stagger rimosso: lo scaglionamento accentuava il movimento percepito.
   (Se in futuro lo si vuole, riattivare solo con opacity, mai con transform.) */

/* ========================================
   HOVER EFFECTS
   ======================================== */
.btn-group .btn:hover {
    z-index: 2;
    transform: scale(1.1);
}

.table-hover tbody tr:hover {
    background-color: rgba(52, 152, 219, 0.05);
}

/* ========================================
   FOCUS STATES
   ======================================== */
.form-control:focus,
.form-select:focus {
    border-color: var(--crm-primary);
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.15);
}

/* ========================================
   LOADING STATES (optional)
   ======================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--crm-primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    .page-header,
    .page-actions,
    .btn,
    .pagination,
    .card-footer {
        display: none !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}
