:root {
    --color-primary: #19598c;
    /* Official GardaVision Blue */
    --color-primary-hover: #144770;
    --color-bg: #e9ecef;
    /* Slightly darker to reduce glare */
    --color-surface: #ffffff;
    --color-text: #323338;
    --color-text-muted: #676879;
    --color-border: #e6e9ef;

    --color-todo: #e2445c;
    /* DA FARE */
    --color-review: #fdab3d;
    /* COMPLETATO */
    --color-done: #00c875;
    /* APPROVATO */

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --radius-sm: 4px;
    --radius-md: 8px;

    --sidebar-width: 240px;
}

/* Dark Mode Variables */
body.dark-mode {
    --color-bg: #18191c;
    --color-card-bg: #25272b;
    --color-text: #fff;
    --color-text-muted: #c5c7d0;
    --color-border: #3d3f42;
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.dark-mode .sidebar {
    background: #111214;
}

body.dark-mode .top-bar {
    background: #111214;
    border-bottom-color: #3d3f42;
}

body.dark-mode .card {
    background: #25272b;
    border: 1px solid #3d3f42;
}

body.dark-mode tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

body.dark-mode tbody tr:nth-child(even) {
    background-color: #1e2024;
    /* Darker stripe for visibility */
}

body.dark-mode .modal {
    background: #25272b;
    color: #fff;
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    background: #18191c;
    border-color: #3d3f42;
    color: #fff;
}

body.dark-mode .btn-outline {
    border-color: #3d3f42;
    color: #c5c7d0;
}

body.dark-mode #approvalAlert {
    background: #1b2e1b !important;
    border-color: #2e7d32 !important;
    color: #81c784 !important;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Figtree', sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    overflow-x: hidden;
}

h1,
h2,
h3 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: #2b2c32;
    /* Dark sidebar like monday.com */
    color: #fff;
    padding: 24px 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    padding: 0 24px;
    margin-bottom: 32px;
}

.sidebar-logo img {
    max-width: 150px;
    height: auto;
}

.sidebar-nav {
    flex-grow: 1;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: #c5c7d0;
    text-decoration: none;
    transition: background 0.2s;
    font-size: 14px;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background-color: #3d3e4b;
    color: #fff;
}

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.top-bar {
    height: 64px;
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

.content-area {
    padding: 32px;
    overflow-y: auto;
}

/* Modern Components */
.card {
    background-color: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
}

.btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-size: 14px;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.btn-outline:hover {
    background-color: var(--color-bg);
}

/* Custom Action Buttons */
.btn-logout {
    background: rgba(255, 77, 77, 0.1);
    color: #ff6b6b;
    border: 1px solid rgba(255, 77, 77, 0.2);
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px;
    border-radius: 50px;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: rgba(255, 77, 77, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 77, 77, 0.2);
}

.btn-success-action {
    background-color: var(--color-done);
    color: white;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-success-action:hover {
    background-color: #00b368;
    /* Slightly darker green */
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 200, 117, 0.3);
}

.btn-approve {
    background-color: var(--color-done);
    color: white;
    border: none;
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 4px;
    /* Standard small radius */
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-approve:hover {
    background-color: #00b368;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Unread Task Indicator */
.task-unread {
    border: 2px dashed var(--color-todo) !important;
    position: relative;
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0% {
        border-color: rgba(226, 68, 92, 0.4);
    }

    50% {
        border-color: rgba(226, 68, 92, 1);
    }

    100% {
        border-color: rgba(226, 68, 92, 0.4);
    }
}

/* Mobile Nav Badge */
.nav-icon-container {
    position: relative;
    display: inline-block;
}

.mobile-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--color-todo);
    color: white;
    border-radius: 50%;
    width: 6px;
    height: 6px;
    font-size: 0;
    border: 1px solid white;
}

/* Interactive Admin Badge */
.badge-hover-approve .hover-text {
    display: none;
}

.badge-hover-approve:hover {
    background-color: var(--color-done) !important;
    /* Green on hover */
    color: white !important;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 200, 117, 0.4);
    transition: all 0.2s ease;
}

.badge-hover-approve:hover .normal-text {
    display: none;
}

.badge-hover-approve:hover .hover-text {
    display: inline;
    font-weight: 800;
}


