@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    /* macOS Premium Light Glassmorphism Palette */
    --bg-primary: #f0f2f5;
    
    --text-primary: #1d1d1f; /* Apple Carbon */
    --text-secondary: #515154; /* Slate Muted Text */
    --text-muted: #86868b;
    
    --primary: #0071e3; /* Apple Blue Accent */
    --primary-hover: #0077ed;
    --primary-glow: rgba(0, 113, 227, 0.12);
    
    --success: #34c759; /* Apple Green */
    --success-glow: rgba(52, 199, 89, 0.15);
    
    --warning: #ff9500; /* Apple Orange */
    --warning-glow: rgba(255, 149, 0, 0.15);
    
    --danger: #ff3b30; /* Apple Red */
    --danger-glow: rgba(255, 59, 48, 0.15);
    
    --sidebar-width: 260px;
    --topbar-height: 70px;
    
    --font-sans: 'Inter', sans-serif;
    --font-title: 'Outfit', sans-serif;
    
    /* Apple Premium Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.08);
    
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background: radial-gradient(at 0% 0%, rgba(244, 245, 247, 1) 0, transparent 50%),
                radial-gradient(at 50% 0%, rgba(224, 235, 255, 0.8) 0, transparent 50%),
                radial-gradient(at 100% 0%, rgba(243, 233, 255, 0.8) 0, transparent 50%),
                #f0f2f5;
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Layout Amministrativo */
.admin-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Glassmorphic Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-logo {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-logo h1 {
    font-family: var(--font-title);
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, #0071e3 0%, #00b4d8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.8px;
}

.sidebar-menu {
    list-style: none;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: var(--transition-fast);
}

.sidebar-link:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.035);
}

.sidebar-link.active {
    background: rgba(0, 113, 227, 0.08);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-profile-summary {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role-badge {
    font-size: 10px;
    font-weight: 700;
    color: #495057;
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    width: fit-content;
    text-transform: uppercase;
}

/* Main Content Area */
.main-wrapper {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Glassmorphic Topbar */
.topbar {
    height: var(--topbar-height);
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    padding: 0 40px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.content-body {
    padding: 40px;
    flex-grow: 1;
}

/* Breadcrumb Navigation */
.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.breadcrumb-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition-fast);
}

.breadcrumb-nav a:hover {
    color: var(--primary);
}

.breadcrumb-separator {
    color: var(--text-muted);
}

.breadcrumb-active {
    color: var(--text-primary);
    font-weight: 500;
}

/* Header di Pagina */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.page-title {
    font-family: var(--font-title);
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -1px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* Glassmorphic Premium Cards */
.card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    padding: 28px;
    box-shadow: var(--shadow-md);
    margin-bottom: 28px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(0,0,0,0.08);
}

.card-title {
    font-family: var(--font-title);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
    letter-spacing: -0.3px;
}

/* Premium Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 22px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 12px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #0071e3 0%, #00b4d8 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 113, 227, 0.2);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(0, 113, 227, 0.35);
}

.btn-secondary {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-primary);
    border: 1px solid rgba(0, 0, 0, 0.05);
}
.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.08);
}

.btn-danger {
    background: linear-gradient(135deg, #ff3b30 0%, #ff7b5a 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(255, 59, 48, 0.2);
}
.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(255, 59, 48, 0.35);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 12px;
    border-radius: 8px;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background-color: rgba(0, 0, 0, 0.02);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 16px 20px;
    border-bottom: 2px solid rgba(0,0,0,0.06);
    text-align: left;
}

.table td {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    color: var(--text-primary);
    font-size: 14px;
}

.table tr:hover {
    background-color: rgba(0, 113, 227, 0.02);
}

/* Badges */
.badge {
    display: inline-flex;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-active {
    background-color: var(--success-glow);
    color: #1a7f37;
    border: 1px solid rgba(52, 199, 89, 0.2);
}

.badge-inactive {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
}

.badge-completed {
    background-color: var(--primary-glow);
    color: var(--primary);
    border: 1px solid rgba(0, 113, 227, 0.2);
}

/* Griglia Statistiche / KPI Dashboard */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
    font-family: var(--font-title);
    letter-spacing: -0.5px;
}

/* Liste Elementi Dashboard (Aziende, Progetti) */
.item-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.015);
    border: 1px solid rgba(0, 0, 0, 0.03);
    border-radius: 14px;
    transition: all 0.2s ease;
}

