/* Stili per POS Generator */

:root {
    --primary-color: #0066cc;
    --secondary-color: #f8f9fa;
    --text-color: #333;
    --border-color: #ddd;
    --success-color: #28a745;
    --danger-color: #dc3545;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    overflow: hidden;
}

.header {
    background: var(--primary-color);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    border: 2px solid white;
    display: inline-block;
}

.btn-logout:hover {
    background: white;
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255,255,255,0.3);
}

.wizard-container {
    padding: 40px;
}

.wizard-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    position: relative;
}

.wizard-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border-color);
    z-index: 0;
}

.wizard-step {
    flex: 1;
    text-align: center;
    position: relative;
    z-index: 1;
}

.wizard-step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin: 0 auto;
    transition: all 0.3s;
}

.wizard-step.active .wizard-step-number {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.wizard-step.completed .wizard-step-number {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.wizard-step-title {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #666;
}

.wizard-step.active .wizard-step-title {
    color: var(--primary-color);
    font-weight: bold;
}

.wizard-content {
    min-height: 400px;
}

.step-content {
    display: none;
}

.step-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

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

.btn-primary:hover {
    background: #0052a3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 102, 204, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

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

.btn-success:hover {
    background: #218838;
}

.wizard-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.category-section {
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.category-header {
    background: var(--secondary-color);
    padding: 15px 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-header:hover {
    background: #e9ecef;
}

.category-header > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-select-all, .btn-deselect-all {
    padding: 5px 12px;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: normal;
}

.btn-select-all:hover {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.btn-deselect-all:hover {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

.category-content {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.activity-checkbox {
    display: flex;
    align-items: flex-start;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    transition: all 0.3s;
}

.activity-checkbox:hover {
    background: var(--secondary-color);
    border-color: var(--primary-color);
}

.activity-checkbox input[type="checkbox"] {
    margin-right: 10px;
    margin-top: 3px;
}

.activity-checkbox label {
    cursor: pointer;
    flex: 1;
}

.activity-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.activity-description {
    font-size: 0.85rem;
    color: #666;
}

.soggetto-group {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--secondary-color);
}

.soggetto-group h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.soggetto-select {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
}

.soggetto-option {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

.soggetto-option:hover {
    border-color: var(--primary-color);
    background: #f0f7ff;
}

/* Evidenziazione scadenze nel wizard */
.soggetto-option.worker-row-expired {
    background: #fff5f5;
    border-left: 4px solid #dc3545;
}

.soggetto-option.worker-row-expiring {
    background: #fffef5;
    border-left: 4px solid #ffc107;
}

.soggetto-option.worker-row-expired:hover {
    background: #ffe5e5;
}

.soggetto-option.worker-row-expiring:hover {
    background: #fffce5;
}

.soggetto-option input {
    margin-right: 8px;
}

.review-section {
    margin-bottom: 30px;
}

.review-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

.review-item {
    padding: 10px;
    margin-bottom: 10px;
    background: var(--secondary-color);
    border-radius: 5px;
}

.review-item strong {
    display: inline-block;
    min-width: 150px;
}

.loading {
    text-align: center;
    padding: 40px;
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.alert {
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.hidden {
    display: none !important;
}

/* PDF Viewer */
#viewerSection {
    animation: fadeIn 0.5s;
}

#pdfViewer {
    background: #525659;
}

.viewer-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.pdf-container {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    background: #525659;
}

/* Tabs Navigation */
.tabs-navigation {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid var(--border-color);
}

.tab-button {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.tab-button:hover {
    background: #e9ecef;
    color: var(--primary-color);
}

.tab-button.active {
    color: var(--primary-color);
    background: white;
    border-bottom: 3px solid var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

/* Tabelle Archivi */
.archive-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 0.9rem;
}

.archive-table th {
    background: var(--primary-color);
    color: white;
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.archive-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

.archive-table tr:hover {
    background: var(--secondary-color);
}

.archive-table tbody tr {
    transition: background 0.2s;
}

/* Badge scadenze */
.badge-scaduto {
    background: #dc3545;
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: bold;
}

.badge-in-scadenza {
    background: #ffc107;
    color: #333;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: bold;
}

.badge-valido {
    background: #28a745;
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: bold;
}

/* Evidenziazione righe lavoratori */
.worker-row-expired {
    background: #f8d7da !important;
    border-left: 4px solid #dc3545;
}

.worker-row-expiring {
    background: #fff3cd !important;
    border-left: 4px solid #ffc107;
}

.worker-row-valid {
    background: #d4edda !important;
    border-left: 4px solid #28a745;
}

/* Certificazioni display */
.cert-item {
    display: inline-block;
    margin: 3px;
    padding: 4px 8px;
    background: #e9ecef;
    border-radius: 4px;
    font-size: 0.85rem;
}

.cert-item.scaduto {
    background: #f8d7da;
    border: 1px solid #dc3545;
}

.cert-item.in-scadenza {
    background: #fff3cd;
    border: 1px solid #ffc107;
}

/* Azioni tabella */
.action-buttons {
    display: flex;
    gap: 5px;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.85rem;
}

.btn-edit {
    background: #17a2b8;
    color: white;
}

.btn-edit:hover {
    background: #138496;
}

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

.btn-delete:hover {
    background: #c82333;
}

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

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 1;
}

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

.modal-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Modal Fullscreen per Wizard */
.modal-fullscreen {
    z-index: 2000;
}

.modal-content-fullscreen {
    max-width: 95%;
    width: 1400px;
    max-height: 95vh;
    padding: 20px;
}

/* POS Cards */
.pos-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.pos-card {
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    background: white;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
}

.pos-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 5px 15px rgba(0, 102, 204, 0.2);
    transform: translateY(-2px);
}

.pos-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.pos-card-id {
    background: var(--primary-color);
    color: white;
    padding: 5px 12px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 0.9rem;
}

.pos-card-date {
    font-size: 0.85rem;
    color: #666;
}

.pos-card-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 8px;
}

.pos-card-subtitle {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
}

.pos-card-info {
    display: flex;
    gap: 15px;
    font-size: 0.9rem;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.pos-card-info-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pos-card-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.pos-card-actions button {
    flex: 1;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state h3 {
    color: #333;
    margin-bottom: 10px;
}

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

.btn-danger:hover {
    background: #c82333;
}

/* Responsive */
@media (max-width: 768px) {
    .wizard-steps {
        flex-wrap: wrap;
    }

    .wizard-step {
        flex-basis: 20%;
        margin-bottom: 20px;
    }

    .wizard-step-title {
        font-size: 0.75rem;
    }

    .category-content,
    .soggetto-select {
        grid-template-columns: 1fr;
    }
}
