/* EQUAL CRM - Modern Kanban Board Styles */

/* =================
   VARIABILI CSS
   ================= */
:root {
    --crm-primary: #007bff;
    --crm-primary-dark: #0056b3;
    --crm-secondary: #6c757d;
    --crm-success: #28a745;
    --crm-danger: #dc3545;
    --crm-warning: #ffc107;
    --crm-info: #17a2b8;
    --crm-light: #f8f9fa;
    --crm-dark: #343a40;
    
    /* Gradients moderni */
    --gradient-primary: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    --gradient-success: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-warning: linear-gradient(135deg, #fdbb2d 0%, #22c1c3 100%);
    --gradient-danger: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    --gradient-info: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    
    /* Shadows & Effects */
    --shadow-card: 0 2px 15px rgba(0, 0, 0, 0.08);
    --shadow-card-hover: 0 8px 25px rgba(0, 0, 0, 0.15);
    --shadow-header: 0 2px 10px rgba(0, 0, 0, 0.1);
    
    /* Transitions */
    --transition-fast: all 0.2s ease;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    
    /* Border radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

/* =================
   CONTAINER PRINCIPALE
   ================= */
.equal-crm-container {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: relative;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 80vh;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    /* visible: i dropdown della toolbar escono dal box e non vengono tagliati */
    overflow: visible;
}

.equal-crm-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="0.5" fill="%23ffffff" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
    z-index: 1;
}

.equal-crm-container > * {
    position: relative;
    z-index: 2;
}

/* =================
   HEADER & TOOLBAR
   ================= */
.crm-header {
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.6);
    padding: 0;
    overflow: visible;
}

/* --- Toolbar row --- */
.crm-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: linear-gradient(135deg, rgba(30, 60, 114, 0.03) 0%, rgba(42, 82, 152, 0.02) 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    flex-wrap: wrap;
    /* Sopra la riga metriche (sibling): altrimenti il menu copre solo il toolbar ma viene disegnato sotto dalle card metriche */
    position: relative;
    z-index: 30;
}

.crm-toolbar-left,
.crm-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.crm-toolbar-divider {
    width: 1px;
    height: 28px;
    background: rgba(0, 0, 0, 0.1);
    margin: 0 0.25rem;
}

/* Toolbar buttons (shared base) */
.crm-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1.5px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-md);
    background: white;
    color: var(--crm-dark);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    white-space: nowrap;
    line-height: 1.4;
}

.crm-toolbar-btn i {
    font-size: 1rem;
    opacity: 0.65;
    transition: var(--transition-fast);
}

.crm-toolbar-btn:hover {
    border-color: var(--crm-primary);
    color: var(--crm-primary);
    background: rgba(0, 123, 255, 0.04);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.1);
}

.crm-toolbar-btn:hover i {
    opacity: 1;
}

/* Danger variant */
.crm-toolbar-btn--danger {
    border-color: rgba(220, 53, 69, 0.25);
    color: var(--crm-danger);
}

.crm-toolbar-btn--danger:hover {
    border-color: var(--crm-danger);
    background: rgba(220, 53, 69, 0.04);
    color: var(--crm-danger);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.12);
}

.crm-toolbar-btn--danger.active,
.filter-no-reminder.active.crm-toolbar-btn {
    background: var(--crm-danger);
    color: white;
    border-color: var(--crm-danger);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.35);
}

.crm-toolbar-btn--danger.active i,
.filter-no-reminder.active.crm-toolbar-btn i {
    opacity: 1;
    color: white !important;
}

.crm-toolbar-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--crm-danger);
    color: white;
    line-height: 1;
}

.crm-toolbar-btn--danger.active .crm-toolbar-badge,
.filter-no-reminder.active.crm-toolbar-btn .crm-toolbar-badge {
    background: white;
    color: var(--crm-danger);
}

/* Dropdown overrides inside toolbar */
.crm-toolbar .dropdown {
    position: relative;
}

.crm-toolbar .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.375rem;
    min-width: 180px;
    max-height: min(70vh, 320px);
    overflow-y: auto;
    z-index: 1080;
    border: none;
    border-radius: var(--radius-md);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: rgba(255, 255, 255, 0.98);
    padding: 0.375rem;
}

/* BS5: .show sul menu; BS3: .open sul parent .dropdown */
.crm-toolbar .dropdown-menu.show,
.crm-toolbar .dropdown.open > .dropdown-menu {
    display: block;
    animation: dropdownFadeIn 0.2s ease-out;
}

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

.crm-toolbar .dropdown-item {
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-weight: 500;
    font-size: 0.85rem;
    transition: var(--transition-fast);
    color: var(--crm-dark);
}

