/* Reset e Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}

/* Header */
header {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    font-weight: 300;
}

.datetime {
    font-size: 0.9rem;
    opacity: 0.9;
}

#current-time {
    font-weight: bold;
    font-size: 1.1rem;
}

/* Navigation */
nav {
    display: flex;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

.nav-btn {
    flex: 1;
    padding: 15px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.nav-btn:hover {
    background: #e0e0e0;
}

.nav-btn.active {
    background: white;
    border-bottom-color: #2196F3;
    color: #2196F3;
    font-weight: bold;
}

/* Pages */
.page {
    display: none;
    padding: 20px;
    min-height: calc(100vh - 140px);
}

.page.active {
    display: block;
}

/* Status Card */
.status-card {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.status-card.active {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
}

#current-status {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 8px;
}

#current-shift-info {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Shifts Container */
.shifts-container h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #555;
}

#shifts-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

/* Action buttons container */
.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.action-buttons .shift-btn {
    flex: 1;
    min-width: 0; /* Previene overflow del contenuto */
    width: calc(50% - 7.5px); /* 50% meno metà del gap */
}

.shift-btn {
    padding: 18px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

.shift-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

.shift-btn.show-all {
    background: linear-gradient(135deg, #9C27B0, #7B1FA2);
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.3);
}

.shift-btn.show-all:hover {
    box-shadow: 0 6px 20px rgba(156, 39, 176, 0.4);
}

.shift-btn.overtime {
    background: linear-gradient(135deg, #FF5722, #D84315);
    box-shadow: 0 4px 15px rgba(255, 87, 34, 0.3);
}

.shift-btn.overtime:hover {
    box-shadow: 0 6px 20px rgba(255, 87, 34, 0.4);
}

/* Stati dei turni */
.shift-btn.status-active {
    background: linear-gradient(135deg, #4CAF50, #388E3C);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    border: 2px solid #4CAF50;
}

.shift-btn.status-active:hover {
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.shift-btn.status-ending-soon {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
    border: 2px solid #FF9800;
}

.shift-btn.status-ending-soon:hover {
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
}

.shift-btn.status-starting-soon {
    background: linear-gradient(135deg, #03A9F4, #0288D1);
    box-shadow: 0 4px 15px rgba(3, 169, 244, 0.3);
    border: 2px solid #03A9F4;
}

.shift-btn.status-starting-soon:hover {
    box-shadow: 0 6px 20px rgba(3, 169, 244, 0.4);
}

.shift-btn.status-recently-ended {
    background: linear-gradient(135deg, #9E9E9E, #616161);
    box-shadow: 0 4px 15px rgba(158, 158, 158, 0.3);
    opacity: 0.8;
}

.shift-btn.status-recently-ended:hover {
    box-shadow: 0 6px 20px rgba(158, 158, 158, 0.4);
    opacity: 1;
}

/* End Shift Button */
.end-shift-btn {
    width: 100%;
    padding: 20px;
    border: none;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
    transition: all 0.3s ease;
}

.end-shift-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.4);
}

/* Configuration Page */
/* Accordion Styles */
.accordion {
    max-width: 100%;
}

.accordion-item {
    margin-bottom: 10px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.accordion-header {
    padding: 20px;
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: all 0.3s ease;
}

.accordion-header:hover {
    background: linear-gradient(135deg, #1976D2, #1565C0);
    transform: translateY(-1px);
}

.accordion-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: bold;
}

.accordion-icon {
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.accordion-item.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accordion-item.active .accordion-content {
    max-height: 80vh; /* 80% dell'altezza viewport per adattarsi a diverse dimensioni schermo */
    overflow-y: auto; /* Scroll verticale se necessario */
    /* Stili per lo scrolling più bello */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling su iOS */
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: #ccc transparent; /* Firefox */
}

/* Stili scrollbar per Webkit (Chrome, Safari) */
.accordion-item.active .accordion-content::-webkit-scrollbar {
    width: 6px;
}

.accordion-item.active .accordion-content::-webkit-scrollbar-track {
    background: transparent;
}

.accordion-item.active .accordion-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.accordion-item.active .accordion-content::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.accordion-body {
    padding: 20px;
}

.placeholder-text {
    color: #888;
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 2px dashed #ddd;
}

.config-form {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.config-form h3, .config-form h4 {
    margin-bottom: 20px;
    color: #555;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #2196F3;
}

.config-form button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.config-form button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

/* Shifts List */
.shifts-list h3 {
    margin-bottom: 15px;
    color: #555;
}

.shift-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid #2196F3;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.shift-info {
    flex: 1;
}

.shift-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.shift-time {
    color: #666;
    font-size: 0.9rem;
}

.delete-shift {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: #f44336;
    color: white;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.delete-shift:hover {
    background: #d32f2f;
}

/* Test Data Section */
.test-data-section {
    background: #fff3e0;
    padding: 20px;
    border-radius: 12px;
    margin-top: 30px;
    border-left: 4px solid #FF9800;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.test-data-section h3 {
    margin-bottom: 10px;
    color: #E65100;
}

.database-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.control-group {
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.control-group h4 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 1.1rem;
}

.control-group p {
    margin: 0 0 12px 0;
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
}

.test-data-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.test-data-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

.reset-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reset-btn.danger {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

.reset-btn.danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
    background: linear-gradient(135deg, #d32f2f, #b71c1c);
}

/* Export/Import Buttons */
.export-import-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.export-btn, .import-btn, .template-btn {
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Template button spans full width on first row */
.template-btn {
    grid-column: 1 / -1;
}

.export-btn {
    background: linear-gradient(135deg, #4CAF50, #388E3C);
    color: white;
}

.export-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    background: linear-gradient(135deg, #388E3C, #2E7D32);
}

.template-btn {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
}

.template-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
    background: linear-gradient(135deg, #F57C00, #E65100);
}

.import-btn {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
}

.import-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
    background: linear-gradient(135deg, #1976D2, #1565C0);
}

.template-hint {
    display: block;
    margin-top: 8px;
    color: #666;
    font-style: italic;
    font-size: 0.85rem;
}

/* Responsive layout per pulsanti export/import */
@media (max-width: 480px) {
    .export-import-buttons {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .template-btn {
        grid-column: 1;
    }
    
    .export-btn, .import-btn, .template-btn {
        font-size: 0.9rem;
        padding: 10px 12px;
        min-height: 44px;
    }
}

/* User Section Styles */
.user-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.backup-credentials {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 15px 0;
}

.backup-credentials .form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.backup-credentials label {
    font-weight: bold;
    color: #333;
    font-size: 0.95rem;
}

.backup-credentials input {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fafafa;
}

.backup-credentials input:focus {
    outline: none;
    border-color: #2196F3;
    background: white;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);
}

.backup-credentials input::placeholder {
    color: #999;
    font-style: italic;
}

.backup-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0 10px 0;
    flex-wrap: wrap;
}

.backup-buttons {
    display: flex;
    gap: 15px;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    margin-bottom: 15px;
}

.backup-btn {
    padding: 18px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #ffffff;
    min-width: 180px;
    flex: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    background: linear-gradient(135deg, #007bff, #0056b3);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.backup-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
    background: linear-gradient(135deg, #0056b3, #004085);
}

.backup-btn#restore-btn {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.backup-btn#restore-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
    background: linear-gradient(135deg, #1e7e34, #155724);
}

.backup-btn.primary {
    background: linear-gradient(135deg, #9C27B0, #7B1FA2);
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.3);
}

.backup-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(156, 39, 176, 0.4);
    background: linear-gradient(135deg, #7B1FA2, #6A1B9A);
}

.backup-btn.secondary {
    background: linear-gradient(135deg, #4CAF50, #388E3C);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.backup-btn.secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
    background: linear-gradient(135deg, #388E3C, #2E7D32);
}

.backup-btn:active {
    transform: translateY(0);
}

.backup-hint {
    display: block;
    margin-top: 15px;
    padding: 12px;
    background: #f8f9fa;
    border-left: 4px solid #673AB7;
    border-radius: 4px;
    color: #555;
    font-size: 0.85rem;
    line-height: 1.4;
}

.backup-hint strong {
    color: #333;
}

/* Responsive per sezione utente */
@media (max-width: 600px) {
    .backup-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .backup-buttons {
        gap: 10px;
        margin: 15px 0;
    }
    
    .backup-btn {
        font-size: 1.5rem;
        padding: 15px;
        min-width: 60px;
        width: auto;
        flex: 1;
        border-radius: 12px;
        aspect-ratio: 1;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .backup-btn .btn-text {
        display: none;
    }
    
    .backup-credentials input {
        font-size: 16px; /* Previene zoom su iOS */
    }
}

@media (min-width: 601px) and (max-width: 768px) {
    .backup-btn {
        font-size: 1rem;
        padding: 16px;
        min-width: 140px;
    }
}

.stats-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
}

.stats-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
    background: linear-gradient(135deg, #F57C00, #EF6C00);
}

/* History Page */
.filter-controls {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.filter-row:last-child {
    margin-bottom: 0;
}

.filter-row label {
    font-weight: bold;
    min-width: 80px;
    color: #333;
}

.filter-controls input,
.filter-controls select {
    flex: 1;
    min-width: 120px;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.filter-controls input:focus,
.filter-controls select:focus {
    outline: none;
    border-color: #2196F3;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.filter-controls button {
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    background: #2196F3;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.filter-controls button:hover {
    background: #1976D2;
    transform: translateY(-1px);
}

/* History Items */
.history-item {
    background: white;
    border-radius: 12px;
    margin-bottom: 15px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.history-header {
    padding: 15px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

.history-date {
    font-weight: bold;
    font-size: 1.1rem;
    color: #333;
}

.history-shift {
    padding: 15px;
}

.shift-title {
    font-weight: bold;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.shift-duration {
    font-size: 0.9rem;
    color: #666;
}

.shift-schedule {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 8px;
    font-style: italic;
    text-align: center;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

/* Sezione motivazioni */
.shift-reasons {
    margin-bottom: 8px;
    padding: 8px;
    background: #fefefe;
    border-radius: 6px;
    border-left: 3px solid #FF9800;
}

.reason-item {
    margin-bottom: 4px;
    font-size: 0.85rem;
    line-height: 1.3;
}

.reason-item:last-child {
    margin-bottom: 0;
}

.reason-label {
    font-weight: 600;
    color: #555;
    display: inline-block;
    margin-right: 6px;
}

.reason-text {
    color: #333;
    font-style: italic;
}

.time-bar {
    height: 50px;
    border-radius: 4px;
    margin: 10px 0;
    display: flex;
    overflow: hidden;
    position: relative;
    background: #f0f0f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.time-segment {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    position: relative;
    min-width: 20px;
}

.time-segment.early {
    background: linear-gradient(135deg, #FF9800, #F57C00);
}

.time-segment.early-justified {
    background: linear-gradient(135deg, #9C27B0, #7B1FA2);
}

.time-segment.late-justified {
    background: linear-gradient(135deg, #f44336, #d32f2f);
}

.time-segment.regular {
    background: linear-gradient(135deg, #4CAF50, #45a049);
}

.time-segment.overtime {
    background: linear-gradient(135deg, #9C27B0, #7B1FA2);
}

.time-segment.overtime-justified {
    background: linear-gradient(135deg, #9C27B0, #7B1FA2);
}

.time-segment.overtime-full {
    background: linear-gradient(135deg, #9C27B0, #7B1FA2);
}

.time-segment.early-exit {
    background: linear-gradient(135deg, #f44336, #d32f2f);
}

/* Time Segments Details */
.segments-details {
    margin: 10px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.85rem;
}

.segment-detail {
    margin-bottom: 5px;
    padding: 5px 0;
    border-left: 3px solid transparent;
    padding-left: 8px;
}

.segment-detail.early {
    border-left-color: #FF9800;
}

.segment-detail.early-justified {
    border-left-color: #9C27B0;
    background: #f3e5f5;
}

.segment-detail.late-justified {
    border-left-color: #f44336;
    background: #ffebee;
}

.segment-detail.regular {
    border-left-color: #4CAF50;
}

.segment-detail.overtime {
    border-left-color: #9C27B0;
    background: #f3e5f5;
}

.segment-detail.overtime-justified {
    border-left-color: #9C27B0;
    background: #f3e5f5;
}

.segment-detail.overtime-full {
    border-left-color: #9C27B0;
    background: #f3e5f5;
}

.segment-detail.early-exit {
    border-left-color: #f44336;
    background: #ffebee;
    border-radius: 4px;
    margin: 2px 0;
}

.segment-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.segment-label {
    font-weight: bold;
    color: #333;
}

.segment-time {
    color: #666;
    font-family: monospace;
}

.segment-duration {
    color: #888;
    font-size: 0.8rem;
}

.time-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #666;
    margin-top: 5px;
}

.reason {
    margin-top: 10px;
    padding: 8px;
    background: #fff3e0;
    border-left: 3px solid #FF9800;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #555;
}

.reason.early-exit {
    background: #f3e5f5;
    border-left-color: #9C27B0;
}

.reason.overtime {
    background: #ffebee;
    border-left-color: #f44336;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    margin-bottom: 15px;
    color: #333;
}

.modal-content p {
    margin-bottom: 15px;
    color: #666;
}

#reason-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    resize: vertical;
    min-height: 80px;
    margin-bottom: 15px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
}

.modal-buttons button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

#reason-confirm {
    background: #4CAF50;
    color: white;
}

#reason-confirm:hover {
    background: #45a049;
}

#reason-cancel {
    background: #f44336;
    color: white;
}

#reason-cancel:hover {
    background: #d32f2f;
}

/* Time Adjustment Modal */
.time-message {
    background: #fff3e0;
    border: 1px solid #FFB74D;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    font-size: 1rem;
    line-height: 1.4;
}

.time-message.early {
    background: #e8f5e8;
    border-color: #81C784;
    color: #2E7D32;
}

.time-message.late {
    background: #ffebee;
    border-color: #EF5350;
    color: #C62828;
}

.time-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 15px 0;
}

.time-btn {
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.time-btn.proceed {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
}

.time-btn.proceed:hover {
    background: linear-gradient(135deg, #1976D2, #1565C0);
    transform: translateY(-1px);
}

.time-btn.correct {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.time-btn.correct:hover {
    background: linear-gradient(135deg, #45a049, #388E3C);
    transform: translateY(-1px);
}

.reason-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.reason-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

.reason-section textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    resize: vertical;
    min-height: 80px;
    margin-bottom: 15px;
    box-sizing: border-box;
}

/* Custom time section */
.custom-time-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.custom-time-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

.custom-time-section input[type="time"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1.1rem;
    margin-bottom: 15px;
    box-sizing: border-box;
    background: #f8f9fa;
    font-family: monospace;
}

.custom-time-section input[type="time"]:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
    background: white;
}

.custom-time-section textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    resize: vertical;
    min-height: 80px;
    margin-bottom: 15px;
    box-sizing: border-box;
}

/* Responsive Design */
@media (max-width: 480px) {
    #app {
        max-width: 100%;
    }
    
    .page {
        padding: 15px;
    }
    
    .filter-controls {
        flex-direction: column;
    }
    
    .filter-controls input,
    .filter-controls button {
        width: 100%;
    }
    
    .shift-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .delete-shift {
        align-self: flex-end;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page.active {
    animation: fadeIn 0.3s ease;
}

/* Notifica di sincronizzazione */
.sync-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: slideInRight 0.3s ease;
}

.sync-notification-content {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sync-icon {
    font-size: 1.2rem;
}

.sync-text {
    font-size: 0.9rem;
    font-weight: 500;
}

.sync-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.sync-close:hover {
    background: rgba(255,255,255,0.2);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading indicator */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.loading::after {
    content: "";
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2196F3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}