/* Dashboard Page Specific Styles */

/* Header Title with Back Link */
.header-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-title h1 {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
}

.back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    text-decoration: none;
    transition: all 0.2s ease;
}

.back-link:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-foreground);
}

/* Dashboard Charts Container */
.dashboard-charts-container {
    flex: 1;
    overflow: auto;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dashboard-charts-container.hidden {
    display: none;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1rem;
}

.summary-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
}

.summary-card.in-lavorazione {
    border-left: 4px solid #eab308;
}

.summary-card.follow-up {
    border-left: 4px solid #f97316;
}

.summary-card.interessato {
    border-left: 4px solid #22c55e;
}

.summary-card.non-interessato {
    border-left: 4px solid #ef4444;
}

.summary-card.nutrimento {
    border-left: 4px solid #14b8a6;
}

.summary-card.non-raggiungibile {
    border-left: 4px solid #6b7280;
}

.summary-value {
    font-family: var(--font-mono);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.summary-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin-top: 0.5rem;
    text-transform: uppercase;
}

/* Chart Containers */
.chart-container {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.chart-container.half {
    flex: 1;
}

.chart-header {
    margin-bottom: 1rem;
}

.chart-header h3 {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--muted-foreground);
    text-transform: uppercase;
    margin: 0;
}

.chart-wrapper {
    position: relative;
    height: 250px;
}

.charts-row {
    display: flex;
    gap: 1rem;
}

.charts-row .chart-wrapper {
    height: 200px;
}

/* View Toggle in Toolbar */
.dashboard-view-toggle {
    display: flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

/* Status Selector */
.status-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-selector label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.status-selector select {
    padding: 0.5rem 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    cursor: pointer;
    min-width: 140px;
}

/* Dashboard Timeframe Buttons */
.dash-timeframe-btn {
    padding: 0.5rem 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--card);
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: all 0.15s ease;
}

.dash-timeframe-btn:not(:last-child) {
    border-right: 1px solid var(--border);
}

.dash-timeframe-btn:hover {
    background: var(--muted);
    color: var(--foreground);
}

.dash-timeframe-btn.active {
    background: var(--secondary);
    color: var(--secondary-foreground);
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
    font-family: var(--font-mono);
    border-radius: var(--radius);
    background: var(--muted);
    text-transform: lowercase;
}

.status-badge.email-sent {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-badge.phone-followup,
.status-badge.phone_followup {
    background: #fef3c7;
    color: #b45309;
}

/* In Lavorazione - Yellow */
.status-badge.in-lavorazione {
    background: #fef08a;
    color: #854d0e;
}

/* Follow Up - Orange */
.status-badge.follow-up {
    background: #fed7aa;
    color: #c2410c;
}

/* Interessato - Green */
.status-badge.interessato {
    background: #bbf7d0;
    color: #166534;
}

/* Non interessato - Red */
.status-badge.non-interessato {
    background: #fecaca;
    color: #dc2626;
}

.status-badge.nutrimento {
    background: #ccfbf1;
    color: #0f766e;
}

/* Non raggiungibile - Gray */
.status-badge.non-raggiungibile {
    background: #e5e7eb;
    color: #374151;
}

/* Table Column Widths */
.contacts-table {
    table-layout: fixed;
    width: 100%;
}

.contacts-table td {
    vertical-align: top;
}

.contacts-table th:nth-child(1),
.contacts-table td:nth-child(1) {
    width: 20%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contacts-table th:nth-child(2),
.contacts-table td:nth-child(2) {
    width: 15%;
}

.contacts-table th:nth-child(3),
.contacts-table td:nth-child(3) {
    width: 15%;
}

.contacts-table th:nth-child(4),
.contacts-table td:nth-child(4) {
    width: 50%;
}

/* Note Cell */
.note-cell {
    padding-right: 1rem;
}

/* Note Display Mode */
.note-display {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.note-text {
    flex: 1;
    font-size: 0.75rem;
    color: var(--foreground);
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.4;
}

.note-placeholder {
    color: var(--muted-foreground);
}

.note-edit-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--muted-foreground);
    cursor: pointer;
    transition: all 0.15s ease;
}

.note-edit-btn:hover {
    background: var(--muted);
    border-color: var(--border);
    color: var(--primary);
}

/* Note Edit Mode */
.note-edit {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.note-edit.hidden {
    display: none;
}

.note-display.hidden {
    display: none;
}

.note-input {
    width: 100%;
    min-height: 60px;
    max-height: 100px;
    padding: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.4;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    resize: vertical;
    transition: border-color 0.15s ease;
}

.note-input:focus {
    outline: none;
    border-color: var(--primary);
}

.note-input::placeholder {
    color: var(--muted-foreground);
}

.note-actions {
    display: flex;
    gap: 0.25rem;
    justify-content: flex-end;
}

.note-save-btn,
.note-cancel-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
}

.note-save-btn {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-foreground);
}

.note-save-btn:hover {
    opacity: 0.9;
}

.note-cancel-btn {
    background: var(--muted);
    color: var(--muted-foreground);
}

.note-cancel-btn:hover {
    background: var(--destructive);
    border-color: var(--destructive);
    color: white;
}

/* Sortable Table Headers */
.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.sortable:hover {
    background: var(--muted);
}

.sortable .sort-icon {
    display: inline-block;
    width: 12px;
    margin-left: 4px;
    opacity: 0.3;
}

.sortable .sort-icon::after {
    content: '↕';
    font-size: 0.75rem;
}

.sortable.active .sort-icon {
    opacity: 1;
}

.sortable.active.asc .sort-icon::after {
    content: '↑';
}

.sortable.active.desc .sort-icon::after {
    content: '↓';
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .header-title h1 {
        font-size: 1.25rem;
    }

    .activity-counters {
        grid-template-columns: 1fr;
    }

    .counter-value {
        font-size: 3rem;
    }

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

    .status-selector {
        width: 100%;
    }

    .status-selector select {
        flex: 1;
    }
}
