:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #38bdf8; /* Blue for Voucher */
    --accent-gradient: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
    --danger-color: #f43f5e; /* Red for Overtime */
    --success-color: #10b981;
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow-premium: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

html {
    max-width: 100vw;
    overflow-x: hidden;
}

body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    font-family: 'Outfit', sans-serif;
}

.app-container {
    width: 100%;
    max-width: 900px;
    padding: 2rem;
    animation: fadeIn 0.8s ease-out;
}

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

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    backdrop-filter: blur(10px);
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-premium);
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    font-size: 2rem;
}

h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.current-info {
    text-align: right;
}

#current-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

#current-time {
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--accent-color);
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

#display-user {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--accent-color);
}

.btn-micro {
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
    transition: all 0.2s;
}

.btn-micro:hover {
    background: var(--accent-color);
    color: #fff;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.badge {
    background: var(--accent-gradient);
    font-size: 0.6rem;
    padding: 2px 8px;
    border-radius: 8px;
    vertical-align: middle;
    margin-left: 4px;
}

.bank-dashboard-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bank-stat {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    justify-content: center;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 16px;
    transition: background 0.2s ease;
}

.bank-stat:hover {
    background: rgba(255, 255, 255, 0.05);
}

.badge-action {
    background: var(--button-bg);
    color: var(--text-secondary);
    font-size: 0.55rem;
    padding: 2px 6px;
    border-radius: 6px;
    margin-left: 6px;
    vertical-align: middle;
    border: 1px solid var(--glass-border);
}

.bank-icon {
    font-size: 2rem;
    background: rgba(255,255,255,0.05);
    padding: 10px;
    border-radius: 16px;
}

.bank-info {
    display: flex;
    flex-direction: column;
}

.bank-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.bank-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent-color);
}

.bank-value.negative {
    color: var(--danger-color);
}

.bank-divider {
    width: 2px;
    height: 60px;
    background: var(--glass-border);
}

main {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    body {
        padding: 10px 5px;
        overflow-x: hidden;
    }

    .app-container {
        padding: 0.5rem;
        width: 100%;
        max-width: 100vw;
    }

    main {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        width: 100%;
        max-width: 100%;
    }
    
    header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 20px;
        width: 100%;
    }
    
    .current-info {
        text-align: center;
    }

    .bank-dashboard-card {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1rem;
        margin-bottom: 1rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .bank-divider {
        width: 100%;
        height: 2px;
    }

    .status-card, 
    .today-details, 
    .calendar-section {
        width: 100%;
        max-width: 100%;
        padding: 1rem;
        border-radius: 20px;
        box-sizing: border-box;
    }

    #work-duration {
        font-size: 2rem;
    }

    .btn-stamp {
        width: 160px;
        height: 160px;
    }

    #stamp-text {
        font-size: 1.6rem;
    }

    .voucher-summary {
        flex-wrap: wrap;
        justify-content: space-around;
        padding: 0.8rem;
        gap: 0.5rem;
    }

    .summary-divider {
        display: none;
    }

    .summary-item {
        align-items: center;
        width: 45%;
        text-align: center;
    }

    .summary-value {
        font-size: 0.95rem;
    }

    .summary-label {
        font-size: 0.6rem;
    }

    .calendar-grid {
        gap: 0.2rem;
    }
    
    .calendar-day {
        aspect-ratio: auto;
        min-height: 75px;
        font-size: 0.8rem;
        padding: 6px 2px;
        border-radius: 12px;
        justify-content: flex-start;
    }
    
    .day-hours {
        font-size: 0.6rem;
        letter-spacing: -0.02em;
        margin-top: 4px;
    }
    
    .day-overtime {
        font-size: 0.5rem;
    }
    
    .calendar-grid-header {
        font-size: 0.65rem;
        gap: 0.2rem;
        margin-bottom: 0.5rem;
    }

    .day-dot {
        width: 6px;
        height: 6px;
        top: 4px;
        right: 4px;
    }

    .calendar-controls {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Area Timbratura */
.stamp-area {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
}

.status-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    text-align: center;
    width: 100%;
    box-shadow: var(--shadow-premium);
}

#status-label {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.5rem;
}

#work-duration {
    font-size: 2.5rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.stamp-buttons-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
    max-width: 500px;
}

.btn-stamp {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: none;
    background: var(--accent-gradient);
    color: white;
    position: relative;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 40px -10px rgba(56, 189, 248, 0.5);
    z-index: 1;
    flex-shrink: 0;
}

.btn-stamp.btn-smart {
    background: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%);
    box-shadow: 0 10px 40px -10px rgba(168, 85, 247, 0.5);
}

.btn-stamp.btn-smart:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 50px -10px rgba(217, 70, 239, 0.7);
}

.btn-stamp.btn-smart.smart-active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 10px 40px -10px rgba(16, 185, 129, 0.6);
}

#smart-text {
    font-size: 1.1rem;
    font-weight: 800;
    text-align: center;
    line-height: 1.2;
}

#smart-subtext {
    opacity: 0.85;
    font-size: 0.75rem;
    margin-top: 4px;
    text-align: center;
}