.item-row:hover {
    background: rgba(0, 113, 227, 0.025);
    border-color: rgba(0, 113, 227, 0.1);
    transform: translateX(4px);
}

.item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.item-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

.item-name:hover {
    color: var(--primary);
}

.item-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Inputs and Forms */
.form-group {
    margin-bottom: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    font-family: var(--font-sans);
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #d2d2d7;
    border-radius: 12px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s ease-in-out;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
    background-color: #ffffff;
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* Tabs */
.tabs-header {
    display: flex;
    gap: 6px;
    background-color: rgba(0, 0, 0, 0.05);
    padding: 6px;
    border-radius: 14px;
    margin-bottom: 32px;
    width: fit-content;
}

.tab-btn {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    background-color: #ffffff;
    color: var(--text-primary);
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Logout Button */
.logout-btn {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(255, 59, 48, 0.2);
    border-radius: 10px;
    padding: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--danger);
    cursor: pointer;
    text-align: center;
    transition: var(--transition-fast);
}

.logout-btn:hover {
    background-color: var(--danger-glow);
    border-color: rgba(255, 59, 48, 0.4);
}

/* Center Centered Public Layout */
.public-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: radial-gradient(at 0% 0%, rgba(240, 242, 245, 1) 0, transparent 60%),
                radial-gradient(at 100% 0%, rgba(219, 234, 254, 0.8) 0, transparent 60%),
                #e5e8eb;
    padding: 40px 20px;
}

.public-container {
    width: 100%;
    max-width: 780px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

.login-card {
    width: 100%;
    max-width: 440px;
    padding: 48px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    font-family: var(--font-title);
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, #0071e3 0%, #00b4d8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
    margin-bottom: 6px;
}

/* Alerts */
.alert {
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 13px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

.alert-danger {
    background-color: var(--danger-glow);
    color: #ff3b30;
    border: 1px solid rgba(255, 59, 48, 0.25);
}

.alert-success {
    background-color: var(--success-glow);
    color: #34c759;
    border: 1px solid rgba(52, 199, 89, 0.25);
}

/* Public Questionnaire Form Styles */
.q-header {
    text-align: center;
    margin-bottom: 48px;
}

.q-title {
    font-family: var(--font-title);
    font-size: 38px;
    font-weight: 800;
    margin-bottom: 14px;
    color: var(--text-primary);
    letter-spacing: -1px;
}

.q-desc {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.q-section {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 24px;
    padding: 40px;
    margin-bottom: 36px;
    box-shadow: var(--shadow-lg);
}

.q-section-title {
    font-family: var(--font-title);
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--primary);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    padding-bottom: 16px;
}

.q-section-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.5;
}

.q-question {
    margin-bottom: 32px;
}

.q-question-text {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    letter-spacing: -0.2px;
}

.q-required-mark {
    color: var(--danger);
    margin-left: 2px;
}

/* Opzioni Scelta Multipla / Singola */
.options-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background-color: rgba(0, 0, 0, 0.025);
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 14px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.option-card:hover {
    background-color: rgba(0, 0, 0, 0.06);
    transform: translateX(2px);
}

.option-card input[type="radio"], .option-card input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

.option-card span {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 600;
}

/* Scale di Valutazione */
.scale-wrapper {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.scale-btn {
    flex: 1;
    min-width: 44px;
    height: 52px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.025);
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    transition: var(--transition-fast);
}

.scale-btn:hover {
    background-color: rgba(0, 0, 0, 0.06);
    transform: scale(1.05);
}

.scale-btn.active {
    background: rgba(0, 113, 227, 0.1);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.2);
}

.scale-btn input[type="radio"] {
    display: none;
}

/* Matrici di Risposta */
.matrix-container {
    width: 100%;
    overflow-x: auto;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(0, 0, 0, 0.01);
}

.matrix-table {
    width: 100%;
    border-collapse: collapse;
}

.matrix-table th, .matrix-table td {
    padding: 16px;
    text-align: center;
    font-size: 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.matrix-table th {
    background-color: rgba(0, 0, 0, 0.03);
    font-weight: 700;
    color: var(--text-secondary);
}

.matrix-table th:first-child, .matrix-table td:first-child {
    text-align: left;
    font-weight: 600;
    padding-left: 20px;
}

.matrix-table tr:hover {
    background-color: rgba(0, 113, 227, 0.025);
}

.matrix-table input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}