.status-badge {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-DA_FARE {
    background-color: #ffe5e9;
    color: var(--color-todo);
}

.status-COMPLETATO {
    background-color: #fff5e5;
    color: var(--color-review);
}

.status-APPROVATO {
    background-color: #e5f9f1;
    color: var(--color-done);
}

/* Deadline Urgency Classes */
.deadline-safe {
    background-color: var(--color-done);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.deadline-warning {
    background-color: var(--color-review);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.deadline-urgent {
    background-color: var(--color-todo);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

/* Table styles */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
}

tbody tr:nth-child(even) {
    background-color: #f1f3f5;
    /* Slightly darker grey for better visibility */
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    /* Controlled by JS or CSS classes */
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: #fff;
    padding: 32px;
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-md);
}

/* Slick Form Inputs (App-Like) */
.form-group {
    margin-bottom: 24px;
    position: relative;
    width: 100%;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--color-text-muted);
    font-size: 14px;
    transition: color 0.2s;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="date"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    background: #f9fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    color: var(--color-text);
    transition: all 0.2s ease;
    outline: none;
    font-family: 'Figtree', sans-serif;
    -webkit-appearance: none;
    /* Remove default styling on iOS */
    appearance: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    background: #ffffff;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(25, 89, 140, 0.1);
}

/* Custom Select Arrow */
.form-group:has(select)::after {
    content: '\f078';
    /* FontAwesome Chevron Down */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    right: 16px;
    top: 48px;
    /* Adjusted for label height */
    color: var(--color-text-muted);
    pointer-events: none;
    font-size: 14px;
}

/* Dark Mode Adjustments for Inputs */
body.dark-mode .form-group input,
body.dark-mode .form-group textarea,
body.dark-mode .form-group select {
    background: #2c2d33;
    border-color: #3d3e4b;
    color: #fff;
}

body.dark-mode .form-group input:focus,
body.dark-mode .form-group textarea:focus,
body.dark-mode .form-group select:focus {
    background: #32333e;
    border-color: var(--color-primary);
}

/* iOS-Style Switch Toggle */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-switch {
    display: inline-block;
    height: 28px;
    position: relative;
    width: 50px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: #ccc;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    background-color: #fff;
    bottom: 4px;
    content: "";
    height: 20px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 20px;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
    background-color: var(--color-primary);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

/* Dark mode adjustment for slider background if needed */
body.dark-mode .slider {
    background-color: #4a4b52;
}

body.dark-mode input:checked+.slider {
    background-color: var(--color-primary);
}

/* Calendar View */
.calendar-container {
    background: white;
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.calendar-header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--color-border);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.calendar-col-header {
    background: var(--color-bg);
    padding: 12px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    color: var(--color-text-muted);
    text-transform: uppercase;
}

.calendar-day {
    background: white;
    min-height: 120px;
    padding: 8px;
    position: relative;
    transition: background 0.2s;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calendar-day:hover {
    background: #fbfbfb;
}

.calendar-day.today {
    background: #f0f7ff;
}

.calendar-day.empty {
    background: #f9f9f9;
}

.calendar-date-number {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--color-text-muted);
    text-align: right;
}

.calendar-day.today .calendar-date-number {
    color: var(--color-primary);
    font-weight: 800;
}

.calendar-task-chip {
    display: block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: transform 0.1s;
    cursor: pointer;
}

.calendar-task-chip:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

.chip-urgent {
    background-color: var(--color-todo);
}

.chip-normal {
    background-color: var(--color-primary);
}

.chip-done {
    background-color: var(--color-done);
    color: white;
    opacity: 0.8;
    font-weight: 500;
}

.chip-completed {
    background-color: var(--color-review);
    color: white;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 900px) {
    .calendar-container {
        overflow-x: auto;
    }

    .calendar-grid {
        min-width: 700px;
        /* Ensure days are readable, forcing scroll */
    }

    .sidebar {
        width: 64px;
        padding: 16px 0;
    }

    .sidebar-logo,
    .sidebar-nav span {
        display: none;
    }

    .sidebar-nav a {
        justify-content: center;
        padding: 16px 0;
    }
}

@media (max-width: 600px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        padding: 8px;
    }

    .sidebar-nav {
        display: flex;
        width: 100%;
        justify-content: space-around;
    }

    .sidebar-nav a {
        justify-content: center;
        padding: 16px 0;
    }
}

/* Notification Dropdown */
.notif-dropdown {
    position: absolute;
    top: 60px;
    right: 24px;
    width: 360px;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: none;
    /* Hidden by default */
    max-height: 500px;
    display: flex;
    flex-direction: column;
}

.notif-dropdown.show {
    display: flex;
    /* Show as flex when active */
}

/* Header Bell Icon */
.notification-bell {
    position: relative;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(var(--color-primary-rgb), 0.1);
    /* fallback */
    background: #e4e6eb;
    /* Facebook-like grey */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    color: #000;
    font-size: 18px;
}

body.dark-mode .notification-bell {
    background: #3a3b3c;
    /* Dark mode Facebook grey */
    color: #e4e6eb;
}

.notification-bell:hover {
    background: #d8dadf;
}

body.dark-mode .notification-bell:hover {
    background: #4e4f50;
}

/* Red Dot Badge */
.notif-badge-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e41e3f;
    color: white;
    font-size: 11px;
    font-weight: bold;
    height: 18px;
    min-width: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--color-bg);
    padding: 0 4px;
}

/* Dropdown Content */
.notif-header {
    padding: 16px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notif-title {
    font-size: 20px;
    font-weight: 700;
}

.notif-list {
    overflow-y: auto;
    max-height: 400px;
}

.notif-item {
    padding: 12px 16px;
    display: flex;
    gap: 12px;
    align-items: center;
    cursor: pointer;
    border-radius: 8px;
    margin: 4px 8px;
    transition: background 0.2s;
}

.notif-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.dark-mode .notif-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.notif-icon-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

padding: 8px;
}

.content-area {
    padding: 16px;
}
}