.crm-toolbar .dropdown-item:hover {
    background: rgba(0, 123, 255, 0.08);
    color: var(--crm-primary);
    transform: translateX(2px);
}

.crm-toolbar .dropdown-item.active {
    background: var(--gradient-primary);
    color: white;
}

.crm-toolbar .dropdown-item.active i {
    color: white !important;
}

.crm-toolbar .dropdown-divider {
    margin: 0.375rem 0;
    border-color: rgba(0, 0, 0, 0.06);
}

/* Agent dropdown: wider */
.agent-selector .dropdown-menu {
    min-width: 260px;
}

/* --- Metrics row --- */
.crm-metrics-row {
    display: flex;
    gap: 0;
    padding: 0;
    position: relative;
    z-index: 1;
}

.crm-metric-card {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    position: relative;
    transition: var(--transition-smooth);
    cursor: default;
    border-right: 1px solid rgba(0, 0, 0, 0.04);
}

.crm-metric-card:last-child {
    border-right: none;
}

.crm-metric-card::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 1rem;
    right: 1rem;
    height: 3px;
    border-radius: 3px 3px 0 0;
    opacity: 0;
    transition: var(--transition-smooth);
}

.crm-metric-card:hover::before {
    opacity: 1;
}

.crm-metric-card:hover {
    background: rgba(0, 0, 0, 0.015);
}

/* Metric icon */
.crm-metric-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    transition: var(--transition-smooth);
}

.crm-metric-icon i {
    font-size: 1.15rem;
}

.crm-metric-card:hover .crm-metric-icon {
    transform: scale(1.1);
}

/* Metric body */
.crm-metric-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.crm-metric-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.55;
    color: var(--crm-dark);
    line-height: 1.2;
    white-space: nowrap;
}

.crm-metric-value {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--crm-dark);
    line-height: 1.3;
    white-space: nowrap;
}