.day-smart-tag {
    font-size: 0.6rem;
    background: rgba(168, 85, 247, 0.25);
    color: #e9d5ff;
    border: 1px solid rgba(168, 85, 247, 0.5);
    border-radius: 6px;
    padding: 1px 4px;
    margin-top: 2px;
    display: inline-block;
}

.day-voucher-tag {
    font-size: 0.6rem;
    background: rgba(56, 189, 248, 0.18);
    color: #7dd3fc;
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-radius: 6px;
    padding: 1px 4px;
    margin-top: 2px;
    display: inline-block;
    font-weight: 600;
}

.btn-stamp:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 50px -10px rgba(56, 189, 248, 0.7);
}

.btn-stamp:active {
    transform: scale(0.95);
}

.btn-stamp.clocked-in {
    background: linear-gradient(135deg, #f43f5e 0%, #fb7185 100%);
    box-shadow: 0 10px 40px -10px rgba(244, 63, 94, 0.5);
}

.btn-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

#stamp-text {
    font-size: 1.8rem;
    font-weight: 800;
}

#stamp-subtext {
    opacity: 0.8;
    font-size: 0.75rem;
    margin-top: 4px;
}

.btn-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background: inherit;
    filter: blur(20px);
    opacity: 0.4;
    z-index: -1;
    transition: opacity 0.4s;
}

.today-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    width: 100%;
}

.detail-item {
    text-align: center;
    flex: 1;
}

.detail-item label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.detail-item span {
    font-weight: 600;
    font-size: 1.1rem;
}

.detail-separator {
    width: 1px;
    height: 30px;
    background: var(--glass-border);
    margin: 0 1rem;
}

/* Sezione Calendario */
.calendar-section {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 32px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(10px);
}

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

.btn-icon {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.calendar-controls {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.voucher-summary {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 0.75rem 1.5rem;
    border-radius: 16px;
    gap: 1.5rem;
}

.summary-item {
    display: flex;
    flex-direction: column;
}

.summary-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.summary-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-color);
}

.summary-divider {
    width: 1px;
    height: 25px;
    background: var(--glass-border);
}



.btn-secondary {
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 0.6rem 1.2rem;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-secondary:hover {
    background: var(--accent-color);
    color: var(--bg-color);
}

.calendar-grid-header {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.5rem;
}

.calendar-day {
    min-height: 80px;
    background: var(--button-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 8px 4px 4px 4px;
    position: relative;
    overflow: hidden;
}

.calendar-day:hover:not(.empty) {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.05);
    z-index: 2;
}

.calendar-day.today {
    border-color: var(--accent-color);
    background: rgba(56, 189, 248, 0.1);
}

.calendar-day.worked {
    background: rgba(16, 185, 129, 0.1);
}

.day-num {
    font-weight: 600;
    margin-bottom: 2px;
}

.day-hours {
    font-size: 0.6rem;
    opacity: 0.7;
}

.day-overtime {
    font-size: 0.55rem;
    color: var(--danger-color);
    font-weight: 600;
    margin-top: 2px;
}

.day-permission {
    font-size: 0.55rem;
    color: var(--accent-color);
    font-weight: 600;
    margin-top: 2px;
}

.dots-container {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 2px;
}

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

.day-dot.voucher {
    background: var(--accent-color);
    box-shadow: 0 0 6px rgba(56,189,248,0.5);
}

.day-dot.overtime {
    background: var(--danger-color);
    box-shadow: 0 0 8px rgba(244, 63, 94, 0.6);
}

.day-dot.smart {
    background: #a855f7;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.6);
}

/* Legenda */
.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--glass-border);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot.voucher {
    background: var(--accent-color);
    box-shadow: 0 0 8px var(--accent-color);
}

.dot.overtime {
    background: var(--danger-color);
    box-shadow: 0 0 8px var(--danger-color);
}

.dot.smart {
    background: #a855f7;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.6);
}

/* Notifica */
.notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--success-color);
    color: white;
    padding: 1rem 2rem;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    display: none;
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

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

.notification.show {
    display: block;
}

/* Stampa */
.print-only {
    display: none;
}

@media print {
    @page {
        margin: 0.5cm;
    }
    body {
        background: white;
        color: black;
        display: block;
        font-size: 10pt; /* Default print font size */
    }
    .app-container {
        display: none;
    }
    .print-only {
        display: block;
        padding: 0;
    }
    #print-area h2 {
        font-size: 14pt;
        margin-bottom: 0.3cm;
        text-align: center;
        color: black;
    }
    table {
        width: 100%;
        border-collapse: collapse;
        margin-top: 0.2cm;
        font-size: 9pt; /* Smaller font for table to fit 31 rows */
    }
    th, td {
        border: 1px solid #000;
        padding: 3px 2px;
        text-align: center;
    }
    th {
        background-color: #f0f0f0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    tfoot {
        font-weight: bold;
        background-color: #fafafa !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    padding: 2.5rem;
    border-radius: 32px;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-premium);
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
}

.modal-content h3 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

#modal-date-display {
    color: var(--accent-color);
    margin-bottom: 2rem;
    font-weight: 600;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.form-group input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.8rem;
    color: white;
    font-family: inherit;
    font-size: 1.1rem;
    transition: all 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

.modal-content.login-style {
    max-width: 450px;
    text-align: center;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 600;
}

.calendar-day:not(.empty) {
    cursor: pointer;
}
