/* Font Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap');

:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --header-bg: #f8f9fa;
    --border-color: #e9ecef;
    --primary-color: #007bff;
    --accent-color: #28a745;
    --card-bg: #ffffff;
    --input-bg: #ffffff;
    --table-stripe: #f8f9fa;
    --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --sidebar-width: 250px;
}

body.dark-mode {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --header-bg: #1e1e1e;
    --border-color: #333333;
    --primary-color: #4da3ff;
    --accent-color: #4cd964;
    --card-bg: #1e1e1e;
    --input-bg: #2d2d2d;
    --table-stripe: #252525;
    --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Reset & Base */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    height: 100%;
    width: var(--sidebar-width);
    position: fixed;
    z-index: 1;
    top: 0;
    left: 0;
    background-color: var(--card-bg);
    overflow-x: hidden;
    padding-top: 20px;
    border-right: 1px solid var(--border-color);
    transition: 0.3s;
    box-shadow: var(--box-shadow);
    transform: translateX(-100%);
    /* Hidden by default on mobile or if needed */
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar a {
    padding: 15px 25px;
    text-decoration: none;
    font-size: 1.1em;
    color: var(--text-color);
    display: block;
    transition: 0.3s;
}

.sidebar a:hover {
    background-color: var(--header-bg);
    color: var(--primary-color);
}

.sidebar .closebtn {
    position: absolute;
    top: 5px;
    right: 15px;
    font-size: 30px;
    color: var(--text-color);
    text-decoration: none;
    z-index: 100;
}

.open-btn {
    font-size: 20px;
    cursor: pointer;
    background-color: var(--primary-color);
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 2;
}

.main-content {
    transition: margin-left .3s;
    padding: 20px;
    margin-left: 0;
    width: 100%;
}

.main-content.shifted {
    margin-left: var(--sidebar-width);
}

/* Desktop: Sidebar always visible, no toggle needed usually */
@media (min-width: 769px) {
    .sidebar {
        transform: translateX(0);
        /* Always show on desktop */
    }

    .main-content {
        margin-left: var(--sidebar-width);
        /* Push content */
    }

    .open-btn {
        display: none;
    }

    /* Hide toggle on desktop */
    .sidebar .closebtn {
        display: none;
    }
}

/* Mobile: Sidebar toggle */
@media (max-width: 768px) {
    .main-content.shifted {
        margin-left: 0;
        /* Overlay mode */
    }
}


/* Layout Elements */
.logo-container {
    text-align: center;
    margin-bottom: 30px;
    padding: 0 10px;
}

.logo-img {
    width: 100px;
    height: 100px;
    object-fit: contain;
}

.theme-toggle-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: var(--box-shadow);
    z-index: 1000;
    font-weight: 600;
    transition: all 0.3s;
}

.theme-toggle-btn:hover {
    background: var(--border-color);
}

/* Headings */
h1,
h2,
h3 {
    font-weight: 600;
    margin-top: 0;
}

h1 {
    color: var(--primary-color);
}

/* Forms */
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: var(--input-bg);
    color: var(--text-color);
    font-family: inherit;
}

button,
.button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: opacity 0.2s;
    display: inline-block;
    text-align: center;
}

button:hover,
.button:hover {
    opacity: 0.9;
    text-decoration: none;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: var(--card-bg);
}

th,
td {
    border: 1px solid var(--border-color);
    padding: 12px;
    text-align: left;
}

th {
    background-color: var(--header-bg);
    font-weight: 600;
}

tr:nth-child(even) {
    background-color: var(--table-stripe);
}

/* Links */
a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Cards / Boxes */
.box,
.card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.d-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Status Colors */
.status-risposto {
    color: var(--accent-color);
    font-weight: bold;
}

.status-attesa {
    color: orange;
    font-weight: bold;
}

/* HR */
hr {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 20px 0;
}