/* =============================================================================
   XFIR Gommisti - Stili Admin
   ============================================================================= */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --secondary-hover: #475569;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --placeholder-bg: #fef3c7;
    --placeholder-color: #92400e;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* =============================================================================
   LOGIN PAGE
   ============================================================================= */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    padding: 2rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.login-logo {
    max-width: 180px;
    height: auto;
    margin-bottom: 1.5rem;
}

.home-message {
    text-align: center;
    padding: 1.5rem;
    background-color: var(--bg-light);
    border-radius: 8px;
    margin-top: 1rem;
}

.home-message p {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

/* =============================================================================
   ALERTS
   ============================================================================= */

.alert {
    padding: 0.875rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.alert-error {
    background-color: #fef2f2;
    color: var(--error-color);
    border: 1px solid #fecaca;
}

/* =============================================================================
   FORMS
   ============================================================================= */

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
input[type="email"],
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="datetime-local"]:focus,
input[type="email"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

input[type="file"] {
    padding: 0.5rem 0;
}

.textarea-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.char-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.char-count.warning {
    color: var(--warning-color);
}

.char-count.error {
    color: var(--error-color);
}

/* =============================================================================
   BUTTONS
   ============================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

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

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
}

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

.btn-secondary:hover:not(:disabled) {
    background-color: var(--secondary-hover);
}

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

.btn-success:hover:not(:disabled) {
    background-color: #059669;
}

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

.btn-danger:hover:not(:disabled) {
    background-color: #dc2626;
}

.btn-block {
    width: 100%;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.85rem;
    border-radius: 6px;
}

/* =============================================================================
   HEADER
   ============================================================================= */

.header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
}

.logout-form {
    margin: 0;
}

/* =============================================================================
   MAIN CONTENT
   ============================================================================= */

.main-content {
    padding: 2rem 1.5rem;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

.container-wide {
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* =============================================================================
   TAB NAVIGATION
   ============================================================================= */

.tab-nav {
    display: flex;
    gap: 0;
    background: var(--card-bg);
    border-radius: 12px 12px 0 0;
    border: 1px solid var(--border-color);
    border-bottom: none;
    overflow-x: auto;
    margin-bottom: 0;
}

.tab-btn {
    flex: 1;
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-align: center;
}

.tab-btn:hover {
    color: var(--primary-color);
    background-color: #f8fafc;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: #f8fafc;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    border-top: none;
}

.tab-content .stat-card,
.tab-content .progress-card {
    background: var(--card-bg);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

#tab-lista > .card {
    background: transparent;
    box-shadow: none;
    padding: 0;
    margin-bottom: 0;
}

/* Mail Template Tabs (dentro Impostazioni) */
.mail-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.mail-tab-btn {
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.mail-tab-btn:hover {
    color: var(--primary-color);
}

.mail-tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.mail-tab-content {
    display: none;
}

.mail-tab-content.active {
    display: block;
}

/* =============================================================================
   CARDS
   ============================================================================= */

.card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.card .description {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

/* =============================================================================
   STATS GRID (Dashboard)
   ============================================================================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.stat-card.stat-total .stat-value {
    color: var(--primary-color);
}

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

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

.stat-card.stat-info .stat-value {
    color: #6366f1;
}

.stat-card.stat-muted .stat-value {
    color: var(--secondary-color);
}

/* =============================================================================
   PROGRESS BAR
   ============================================================================= */

.progress-card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.progress-header .progress-label {
    font-weight: 600;
    font-size: 1rem;
}

.progress-header .progress-value {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.progress-bar-container {
    background: var(--bg-color);
    border-radius: 8px;
    height: 12px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    border-radius: 8px;
    transition: width 0.6s ease;
    min-width: 0;
}

/* Quick Check Gommista */
.quick-check-card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.quick-check-card .dashboard-section-title {
    margin-top: 0;
}

.quick-check-search {
    margin-bottom: 1rem;
}

.quick-check-search input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
}

.quick-check-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.quick-check-result {
    min-height: 60px;
}

.quick-check-empty {
    color: var(--text-muted);
    font-style: italic;
    padding: 1rem 0;
}

.quick-check-item {
    background: var(--bg-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.5rem;
}

.quick-check-item:last-child {
    margin-bottom: 0;
}

.quick-check-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.quick-check-info {
    flex: 1;
}

.quick-check-code {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.quick-check-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-top: 0.25rem;
}

.quick-check-responses {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.quick-check-response {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.quick-check-response .label {
    color: var(--text-muted);
}

.quick-check-response .value {
    font-weight: 600;
}

.quick-check-response .value.si {
    color: var(--success-color);
}

.quick-check-response .value.no {
    color: var(--error-color);
}

.quick-check-response .value.nd {
    color: var(--text-muted);
}

.quick-check-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.quick-check-actions .btn {
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
}

/* =============================================================================
   DATA TABLE (Lista Gommisti)
   ============================================================================= */

.table-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.table-search {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.table-search input {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
}

.table-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.table-filter select {
    padding: 0.625rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--card-bg);
    cursor: pointer;
}

.table-filter select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.batch-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.batch-actions select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85rem;
    background: var(--card-bg);
}

.data-table-wrapper {
    overflow-x: auto;
    margin-bottom: 1rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table .cell-email {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-table th {
    text-align: left;
    padding: 0.75rem 0.625rem;
    background: #f8fafc;
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.data-table td {
    padding: 0.625rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

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

.data-table th:first-child,
.data-table td:first-child {
    width: 40px;
    text-align: center;
}

.data-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* =============================================================================
   EXPAND BUTTON & DETAIL ROWS
   ============================================================================= */

.btn-expand {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    padding: 0.125rem 0.375rem;
    color: var(--text-muted);
    transition: all 0.15s;
    vertical-align: middle;
    margin-right: 0.375rem;
    line-height: 1;
}

.btn-expand:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-expand.expanded {
    background-color: #e0e7ff;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.detail-placeholder > td {
    padding: 0 !important;
    background-color: #f8fafc;
}

.detail-panel {
    padding: 0.75rem 1rem 0.75rem 2.5rem;
}

.detail-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.detail-table th {
    text-align: left;
    padding: 0.375rem 0.5rem;
    background: #eef2f7;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-table td {
    padding: 0.375rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

/* Larghezze fisse colonne detail-table */
.detail-table th:nth-child(1),
.detail-table td:nth-child(1) { width: 140px; } /* Data */
.detail-table th:nth-child(2),
.detail-table td:nth-child(2) { width: 70px; text-align: center; }  /* RENTRI */
.detail-table th:nth-child(3),
.detail-table td:nth-child(3) { width: 70px; text-align: center; }  /* XFIR NP */
.detail-table th:nth-child(4),
.detail-table td:nth-child(4) { width: 70px; text-align: center; }  /* XFIR P */
.detail-table th:nth-child(5),
.detail-table td:nth-child(5) { width: 50px; text-align: center; }  /* Dip. */
.detail-table th:nth-child(6),
.detail-table td:nth-child(6) { width: 70px; text-align: center; }  /* Override */
.detail-table th:nth-child(7) { text-align: right; padding-right: 0.5rem; }  /* Azioni header */
.detail-table td:nth-child(7) { text-align: right; }  /* Azioni */

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

.detail-row-latest {
    background-color: #f0fdf4;
}

.detail-row-annullata {
    background-color: #fef2f2;
    opacity: 0.7;
}

.detail-row-annullata td {
    text-decoration: line-through;
    color: var(--text-muted);
}

.detail-row-annullata .badge,
.detail-row-annullata .detail-actions {
    text-decoration: none;
}

.detail-actions {
    white-space: nowrap;
}

.detail-actions .btn {
    margin-right: 0.25rem;
}

.detail-row-trasportatori {
    background-color: #fefce8;
}

.detail-row-trasportatori:hover {
    background-color: #fef9c3 !important;
}

.mail-trasportatori-info {
    font-size: 0.8rem;
    padding: 0.25rem 0;
}

.mail-trasportatori-label {
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    text-align: left;
    padding-left: 0;
}

.mail-trasportatori-list {
    padding-left: 1.5rem;
}

.mail-trasportatore-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.1rem 0;
}

.mail-status-icon {
    font-weight: bold;
}

.mail-status-ok .mail-status-icon {
    color: var(--success-color);
}

.mail-status-error .mail-status-icon {
    color: var(--error-color);
}

.mail-data {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.detail-loading,
.detail-empty,
.detail-error {
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.detail-error {
    color: var(--error-color);
}

/* =============================================================================
   RITAGLIO MODAL
   ============================================================================= */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0 0.25rem;
    line-height: 1;
}

.modal-close:hover {
    color: var(--error-color);
}

.modal-body {
    padding: 1rem 1.25rem;
    overflow: auto;
    max-height: 80vh;
    text-align: center;
}

.ritaglio-image {
    max-width: 100%;
    max-height: 75vh;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* =============================================================================
   BADGES
   ============================================================================= */

.badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-muted {
    background-color: #f1f5f9;
    color: var(--text-muted);
}

.badge-error {
    background-color: #fee2e2;
    color: #dc2626;
}

/* =============================================================================
   EDITABLE CELLS
   ============================================================================= */

.editable-cell {
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.15s;
    min-width: 50px;
    display: inline-block;
}

.editable-cell:hover {
    background-color: #e0e7ff;
}

.editable-cell .cell-value {
    font-size: 0.85rem;
}

.editable-cell .cell-empty {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.8rem;
}

.inline-select {
    padding: 0.25rem 0.375rem;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    font-size: 0.85rem;
    background: white;
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* =============================================================================
   PAGINATION
   ============================================================================= */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0;
}

.pagination button {
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s;
}

.pagination button:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination button.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination .page-info {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0 0.5rem;
}

/* =============================================================================
   AUTO-REMINDER STATUS
   ============================================================================= */

.status-rows {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.status-row:last-child {
    border-bottom: none;
}

.status-row .status-label {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.status-row .status-value {
    font-weight: 600;
    font-size: 0.9rem;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.active {
    background-color: var(--success-color);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

.status-dot.inactive {
    background-color: var(--text-muted);
}

/* =============================================================================
   BULK RESULT DISPLAY
   ============================================================================= */

.bulk-result {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

.bulk-result.result-success {
    background-color: #d1fae5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.bulk-result.result-partial {
    background-color: #fef3c7;
    border: 1px solid #fde68a;
    color: #92400e;
}

.bulk-result.result-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.bulk-result .result-summary {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.bulk-result .result-details {
    font-size: 0.85rem;
    max-height: 150px;
    overflow-y: auto;
}

/* =============================================================================
   BULK PROGRESS DISPLAY
   ============================================================================= */

.bulk-progress {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
}

.bulk-progress .progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #0369a1;
    font-weight: 500;
}

.bulk-progress .progress-bar-container {
    width: 100%;
    height: 20px;
    background-color: #e0f2fe;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.bulk-progress .progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0ea5e9, #0284c7);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.bulk-progress .progress-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.85rem;
}

.bulk-progress .stat-success {
    color: #059669;
    font-weight: 500;
}

.bulk-progress .stat-error {
    color: #dc2626;
    font-weight: 500;
}

.bulk-progress .stat-skipped {
    color: #d97706;
    font-weight: 500;
}

/* =============================================================================
   STRUMENTI CARDS
   ============================================================================= */

.strumento-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.strumento-card .strumento-body {
    flex: 1;
    min-width: 200px;
}

.strumento-card .strumento-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.strumento-card .strumento-actions input[type="number"] {
    width: 80px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
}

/* =============================================================================
   PLACEHOLDER HELP
   ============================================================================= */

.placeholder-help {
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.placeholder-help strong {
    display: block;
    margin-bottom: 0.5rem;
}

.placeholder-help code {
    display: inline-block;
    background-color: var(--placeholder-bg);
    color: var(--placeholder-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-right: 0.5rem;
    margin-bottom: 0.25rem;
}

.placeholder-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.placeholder-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: var(--placeholder-color);
    border: 1px solid #f59e0b;
    padding: 0.5rem 0.875rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(245, 158, 11, 0.2);
}

.placeholder-tag .tag-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background-color: var(--placeholder-color);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    line-height: 1;
}

.placeholder-tag:hover {
    background: linear-gradient(135deg, #fde68a 0%, #fbbf24 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(245, 158, 11, 0.3);
}

.placeholder-tag:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(245, 158, 11, 0.2);
}

/* =============================================================================
   PREVIEW
   ============================================================================= */

.preview-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.preview-section h4 {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.preview-box {
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    min-height: 80px;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.preview-box .placeholder {
    display: inline-block;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: var(--placeholder-color);
    padding: 0.25rem 0.625rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid #f59e0b;
    vertical-align: middle;
}

/* =============================================================================
   FILE ACTIONS
   ============================================================================= */

.file-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.file-status {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.file-status.success {
    color: var(--success-color);
}

.file-status.error {
    color: var(--error-color);
}

/* =============================================================================
   FORM ACTIONS
   ============================================================================= */

.form-actions {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.download-link-hint {
    font-size: 0.85rem;
    color: #6c757d;
    margin: 0;
    text-align: center;
}

.download-link-hint a {
    color: #0d6efd;
    text-decoration: none;
}

.download-link-hint a:hover {
    text-decoration: underline;
}

/* =============================================================================
   TOAST
   ============================================================================= */

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-weight: 500;
    z-index: 1000;
    transition: opacity 0.3s, transform 0.3s;
}

.toast.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(1rem);
    pointer-events: none;
}

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

.toast.error {
    background-color: var(--error-color);
    color: white;
}

/* =============================================================================
   LOGO PREVIEW (ADMIN)
   ============================================================================= */

.logo-preview-container {
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    text-align: center;
}

.logo-preview-container img {
    max-width: 200px;
    max-height: 100px;
    object-fit: contain;
}

/* =============================================================================
   QUESTIONARIO PAGE
   ============================================================================= */

.questionario-page {
    min-height: 100vh;
    background-color: var(--bg-color);
    padding: 2rem 1rem;
}

.questionario-container {
    max-width: 600px;
    margin: 0 auto;
}

.questionario-header {
    text-align: center;
    margin-bottom: 2rem;
}

.questionario-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.ragione-sociale {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 500;
}

.logo-container {
    margin-bottom: 1.5rem;
}

.logo-container img {
    max-width: 200px;
    max-height: 80px;
    object-fit: contain;
}

.questionario-content .card {
    margin-bottom: 1.5rem;
}

.card-actions {
    margin-top: 1rem;
}

.file-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Error, Success and Warning Cards */
.error-container,
.success-container,
.token-expired-container {
    text-align: center;
}

.error-card {
    border-left: 4px solid var(--error-color);
}

.error-card h2 {
    color: var(--error-color);
}

.success-card {
    border-left: 4px solid var(--success-color);
}

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

.warning-card {
    border-left: 4px solid var(--warning-color);
}

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

.warning-card p {
    margin-bottom: 1rem;
}

.warning-card .card-actions {
    margin-top: 1.5rem;
}

/* Loading */
.loading-container {
    text-align: center;
    padding: 3rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-container p {
    color: var(--text-muted);
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* Utility classes */
.table-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.card-actions-center {
    margin-top: 1rem;
    text-align: center;
}

.ml-2 {
    margin-left: 0.5rem;
}

.text-muted {
    color: var(--text-muted);
}

/* Preferenze - toggle row */
.pref-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.pref-row p {
    margin: 0.25rem 0 0;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    min-width: 52px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    border-radius: 28px;
    transition: 0.3s;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary-color);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

/* Info box - informational message */
.info-box {
    background-color: #e0f2fe;
    border: 1px solid #7dd3fc;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    color: #0369a1;
}

.info-box p {
    margin: 0;
    font-size: 0.875rem;
}

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

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .data-table {
        font-size: 0.8rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem 0.375rem;
    }
}

@media (max-width: 768px) {
    .tab-nav {
        border-radius: 12px 12px 0 0;
    }

    .tab-content.active {
        border-radius: 0 0 12px 12px;
    }

    .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

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

    .table-search {
        min-width: unset;
    }

    .batch-actions {
        flex-wrap: wrap;
    }

    .strumento-card {
        flex-direction: column;
    }

    .detail-panel {
        padding: 0.75rem;
    }

    .detail-loading, .detail-empty, .detail-error {
        padding: 0.75rem;
    }
}

@media (max-width: 640px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .card {
        padding: 1.25rem;
    }

    .file-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .file-actions .btn {
        width: 100%;
    }

    .questionario-page {
        padding: 1rem;
    }

    .questionario-header h1 {
        font-size: 1.5rem;
    }

    .stat-card .stat-value {
        font-size: 2rem;
    }

    .modal-content {
        max-width: 98vw;
        max-height: 95vh;
        margin: 0.5rem;
        border-radius: 8px;
    }
}

/* =============================================================================
   LOG TAB STYLES
   ============================================================================= */

.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--bg-light);
    border-radius: 8px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.875rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.filter-group select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background-color: white;
}

.pagination-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

#log-pagination-info {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Badge per esito log */
.log-esito {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.log-esito.ok {
    background-color: #d1fae5;
    color: #065f46;
}

.log-esito.errore {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Badge per tipo log */
.log-tipo {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.log-tipo.email { background-color: #dbeafe; color: #1e40af; }
.log-tipo.accesso { background-color: #fef3c7; color: #92400e; }
.log-tipo.dichiarazione { background-color: #d1fae5; color: #065f46; }
.log-tipo.admin { background-color: #e0e7ff; color: #3730a3; }
.log-tipo.sistema { background-color: #f3e8ff; color: #6b21a8; }
.log-tipo.errore { background-color: #fee2e2; color: #991b1b; }

/* Dettagli log troncati */
.log-dettagli {
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.log-dettagli:hover {
    white-space: normal;
    overflow: visible;
    position: relative;
    z-index: 10;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    padding: 0.5rem;
    border-radius: 4px;
}

/* =============================================================================
   OVERRIDE MODAL STYLES
   ============================================================================= */

.override-detail {
    padding: 0.5rem 0;
}

.override-detail p {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.override-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.override-table th,
.override-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.override-table th {
    background-color: var(--bg-light);
    font-weight: 600;
    color: var(--text-color);
}

.override-table tr.override-changed {
    background-color: rgba(255, 193, 7, 0.1);
}

.override-table tr.override-changed td:nth-child(2) {
    color: var(--text-muted);
    text-decoration: line-through;
}

.override-table tr.override-changed td:nth-child(3) {
    color: var(--warning-color);
    font-weight: 600;
}

/* =============================================================================
   MAIL E ANNULLA MODAL STYLES
   ============================================================================= */

.modal-large {
    max-width: 700px;
    width: 95%;
}

.mail-annulla-form .form-group {
    margin-bottom: 1rem;
}

.mail-annulla-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-color);
}

.mail-annulla-form .form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
}

.mail-annulla-form .form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.mail-annulla-form .form-control[readonly] {
    background-color: var(--bg-light);
    color: var(--text-muted);
}

.mail-annulla-form textarea.form-control {
    resize: vertical;
    min-height: 150px;
}

.mail-annulla-form .placeholder-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.mail-annulla-form .placeholder-info code {
    background-color: var(--bg-light);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.85em;
}

.mail-annulla-form .text-muted {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.mail-annulla-form .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.mail-annulla-form .form-group-checkbox {
    margin-top: 0.5rem;
}

.mail-annulla-form .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
    cursor: pointer;
}

.mail-annulla-form .checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

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

.btn-warning:hover {
    background-color: #e0a800;
}

/* =============================================================================
   MODAL INSERISCI DICHIARAZIONE
   ============================================================================= */

.modal-large {
    width: 600px;
    max-width: 95vw;
}

.modal-large .modal-body {
    text-align: left;
}

/* Risultati ricerca gommista */
.risultati-ricerca {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 0.5rem;
}

.risultato-gommista {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.risultato-gommista:hover {
    background-color: #f0f9ff;
    border-color: var(--primary-color);
}

.risultato-gommista-info {
    flex: 1;
}

.risultato-gommista-nome {
    font-weight: 600;
    font-size: 0.95rem;
}

.risultato-gommista-dettagli {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.risultati-vuoti {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Info gommista selezionato */
.gommista-selezionato-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.gommista-info-box {
    flex: 1;
    background: #f0f9ff;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    border: 1px solid #bae6fd;
}

.gommista-info-box strong {
    display: block;
    font-size: 1rem;
}

.gommista-info-box .text-muted {
    font-size: 0.85rem;
}

/* Validation container (duplicato da questionario per admin) */
.validation-container {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

.validation-loading {
    text-align: center;
    padding: 1.5rem;
}

.validation-results {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.validation-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.status-item label {
    font-weight: 500;
    margin: 0;
    font-size: 0.9rem;
}

.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

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

.status-warning {
    background: #fff3cd;
    color: #856404;
}

.status-unknown {
    background: #e2e3e5;
    color: #6c757d;
}

.risposte-preview {
    padding: 1rem;
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.risposte-preview h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: #495057;
}

.risposte-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.risposta-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0.75rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.risposta-item label {
    font-size: 0.8rem;
    margin: 0;
    color: #495057;
    flex: 1;
}

.risposta-value {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.risposta-si {
    background: #d4edda;
    color: #155724;
}

.risposta-no {
    background: #f8d7da;
    color: #721c24;
}

.risposta-unknown {
    background: #e2e3e5;
    color: #6c757d;
}

/* Override lettura automatica */
.override-section {
    margin-top: 1rem;
    text-align: center;
}

.btn-override {
    background: none;
    border: none;
    color: #0d6efd;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-override:hover {
    color: #0a58ca;
}

.override-check {
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.override-check input {
    margin-right: 4px;
    cursor: pointer;
}

.risposta-value.editable {
    cursor: pointer;
    border: 1px dashed #0d6efd;
    border-radius: 4px;
    user-select: none;
}

.risposta-value.editable:hover {
    background: #e7f1ff;
}

/* Avviso token */
.avviso-token {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #856404;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.avviso-token .avviso-icon {
    font-size: 1.1rem;
}

/* File hint */
.file-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Form group per modal */
.modal-body .form-group {
    margin-bottom: 1rem;
}

.modal-body .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.modal-body .form-group input[type="text"],
.modal-body .form-group input[type="number"],
.modal-body .form-group input[type="file"] {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
}

.modal-body .form-group input[type="text"]:focus,
.modal-body .form-group input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Loading spinner */
.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Filtri Lista Dichiarazioni */
.filtri-dichiarazioni {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.filtri-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.filtro-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filtro-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.filtro-group input[type="text"],
.filtro-group select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    min-width: 150px;
}

.filtro-group input[type="text"]:focus,
.filtro-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filtro-group .btn {
    margin-top: 0;
}

/* Tabella dichiarazioni */
#dichiarazioni-table .detail-actions {
    white-space: nowrap;
}

#dichiarazioni-table .detail-actions .btn {
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

.result-count {
    margin-top: 1rem;
    padding-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Separazione gruppi dichiarazioni */
.dich-group-end td {
    border-bottom: 2px solid #cbd5e1;
}

/* Pulsante Info (Modifica) */
.btn-info {
    background-color: #0ea5e9;
    color: white;
    border: none;
}

.btn-info:hover {
    background-color: #0284c7;
}

/* Rimuovi sottolineatura dai link-bottone e uniforma altezza */
a.btn {
    text-decoration: none;
    display: inline-block;
    line-height: 1.4;
    vertical-align: baseline;
    box-sizing: border-box;
}

/* Modal Modifica Risposte */
.modal-small {
    max-width: 500px;
    width: 95vw;
}

.modal-small .modal-body {
    text-align: left;
}

/* Form controls nel modal trasportatori */
#form-trasportatore .form-group {
    margin-bottom: 1rem;
}

#form-trasportatore select.form-control,
#form-trasportatore input.form-control {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    box-sizing: border-box;
}

#form-trasportatore select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
    cursor: pointer;
}

#form-trasportatore select.form-control:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

#form-trasportatore label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.modifica-info {
    background: #f8fafc;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    border: 1px solid var(--border-color);
}

.modifica-info-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.modifica-info-row:last-child {
    margin-bottom: 0;
}

.modifica-info-label {
    font-weight: 500;
    color: var(--text-muted);
    min-width: 120px;
}

.modifica-info-value {
    color: var(--text-color);
}

/* ============================================
   DASHBOARD EXTENDED
   ============================================ */

.dashboard-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.5rem 0 1rem 0;
    color: var(--text-color);
}

/* Distribution Grid */
.distribution-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
    .distribution-grid {
        grid-template-columns: 1fr;
    }
}

.distribution-card {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
}

.distribution-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    color: var(--text-color);
    text-align: center;
}

.distribution-bars {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.distribution-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.15s;
}

.distribution-row.clickable {
    cursor: pointer;
}

.distribution-row.clickable:hover {
    background-color: #f1f5f9;
}

.distribution-label {
    width: 30px;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.distribution-bar-container {
    flex: 1;
    height: 20px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.distribution-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.distribution-bar-fill.bar-si {
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

.distribution-bar-fill.bar-no {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.distribution-count {
    width: 40px;
    text-align: right;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-color);
}

/* Ultime Dichiarazioni */
.ultime-dichiarazioni-card {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.ultime-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.ultime-table th {
    text-align: left;
    padding: 0.5rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
}

.ultime-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

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

.ultime-table .risposta-badge {
    font-size: 0.75rem;
    padding: 0.15rem 0.4rem;
}

/* =============================================================================
   TRASPORTATORI
   ============================================================================= */

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-header-row h2 {
    margin: 0;
}

.link-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #f8fafc;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.link-box code {
    flex: 1;
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--primary-color);
    word-break: break-all;
}

.link-box input {
    flex: 1;
    font-family: monospace;
    font-size: 0.85rem;
    border: none;
    background: transparent;
    color: var(--primary-color);
}

.header-email {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin-right: 1rem;
}

.actions-cell {
    white-space: nowrap;
}

.actions-cell .btn {
    margin-right: 0.25rem;
}

.actions-cell .btn:last-child {
    margin-right: 0;
}

#trasp-email-custom {
    margin-top: 0.5rem;
}
