/* CSS Principale per Portale Agricolo Agrimaggiore (Bio-Tech Theme) */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --primary: #15803d; /* Verde Foresta */
    --primary-hover: #166534;
    --primary-light: rgba(21, 128, 61, 0.08);
    --secondary: #d97706; /* Oro/Ambra */
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: rgba(15, 23, 42, 0.08);
    --border-focus: #15803d;
    --shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05), 0 2px 8px -1px rgba(0, 0, 0, 0.03);
    --font: 'Outfit', sans-serif;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

[data-theme="dark"] {
    --background: #090d16;
    --card-bg: #111827;
    --text: #f3f4f6;
    --text-muted: #9ca3af;
    --border: rgba(243, 244, 246, 0.08);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: var(--font);
    background-color: var(--background);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Sidebar Navigation (Desktop) */
.sidebar {
    width: 280px;
    background-color: var(--card-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2rem 1.5rem;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 10;
    box-shadow: var(--shadow);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.logo-text {
    font-weight: 900;
    font-size: 1.25rem;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    color: var(--text-muted);
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.nav-item a:hover, .nav-item.active a {
    color: var(--primary);
    background-color: var(--primary-light);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    color: var(--text-muted);
    background: none;
    border: none;
    font-family: var(--font);
    font-weight: 600;
    font-size: 1rem;
    width: 100%;
    cursor: pointer;
    border-radius: var(--radius-sm);
    text-align: left;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    color: #ef4444;
    background-color: rgba(239, 68, 68, 0.08);
}

/* Mobile Bottom Navigation */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-t: 1px solid var(--border);
    z-index: 30;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .mobile-nav {
    background-color: rgba(17, 24, 39, 0.85);
}

.mobile-nav-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    height: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.mobile-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 8px;
    font-weight: 600;
    gap: 4px;
}

.mobile-nav-link.active {
    color: var(--primary);
    transform: scale(1.1);
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    margin-left: 280px;
    padding: 3rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: relative;
}

/* Headers */
.section-tag {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.section-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-top: 2px;
}

.section-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Cards & Containers */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Forms & Inputs */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-control {
    height: 52px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background-color: rgba(15, 23, 42, 0.02);
    padding: 0 1rem;
    font-family: var(--font);
    font-size: 1rem;
    color: var(--text);
    outline: none;
    transition: all 0.2s ease;
    width: 100%;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.15);
    background-color: var(--card-bg);
}

textarea.form-control {
    height: auto;
    padding: 1rem;
}

/* Custom Checkbox/Switch */
.switch-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background-color: var(--primary-light);
    border: 1px solid rgba(21, 128, 61, 0.15);
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
}

/* Buttons */
.btn {
    height: 52px;
    padding: 0 1.5rem;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    outline: none;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(21, 128, 61, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-muted {
    background-color: var(--border);
    color: var(--text);
}

.btn-muted:hover {
    background-color: rgba(15, 23, 42, 0.12);
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.08);
    color: #ef4444;
}

.btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.15);
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.875rem;
}

th {
    background-color: rgba(15, 23, 42, 0.02);
    padding: 1rem 1.5rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: rgba(15, 23, 42, 0.01);
}

/* Modals */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 40;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow-y: auto;
}

/* Tab systems */
.tab-switcher {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    background-color: rgba(15, 23, 42, 0.03);
    border: 1px solid var(--border);
    padding: 6px;
    border-radius: var(--radius-md);
    max-width: 400px;
    margin-bottom: 1.5rem;
}

.tab-btn {
    border: none;
    background: none;
    font-family: var(--font);
    font-weight: 700;
    font-size: 0.875rem;
    padding: 0.65rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.tab-btn.active {
    background-color: var(--card-bg);
    color: var(--text);
    box-shadow: var(--shadow);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .mobile-nav {
        display: block;
    }
    
    .main-wrapper {
        margin-left: 0;
        padding: 1.5rem;
        padding-bottom: 80px; /* Space for bottom nav */
    }
}
