/**
 * GESTIONE RIDERS - CSS Module
 * PizzaFactory 2.0
 */

/* ===== MODAL CONTAINER ===== */
.modal-riders {
    max-width: 1000px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
}

/* ===== HEADER ===== */
.modal-header-riders {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: 3px solid rgba(255, 255, 255, 0.2);
}

.modal-header-riders .header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.modal-header-riders h2 {
    margin: 0;
    font-size: 1.5em;
    font-weight: 700;
}

.modal-header-riders .subtitle {
    font-size: 0.9em;
    opacity: 0.9;
}

.modal-header-riders .btn-close {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    font-size: 2em;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-header-riders .btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* ===== TOOLBAR ===== */
.riders-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: white;
    border-bottom: 1px solid #e9ecef;
}

.riders-toolbar .btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.riders-toolbar .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.toolbar-spacer {
    flex: 1;
}

.search-box {
    position: relative;
    width: 300px;
}

.search-box input {
    width: 100%;
    padding: 10px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ===== BODY ===== */
.modal-body-riders {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #f8f9fa;
}

/* ===== RIDERS GRID ===== */
.riders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* ===== RIDER CARD ===== */
.rider-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all 0.2s ease;
    position: relative;
}

.rider-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-color: #667eea;
}

.rider-card.disattivato {
    opacity: 0.6;
    background: #f8f9fa;
}

.rider-card.disattivato::before {
    content: "🔴 DISATTIVATO";
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 0.7em;
    font-weight: 700;
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
}

/* Card Header */
.rider-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rider-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    font-weight: 700;
}

.rider-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rider-nome {
    font-size: 1.2em;
    font-weight: 700;
    color: #212529;
}

.rider-status {
    font-size: 0.85em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.rider-status.attivo {
    color: #28a745;
}

.rider-status.inattivo {
    color: #dc3545;
}

/* Contatti */
.rider-contatti {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.rider-contatti .contatto {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: #495057;
}

.rider-contatti .icon {
    font-size: 1.2em;
}

/* Statistiche */
.rider-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.rider-stats .stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.stat-label {
    font-size: 0.75em;
    color: #6c757d;
    font-weight: 600;
    text-transform: uppercase;
}

.stat-value {
    font-size: 1.1em;
    font-weight: 700;
    color: #212529;
}

/* Azioni */
.rider-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #e9ecef;
}

.btn-action {
    flex: 1;
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: white;
    font-size: 1.3em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-action:hover {
    transform: scale(1.05);
}

.btn-action.btn-edit:hover {
    background: #667eea;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-action.btn-delete:hover {
    background: #dc3545;
    border-color: #dc3545;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.btn-action.btn-restore:hover {
    background: #28a745;
    border-color: #28a745;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* ===== LOADING & EMPTY STATES ===== */
.loading-state,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-height: 300px;
    color: #6c757d;
    grid-column: 1 / -1;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e9ecef;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===== MODAL FORM RIDER ===== */
.modal-form-rider {
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: white;
}

.modal-header-form {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: 3px solid rgba(255, 255, 255, 0.2);
}

.modal-header-form h3 {
    margin: 0;
    font-size: 1.3em;
    font-weight: 700;
}

.modal-header-form .btn-close {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    font-size: 2em;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-header-form .btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-body-form {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* ===== FORM STYLES ===== */
#form-rider {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #212529;
    font-size: 0.95em;
}

.form-group label .icon {
    font-size: 1.2em;
}

.form-group label .required {
    color: #dc3545;
    font-weight: 700;
}

.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="email"] {
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-hint {
    font-size: 0.85em;
    color: #6c757d;
    font-style: italic;
}

/* Toggle Switch */
.toggle-wrapper {
    display: flex;
    align-items: center;
}

.toggle-input {
    display: none;
}

.toggle-label {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.toggle-switch {
    width: 52px;
    height: 28px;
    background: #dc3545;
    border-radius: 14px;
    position: relative;
    transition: all 0.3s ease;
    margin-right: 12px;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: all 0.3s ease;
}

.toggle-input:checked + .toggle-label .toggle-switch {
    background: #28a745;
}

.toggle-input:checked + .toggle-label .toggle-switch::after {
    left: 27px;
}

.toggle-text-off,
.toggle-text-on {
    font-weight: 600;
    font-size: 0.9em;
}

.toggle-text-off {
    color: #dc3545;
}

.toggle-text-on {
    color: #28a745;
}

.toggle-input:not(:checked) + .toggle-label .toggle-text-on {
    display: none;
}

.toggle-input:checked + .toggle-label .toggle-text-off {
    display: none;
}

/* Rider Ruolo */
.rider-ruolo {
    font-size: 0.85em;
    color: #6c757d;
    font-weight: 600;
    margin: 2px 0;
}

/* Rider Stipendio nella Card */
.rider-stipendio {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
    margin: 12px 0;
}

.stipendio-title {
    font-weight: 700;
    font-size: 0.9em;
    color: #495057;
    margin-bottom: 8px;
    text-align: center;
}

.stipendio-dettagli {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stipendio-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.stipendio-item:not(:last-child) {
    border-bottom: 1px solid #dee2e6;
}

.stipendio-item.mensile {
    margin-top: 6px;
    padding-top: 8px;
    border-top: 2px solid #28a745;
    font-weight: 700;
}

.stipendio-item .label {
    color: #6c757d;
    font-size: 0.85em;
}

.stipendio-item .value {
    color: #28a745;
    font-weight: 700;
    font-size: 0.95em;
}

.stipendio-item.mensile .value {
    font-size: 1.1em;
}

/* Avatar Picker */
.avatar-picker {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.avatar-preview {
    width: 80px;
    height: 80px;
    font-size: 3.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 3px solid #007bff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,123,255,0.2);
    transition: all 0.3s ease;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    flex: 1;
}

.avatar-emoji {
    width: 48px;
    height: 48px;
    font-size: 1.8em;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-emoji:hover {
    background: #e9ecef;
    border-color: #007bff;
    transform: scale(1.1);
}

.avatar-emoji.selected {
    background: #007bff;
    border-color: #0056b3;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,123,255,0.3);
}

/* Stipendio Info Box */
.stipendio-info-box {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 16px;
    margin-top: 8px;
}

.stipendio-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.stipendio-row:not(:last-child) {
    border-bottom: 1px solid #dee2e6;
}

.stipendio-row.mensile {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 2px solid #28a745;
    font-weight: 700;
    font-size: 1.1em;
}

.stipendio-row .label {
    color: #6c757d;
    font-weight: 600;
}

.stipendio-row .value {
    color: #28a745;
    font-weight: 700;
    font-size: 1.1em;
}

.stipendio-row.mensile .value {
    font-size: 1.3em;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.form-actions .btn-cancel {
    flex: 1;
    padding: 12px 24px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: white;
    color: #6c757d;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.form-actions .btn-cancel:hover {
    background: #f8f9fa;
    border-color: #dc3545;
    color: #dc3545;
}

.form-actions .btn-save {
    flex: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.form-actions .btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .riders-grid {
        grid-template-columns: 1fr;
    }

    .search-box {
        width: 100%;
    }

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

    .toolbar-spacer {
        display: none;
    }
}