/* Color themes */
.crm-metric--blue .crm-metric-icon    { background: rgba(30, 60, 114, 0.1); color: #1e3c72; }
.crm-metric--blue::before             { background: #1e3c72; }
.crm-metric--blue .crm-metric-value   { color: #1e3c72; }

.crm-metric--amber .crm-metric-icon   { background: rgba(207, 149, 40, 0.12); color: #cf9528; }
.crm-metric--amber::before            { background: #cf9528; }
.crm-metric--amber .crm-metric-value  { color: #b8841f; }

.crm-metric--green .crm-metric-icon   { background: rgba(18, 168, 18, 0.1); color: #12a812; }
.crm-metric--green::before            { background: #12a812; }
.crm-metric--green .crm-metric-value  { color: #0e8c0e; }

.crm-metric--pink .crm-metric-icon    { background: rgba(255, 0, 103, 0.1); color: #ff0067; }
.crm-metric--pink::before             { background: #ff0067; }
.crm-metric--pink .crm-metric-value   { color: #e0005b; }

.crm-metric--purple .crm-metric-icon  { background: rgba(102, 126, 234, 0.1); color: #667eea; }
.crm-metric--purple::before           { background: #667eea; }
.crm-metric--purple .crm-metric-value { color: #5a6fd6; }

/* Legacy gradient helpers (keep for compatibility) */
.bg-gradient-primary { background: var(--gradient-primary) !important; }
.bg-gradient-success { background: var(--gradient-success) !important; }
.bg-gradient-warning { background: var(--gradient-warning) !important; }
.bg-gradient-blue    { background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%) !important; }

/* =================
   LOADING OVERLAY
   ================= */
.crm-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: var(--radius-lg);
}

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

/* =================
   KANBAN BOARD
   ================= */
.crm-kanban-board {
    margin-top: 2rem;
}

.kanban-scroll-container {
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.kanban-scroll-container::-webkit-scrollbar {
    height: 8px;
}

.kanban-scroll-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-sm);
}

.kanban-scroll-container::-webkit-scrollbar-thumb {
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
}

.kanban-columns-wrapper {
    display: flex;
    gap: 1rem;
    min-width: fit-content;
    padding: 0.5rem;
}

.kanban-column-item {
    flex: 0 0 280px;
    min-width: 280px;
}

.kanban-column {
    transition: var(--transition-smooth);
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

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

/* Column Headers (colori da backend: lo stile inline del widget ha priorità) */
.column-header {
    position: relative;
    text-align: center;
    border-bottom: 3px solid rgba(255, 255, 255, 0.3);
    color: white !important;
}
/* Solo se non è stato impostato un colore inline (fallback gradient) */
.column-header:not([style*="background"]) {
    background: var(--gradient-primary);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
}

.column-header * {
    color: white !important;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.column-header h6 {
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.column-stats {
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    display: inline-block;
}

/* Column Body */
.column-body {
    min-height: 300px;
    max-height: 600px;
    overflow-y: auto;
    position: relative;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 249, 250, 0.8) 100%);
}

.column-body::-webkit-scrollbar {
    width: 6px;
}

.column-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-sm);
}

.column-body::-webkit-scrollbar-thumb {
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
}

.column-body::-webkit-scrollbar-thumb:hover {
    background: var(--crm-primary-dark);
}

/* Sortable States */
.crm-sortable {
    transition: var(--transition-smooth);
}

.crm-sortable.sortable-drag {
    background: rgba(0, 123, 255, 0.1);
    border: 2px dashed var(--crm-primary);
}

.crm-sortable.sortable-drop {
    background: rgba(40, 167, 69, 0.1);
    border: 2px dashed var(--crm-success);
}

/* =================
   CONTACT CARDS
   ================= */
.crm-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-card);
    transition: var(--transition-smooth);
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.crm-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: var(--transition-smooth);
}

.crm-card:hover::before {
    transform: scaleX(1);
}

.crm-card:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-card-hover);
    border-color: rgba(0, 123, 255, 0.3);
}

.crm-card:active {
    transform: scale(0.98);
}

/* Border Colors for Subagente */
.crm-card.subagente-rosa {
    border-left: 4px solid #e91e63;
    background: linear-gradient(135deg, rgba(233, 30, 99, 0.05) 0%, rgba(255, 255, 255, 0.95) 20%);
}

.crm-card.subagente-azzurro {
    border-left: 4px solid #1e3c72;
    background: linear-gradient(135deg, rgba(30, 60, 114, 0.05) 0%, rgba(255, 255, 255, 0.95) 20%);
}

.crm-card.subagente-neutro {
    border-left: 4px solid #adb5bd;
    background: linear-gradient(135deg, rgba(173, 181, 189, 0.06) 0%, rgba(255, 255, 255, 0.95) 20%);
}

/* Card Content */
.crm-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.crm-card-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin: 0;
    color: var(--crm-dark);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    flex: 1;
}

.crm-card-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: var(--gradient-primary);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.crm-card-body {
    font-size: 0.8rem;
    color: var(--crm-secondary);
    line-height: 1.4;
}

.crm-card-meta {
    display: flex;
    align-items: center;
    margin-bottom: 0.25rem;
    gap: 0.5rem;
}

.crm-card-meta i {
    width: 14px;
    text-align: center;
    opacity: 0.7;
}

.crm-card-value {
    background: var(--gradient-success);
    color: white;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* =================
   MODAL STYLES
   ================= */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
}

.modal-header {
    background: var(--gradient-primary);
    color: white;
    border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 1.5rem;
}

.modal-header .modal-title {
    font-weight: 600;
    font-size: 1.25rem;
    color: #fff !important;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

.modal-header .btn-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 2rem;
    background: rgba(255, 255, 255, 0.95);
}

.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(248, 249, 250, 0.8);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 1.5rem;
}

/* Form Controls in Modal */
.modal .form-control {
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    transition: var(--transition-smooth);
}

.modal .form-control:focus {
    border-color: var(--crm-primary);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* =================
   BUTTONS
   ================= */
.btn {
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.btn:hover::before {
    width: 100px;
    height: 100px;
}

.btn-primary {
    background: var(--gradient-primary);
    border: none;
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
}

/* =================
   RESPONSIVE DESIGN
   ================= */
@media (max-width: 1200px) {
    .kanban-columns-wrapper {
        flex-direction: column;
    }

    .kanban-column-item {
        flex: 1 1 auto;
        min-width: 100%;
    }

    .kanban-scroll-container {
        overflow-x: visible;
    }

    .column-body {
        max-height: 400px;
    }

    .crm-metrics-row {
        flex-wrap: wrap;
    }

    .crm-metric-card {
        flex: 1 1 calc(33.333% - 1px);
        border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    }
}

@media (max-width: 768px) {
    .equal-crm-container {
        padding: 1rem;
    }

    .crm-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .crm-toolbar-left {
        flex-wrap: wrap;
    }

    .crm-toolbar-right {
        justify-content: stretch;
    }

    .crm-toolbar-right .crm-toolbar-btn {
        flex: 1;
        justify-content: center;
    }

    .crm-toolbar-divider {
        display: none;
    }

    .crm-metrics-row {
        flex-wrap: wrap;
    }

    .crm-metric-card {
        flex: 1 1 50%;
        border-bottom: 1px solid rgba(0, 0, 0, 0.04);
        padding: 0.75rem 1rem;
    }

    .kanban-columns-wrapper {
        flex-direction: column;
        gap: 1rem;
    }

    .kanban-column-item {
        flex: 1 1 auto;
        min-width: 100%;
        margin-bottom: 1rem;
    }

    .column-header h6 {
        font-size: 0.8rem;
    }

    .column-body {
        min-height: 200px;
        max-height: 300px;
    }

    .crm-card {
        padding: 0.75rem;
    }

    .crm-card-title {
        font-size: 0.85rem;
    }
}

@media (max-width: 576px) {
    .equal-crm-container {
        padding: 0.75rem;
        border-radius: var(--radius-md);
    }

    .crm-toolbar-btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }

    .crm-toolbar-btn-label {
        display: none;
    }

    .crm-metric-card {
        flex: 1 1 100%;
        padding: 0.625rem 1rem;
    }

    .crm-metric-icon {
        width: 34px;
        height: 34px;
    }

    .crm-metric-icon i {
        font-size: 1rem;
    }

    .crm-metric-value {
        font-size: 1rem;
    }

    .column-header {
        padding: 0.75rem;
    }

    .column-header h6 {
        font-size: 0.75rem;
        margin-bottom: 0.25rem;
    }

    .column-stats {
        font-size: 0.7rem;
    }

    .column-body {
        padding: 0.5rem;
        min-height: 150px;
    }

    .crm-card {
        padding: 0.5rem;
        margin-bottom: 0.5rem;
    }
}

/* =================
   ANIMATIONS & EFFECTS
   ================= */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(0, 123, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 123, 255, 0);
    }
}

.crm-card.card-added {
    animation: fadeInUp 0.5s ease-out;
}

.crm-card.card-moved {
    animation: pulse 0.6s ease-out;
}

/* Focus states for accessibility */
.crm-card:focus,
.btn:focus,
.dropdown-toggle:focus {
    outline: 2px solid var(--crm-primary);
    outline-offset: 2px;
}

/* Relations Section */
.relations-list {
    scrollbar-width: thin;
    scrollbar-color: var(--crm-primary) rgba(0, 0, 0, 0.05);
}

.relations-list::-webkit-scrollbar {
    width: 6px;
}

.relations-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-sm);
}

.relations-list::-webkit-scrollbar-thumb {
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
}

.relation-item {
    transition: var(--transition-fast);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-left: 3px solid var(--crm-primary);
}

.relation-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-card);
    border-left-color: var(--crm-success);
}

.relation-item .card-body {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 250, 0.9) 100%);
}

/* =================
   IMPORT TAGS (Contatti importati dall'anno precedente)
   ================= */
.crm-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
}

.crm-import-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.crm-import-tag.imported {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.crm-import-tag.no-visit {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: #fff;
}

.crm-import-tag i {
    font-size: 0.7rem;
}

/* Card con contatti importati - bordo speciale */
.crm-card[data-imported-year]:not([data-imported-year=""]) {
    border-left: 3px solid #667eea;
    position: relative;
}

.crm-card[data-imported-year]:not([data-imported-year=""])[data-has-visit="false"] {
    border-left-color: #ff6b6b;
}

/* Pulse animation per contatti senza visita */
.crm-card[data-has-visit="false"]:not([data-imported-year=""]) {
    animation: importedPulse 2s ease-in-out infinite;
}

@keyframes importedPulse {
    0%, 100% {
        box-shadow: var(--shadow-card), 0 0 0 0 rgba(255, 107, 107, 0.3);
    }
    50% {
        box-shadow: var(--shadow-card), 0 0 0 4px rgba(255, 107, 107, 0.1);
    }
}

/* =================
   NEXT EVENT TAGS (Prossimo appuntamento/visita/promemoria)
   ================= */
.crm-card-footer {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.next-event-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    width: 100%;
    justify-content: center;
}

.next-event-tag.has-event {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: #fff;
}

.next-event-tag.no-event {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: #fff;
}

.next-event-tag i {
    font-size: 0.75rem;
}

/* =================
   FILTRO SENZA PROMEMORIA
   ================= */
.filter-no-reminder.active {
    animation: pulseFilter 2s ease-in-out infinite;
}

@keyframes pulseFilter {
    0%, 100% { box-shadow: 0 4px 15px rgba(220, 53, 69, 0.35); }
    50%      { box-shadow: 0 4px 25px rgba(220, 53, 69, 0.55); }
}

/* Print styles */
@media print {
    .equal-crm-container {
        background: white !important;
        box-shadow: none !important;
    }
    
    .crm-card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    
    .column-header {
        background: #f8f9fa !important;
        color: #333 !important;
    }
    
    .crm-import-tag {
        border: 1px solid #333 !important;
        color: #333 !important;
        background: transparent !important;
    }
} 