/* ========================================
   1. VARIABLES & THEME
   ======================================== */
:root {
  /* Colors */
  --bg-start: #4a5b8f;
  --bg-end: #2a3d5f;
  --bg-overlay: rgba(0, 0, 0, 0.4);
  
  --primary: #5B6FED;
  --primary-hover: #4a5ecf;
  --secondary: rgba(255, 255, 255, 0.1);
  --success: #4cd964;
  --error: #ff6b6b;
  --warning: #f59e0b;
  --info: #32ade6;

  /* Text */
  --text-main: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.75);
  --text-secondary: rgba(255, 255, 255, 0.5);

  /* UI Elements */
  --card-bg: rgba(0, 0, 0, 0.22);
  --glass: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.15);
  --input-bg: rgba(255, 255, 255, 0.08);
  --hover-bg: rgba(255, 255, 255, 0.12);
  
  /* Dimensions & Spacing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --nav-height: 70px;
  --spacing-unit: 20px;

  /* FullCalendar Overrides */
  --fc-page-bg-color: transparent;
  --fc-neutral-bg-color: rgba(255,255,255,0.05);
  --fc-list-event-hover-bg-color: rgba(255,255,255,0.1);
  --fc-border-color: rgba(255,255,255,0.1);
  --fc-today-bg-color: rgba(91, 111, 237, 0.15);

}

/* ========================================
   2. RESET & BASE
   ======================================== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-end) 100%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  padding: 20px;
  /* Padding extra in fondo per non coprire contenuti con la Nav Bar o FABs */
  padding-bottom: 100px; 
  font-size: 15px;
  line-height: 1.5;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  width: 100%;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========================================
   3. TYPOGRAPHY
   ======================================== */
h1, h2, h3, h4 { color: #fff; font-weight: 700; margin-bottom: 10px; line-height: 1.2; }
h1 { font-size: 26px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; font-weight: 600; }

.subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; display: block; }

.section-title, .form-section-title {
  font-size: 13px; font-weight: 700; 
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--primary);
  margin: 25px 0 15px;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 8px;
}

/* ========================================
   4. LAYOUT & GRID
   ======================================== */
.row { display: flex; gap: 12px; margin-bottom: 15px; }
.col { flex: 1; }
.col-2 { flex: 2; }

@media (max-width: 600px) {
  .row { flex-direction: column; gap: 0; }
  .col, .col-2 { width: 100%; margin-bottom: 15px; }
}

.hidden { display: none !important; }
.text-center { text-align: center; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-2 { margin-top: 15px; }
.mb-2 { margin-bottom: 15px; }
.gap-2 { gap: 10px; }

/* ========================================
   5. FORMS & INPUTS
   ======================================== */
.form-group, .input-group { margin-bottom: 20px; width: 100%; }

label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text-muted);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px;
}
label.required::after { content: " *"; color: var(--error); }

input[type="text"], input[type="email"], input[type="password"], 
input[type="number"], input[type="tel"], input[type="url"],
input[type="date"], input[type="time"],
textarea, select {
  width: 100%; padding: 12px 14px;
  background: var(--input-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 16px; font-family: inherit;
  transition: all 0.2s;
}

input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary);
  background: rgba(91, 111, 237, 0.1);
  box-shadow: 0 0 0 3px rgba(91, 111, 237, 0.2);
}

textarea { resize: vertical; min-height: 100px; }
input:disabled, select:disabled, textarea:disabled { opacity: 0.6; cursor: not-allowed; }

select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg fill='white' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.checkbox-group, .radio-group { display: flex; gap: 15px; align-items: center; margin-bottom: 15px; flex-wrap: wrap; }
.checkbox-group label, .radio-group label { text-transform: none; margin: 0; display: flex; align-items: center; gap: 6px; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; accent-color: var(--primary); margin: 0; }

.upload-box, .asset-upload-box {
  border: 2px dashed var(--glass-border); border-radius: var(--radius-md);
  padding: 20px; text-align: center; position: relative;
  background: rgba(0,0,0,0.1); transition: all 0.2s; overflow: hidden; cursor: pointer;
}
.upload-box input[type="file"], .asset-upload-box input[type="file"] {
  position: absolute; width: 100%; height: 100%; top: 0; left: 0; opacity: 0; cursor: pointer; z-index: 10;
}
.upload-icon { font-size: 24px; color: var(--primary); margin-bottom: 8px; }
.upload-box.enabled { border-color: var(--primary); background: rgba(91, 111, 237, 0.1); }
.upload-box.analyzing { border-color: var(--warning); animation: pulse 1.5s infinite; }
.upload-box.success { border-color: var(--success); background: rgba(76, 217, 100, 0.1); }

.tag-input-container {
  background: var(--input-bg); border: 1px solid var(--glass-border);
  border-radius: var(--radius-md); padding: 8px; display: flex; flex-wrap: wrap; gap: 5px;
}
.tag-input-container input { border: none; background: transparent; padding: 5px; flex: 1; outline: none; }
.tag {
  background: var(--primary); color: white; padding: 4px 8px; border-radius: 4px;
  font-size: 12px; display: flex; align-items: center; gap: 5px;
}
.tag-remove { cursor: pointer; opacity: 0.7; }
.tag-remove:hover { opacity: 1; }

.payment-selector { display: flex; gap: 10px; margin-top: 10px; }
.payment-option {
  flex: 1; padding: 12px; border: 1px solid var(--glass-border); border-radius: var(--radius-sm);
  text-align: center; cursor: pointer; transition: all 0.2s; font-size: 13px;
  background: rgba(255,255,255,0.05); color: var(--text-muted);
}
.payment-option.selected { 
  border-color: var(--success); background: rgba(76, 217, 100, 0.2); 
  color: #fff; font-weight: bold; box-shadow: 0 0 10px rgba(76, 217, 100, 0.3);
}

.lang-select {
  background: rgba(0,0,0,0.3); color: #fff;
  border: 1px solid var(--glass-border); border-radius: 20px;
  padding: 4px 10px; font-size: 12px; outline: none; cursor: pointer;
  text-align: center; appearance: none;
}

/* Specific for Honeypot Editor - Opening Hours */
.hours-row { display: flex; flex-direction: column; margin-bottom: 15px; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 10px; }
.hours-row label { font-weight: bold; color: var(--primary); margin-bottom: 5px; display: block;}
.shifts-container { display: flex; gap: 10px; flex-wrap: wrap; }
.shift-block { flex: 1; min-width: 140px; }
.shift-label { font-size: 10px; color: var(--text-muted); margin-bottom: 2px; display: block; }
.time-inputs { display: flex; align-items: center; gap: 5px; }
.time-inputs select { padding: 5px; border-radius: 6px; font-size: 13px; }

/* ========================================
   6. BUTTONS & FABs
   ======================================== */
.btn-container { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }

.btn, button:not(.close-game):not(.icon-btn):not(.fab-btn) {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: var(--radius-md); border: none;
  font-weight: 600; font-size: 15px; cursor: pointer;
  transition: transform 0.1s, background 0.2s; background: var(--primary); color: #fff; text-align: center;
}
.btn:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: default; filter: grayscale(0.5); }

.btn-secondary { background: var(--glass); border: 1px solid var(--glass-border); color: var(--text-main); }
.btn-secondary:hover { background: var(--hover-bg); }
.btn-success { background: var(--success); color: #fff; }
.btn-delete { background: rgba(255, 107, 107, 0.2); color: var(--error); border: 1px solid var(--error); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

.btn-icon { 
  width: 36px; height: 36px; padding: 0; border-radius: 50%; 
  display: flex; align-items: center; justify-content: center; 
  background: rgba(255,255,255,0.1); border:none; color:white; cursor:pointer;
  transition: all 0.2s;
}
.btn-icon:hover { background: var(--primary); }

.btn-mini {
    padding: 6px 12px; border-radius: 12px; font-size: 11px; font-weight: 600;
    background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border);
    color: var(--text-main); cursor: pointer; display: flex; align-items: center; gap: 5px;
    transition: all 0.2s;
}
.btn-mini:hover { background: var(--primary); border-color: var(--primary); }
.btn-mini:disabled { opacity: 0.4; cursor: not-allowed; }

/* --- Floating Action Buttons (FABs) --- */
.fab-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    z-index: 1010; /* Sopra la save-bar */
}
.fab-btn {
    width: 50px;
    height: 50px;
    background-color: var(--primary);
    color: white;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
}
.fab-btn:active { transform: scale(0.95); }

/* ✅ STILE PER FAB SECONDARIO (Bottone Torna Indietro) */
.fab-btn.fab-secondary { 
    background-color: rgba(255,255,255,0.1); 
    border: 1px solid var(--glass-border); 
}
.fab-btn.fab-secondary:hover { 
    background-color: var(--hover-bg); 
}

/* ========================================
   7. TEXT COMMAND EDITOR PANEL (NEW)
   ======================================== */
.text-editor-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border-top: 2px solid var(--primary);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    z-index: 9998;
    padding: 20px;
    max-height: 50vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.text-editor-panel.open {
    transform: translateY(0);
}

.text-editor-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    color: var(--primary);
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.text-editor-textarea {
    width: 100%;
    min-height: 100px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    margin-bottom: 15px;
}

.text-editor-textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(91, 111, 237, 0.1);
}

.text-editor-textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.text-editor-actions {
    display: flex;
    gap: 10px;
}

.text-editor-actions button {
    flex: 1;
}

/* Voice recording option inside text editor */
.voice-option-btn {
    background: rgba(255,255,255,0.05);
    border: 1px dashed var(--glass-border);
    padding: 10px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.voice-option-btn:hover {
    background: rgba(91, 111, 237, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.voice-option-btn.recording {
    background: var(--error);
    border-color: var(--error);
    color: white;
    animation: pulse 1.5s ease-in-out infinite;
}

/* ========================================
   8. CARDS & COMPONENTS
   ======================================== */
.card, .form-section, .knowledge-card, .pioneer-card {
  background: var(--card-bg); backdrop-filter: blur(10px);
  border-radius: var(--radius-lg); border: 1px solid var(--glass-border);
  padding: 20px; margin-bottom: 20px; box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  overflow: hidden; /* Important for expandable cards */
}

/* --- Notes & Hints --- */
.note { padding: 15px; border-radius: var(--radius-md); font-size: 13px; margin-bottom: 15px; border-left: 4px solid var(--primary); background: rgba(0,0,0,0.2); }
.note-warning { border-left-color: var(--warning); color: #fff; }
.note-error { border-left-color: var(--error); color: #ffcccc; }
.note-success { border-left-color: var(--success); color: #ccffcc; }
.hint, .cancel-hint { font-size: 12px; color: var(--text-secondary); margin-top: 5px; }

/* --- Badges --- */
.badge { font-size: 11px; padding: 4px 8px; border-radius: 4px; font-weight: 700; text-transform: uppercase; }
.badge-wip { background: rgba(245, 158, 11, 0.2); color: var(--warning); border: 1px solid var(--warning); }
.badge-fin { background: rgba(76, 217, 100, 0.2); color: var(--success); border: 1px solid var(--success); }

/* --- Collapsible Cards (Honeypot Editor specific) --- */
.card-header { 
    display: flex; justify-content: space-between; align-items: center; 
    cursor: pointer; padding-bottom: 10px;
}
.card-content { display: none; margin-top: 15px; border-top: 1px solid var(--glass-border); padding-top: 15px; }
.knowledge-card.open .card-content { display: block; }
.knowledge-card.open .chevron { transform: rotate(180deg); }
.chevron { transition: transform 0.3s; }
.guide-step { padding: 10px 0; border-bottom: 1px solid var(--glass-border); display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-muted); }
.guide-step i { color: var(--primary); width: 20px; text-align: center; }
.asset-preview img { max-width: 100px; border-radius: 8px; margin-top: 10px; border: 1px solid var(--glass-border); }
.asset-description { font-size: 11px; color: var(--text-muted); margin-top: 4px; font-style: italic; }
.offer-preview { background: rgba(0,0,0,0.3); border: 1px dashed var(--glass-border); padding: 15px; border-radius: 12px; font-size: 13px; line-height: 1.5; color: var(--text-secondary); margin-top: 10px; cursor: pointer; transition: all 0.2s; }
.offer-preview:hover { background: rgba(0,0,0,0.4); border-color: var(--primary); color: var(--text-main); }
.click-hint { font-size: 10px; color: var(--primary); float: right; cursor: pointer; }

/* --- Save Bar (Floating) --- */
.save-bar {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(120px);
  z-index: 100; transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.save-bar.visible { transform: translateX(-50%) translateY(0); }

/* ========================================
   9. ONBOARDING WIZARD
   ======================================== */
.progress-bar {
  display: flex; justify-content: space-between; align-items: flex-start;
  position: relative; margin: 0 10px 40px 10px; padding: 0;
}
.progress-line {
  position: absolute; top: 15px; left: 0; width: 100%; height: 2px;
  background: rgba(255, 255, 255, 0.2); z-index: 0;
}
.progress-fill {
  position: absolute; top: 15px; left: 0; height: 2px;
  background: var(--success); z-index: 0; transition: width 0.3s ease; width: 0%;
}
.step-item {
  position: relative; z-index: 1; background: transparent; flex: 1; display: flex; flex-direction: column; align-items: center;
}
.step-circle {
  width: 32px; height: 32px; border-radius: 50%;
  background: #2a3d5f; border: 2px solid var(--glass-border);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px; font-weight: bold; font-size: 14px; color: var(--text-muted);
  transition: all 0.3s; box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.step-item.active .step-circle {
  border-color: var(--primary); background: var(--primary); color: #fff;
  transform: scale(1.1); box-shadow: 0 0 15px rgba(91, 111, 237, 0.6);
}
.step-item.completed .step-circle {
  border-color: var(--success); background: var(--success); color: #fff;
}
.step-label {
  font-size: 11px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.5px; text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}
.step-item.active .step-label { color: #fff; font-weight: 700; }

/* ========================================
   10. DASHBOARD SPECIFIC
   ======================================== */
.dashboard-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 25px; padding-bottom: 15px; border-bottom: 1px solid var(--glass-border);
}
.header-info h1 { font-size: 18px; margin: 0; line-height: 1.2; }
.header-info small { color: var(--text-muted); font-size: 11px; }
.header-actions { display: flex; gap: 8px; }

.dash-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; margin-bottom: 25px;
}
.dash-card {
  background: var(--card-bg); border: 1px solid var(--glass-border);
  border-radius: var(--radius-md); padding: 20px 10px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px;
  transition: transform 0.2s, background 0.2s; cursor: pointer;
  min-height: 110px; justify-content: center;
}
.dash-card:active { transform: scale(0.98); background: var(--hover-bg); }
.dash-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(91, 111, 237, 0.1); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.dash-label { font-size: 13px; font-weight: 600; color: #fff; }
.dash-sub { font-size: 10px; color: var(--text-muted); }

/* ========================================
   11. SITEBOS HUB & CLIENT PORTAL
   ======================================== */
.hub-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 15px; border-bottom: 1px solid var(--glass-border); margin-bottom: 20px; }
.brand-area { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--glass-border); }
.owner-avatar { width: 24px; height: 24px; border-radius: 50%; }
.ai-status { color: var(--text-muted); cursor: pointer; transition: color 0.3s; display: inline-block; margin-left: 10px; }
.ai-status.processing { color: var(--warning); animation: pulse 1s infinite; }
.ai-status.human { color: var(--info); }
.ai-status.insight { color: var(--primary); }

.bottom-nav { 
    position: fixed; bottom: 0; left: 0; width: 100%; 
    background: var(--bg-end); display: flex; justify-content: space-around; 
    padding: 10px; border-top: 1px solid var(--glass-border); z-index: 1000; 
}
.nav-item { 
    display: flex; flex-direction: column; align-items: center; 
    color: var(--text-muted); font-size: 10px; text-decoration: none; 
}
.nav-item i { font-size: 20px; margin-bottom: 4px; }
.nav-item.active { color: var(--primary); }

.input-bar-container { 
    position: fixed; bottom: 70px; left: 0; width: 100%; padding: 10px; 
    pointer-events: none; /* Let clicks pass through empty space */
}
.input-bar { 
    pointer-events: auto; display: flex; gap: 8px; 
    background: rgba(0,0,0,0.6); backdrop-filter: blur(10px); 
    padding: 10px; border-radius: 20px; border: 1px solid var(--glass-border); 
}
.chat-input { 
    flex: 1; background: transparent; border: none; color: white; outline: none; 
}

.cart-fab { 
    position: fixed; bottom: 140px; right: 20px; width: 50px; height: 50px; 
    background: var(--success); border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.4); z-index: 900; 
    cursor: pointer; opacity: 0; pointer-events: none; transition: all 0.3s;
}
.cart-fab.visible { opacity: 1; pointer-events: auto; }
.cart-badge { 
    position: absolute; top: -5px; right: -5px; background: red; color: white; 
    font-size: 10px; width: 18px; height: 18px; border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; font-weight: bold; 
}

.company-card { 
    display: flex; align-items: center; gap: 15px; padding: 15px; 
    background: var(--card-bg); margin-bottom: 10px; border-radius: var(--radius-md); 
    cursor: pointer; transition: background 0.2s;
}
.company-card:hover { background: var(--hover-bg); }
.company-avatar { 
    width: 40px; height: 40px; background: var(--primary); color: white; 
    border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; 
}

.tab-content { display: none; padding-bottom: 80px; } /* Space for nav */
.tab-content.active { display: block; animation: fadeIn 0.3s; }

.insight-bubble { 
    background: rgba(91, 111, 237, 0.15); border: 1px solid var(--primary); 
    padding: 15px; border-radius: 12px; margin-bottom: 20px; display: none; 
}
.insight-bubble.visible { display: block; animation: fadeIn 0.3s; }

.kb-card, .category-card { background: var(--card-bg); border-radius: var(--radius-md); margin-bottom: 10px; overflow: hidden; }
.kb-header, .cat-header { padding: 15px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.kb-body, .cat-body { padding: 15px; background: rgba(0,0,0,0.1); display: none; }
.open .kb-body, .open .cat-body { display: block; }
.product-item { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 10px; border-bottom: 1px solid var(--glass-border); 
}
.product-item:last-child { border-bottom: none; }
.price-tag { background: var(--glass); padding: 2px 8px; border-radius: 4px; font-size: 11px; margin-right: 10px; }
.btn-add { background: var(--primary); width: 28px; height: 28px; border-radius: 50%; border: none; color: white; cursor: pointer; display: flex; align-items: center; justify-content: center;}
.btn-remove { background: var(--error); width: 28px; height: 28px; border-radius: 50%; border: none; color: white; cursor: pointer; display: flex; align-items: center; justify-content: center;}

/* ========================================
   12. BLUEPRINT EDITOR SPECIFIC (NEW)
   ======================================== */
.stage-card {
    background: var(--card-bg); backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border); border-radius: var(--radius-md); 
    margin-bottom: 20px; overflow: hidden;
    border-left: 4px solid var(--primary);
}
.stage-header {
    padding: 15px; background: var(--glass);
    display: flex; align-items: flex-start; gap: 10px;
    border-bottom: 1px solid var(--glass-border);
}
.drag-handle { cursor: grab; color: var(--text-muted); padding-top: 5px; }

.edit-input {
    background: transparent; border: none; 
    border-bottom: 1px dashed var(--glass-border);
    color: white; width: 100%; padding: 5px 0; 
    font-size: 16px; font-weight: 600;
}
.edit-input:focus { outline: none; border-bottom-color: var(--primary); }

.edit-textarea {
    background: transparent; border: none; width: 100%; 
    color: var(--text-muted); font-size: 13px; resize: none; margin-top: 5px; font-style: italic;
}
.edit-textarea:focus { outline: none; color: white; }

.step-list-container { padding: 0; min-height: 20px; }
.step-item {
    padding: 15px; border-bottom: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.03);
    border-left: 3px solid var(--secondary);
    display: flex; flex-direction: column; gap: 15px;
}
.step-item:last-child { border-bottom: none; }

.riga-1 { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.riga-1-left { display: flex; align-items: center; gap: 10px; }
.riga-2 { width: 100%; }
.riga-2 input { 
    font-size: 17px; padding: 10px; width: 100%; display: block;
    background: var(--input-bg); border: 1px solid var(--glass-border);
    border-radius: 8px; color: white;
}
.riga-3 { width: 100%; display: flex; justify-content: flex-start; }

.time-box-fixed {
    display: flex; align-items: center; justify-content: flex-start;
    background: var(--input-bg); border: 1px solid var(--glass-border);
    border-radius: 8px; height: 50px; width: 270px;
    max-width: 100%; padding: 0 15px; box-sizing: border-box;
}
.time-box-fixed i { font-size: 20px; color: var(--primary); margin-right: 15px; }
.time-box-fixed input {
    flex: 1; background: transparent; border: none; 
    border-bottom: 1px solid rgba(255,255,255,0.3);
    color: white; text-align: center; font-size: 20px !important; font-weight: bold;
    margin-right: 10px; padding-bottom: 2px;
}
.time-box-fixed span { font-size: 14px; color: var(--text-muted); white-space: nowrap; }

.btn-group { display: flex; gap: 8px; }
.btn-icon.active { background: var(--primary); }
.btn-icon.del:hover { background: var(--error); }

.step-details { 
    display: none; margin-top: 15px; padding-top: 15px; 
    border-top: 1px dashed var(--glass-border);
    width: 100%; box-sizing: border-box;
}
.step-details.open { display: block; animation: slideDown 0.3s ease-out; }

.input-block { margin-bottom: 15px; width: 100%; display: block; }
.input-block label { 
    display: block; font-size: 12px; color: var(--text-muted); 
    margin-bottom: 5px; font-weight: 600; text-transform: uppercase; 
}
.full-area { 
    width: 100% !important; background: var(--input-bg);
    border: 1px solid var(--glass-border); color: white; 
    padding: 12px; border-radius: var(--radius-md); 
    box-sizing: border-box; font-size: 14px; display: block;
}
.full-area:focus { outline: none; border-color: var(--primary); background: rgba(91, 111, 237, 0.1); }

/* ========================================
   13. PROCESSOR & GAME UI
   ======================================== */
.loader-container { 
  background: var(--card-bg); padding: 30px; border-radius: 20px; 
  box-shadow: 0 10px 40px rgba(0,0,0,0.3); width: 100%; max-width: 400px; 
  border: 1px solid rgba(255,255,255,0.05); position: relative; z-index: 10;
  display: flex; flex-direction: column; gap: 15px; text-align: center;
}
.spinner-ring { 
  width: 50px; height: 50px; margin: 0 auto; 
  border: 4px solid rgba(255,255,255,0.1); border-top-color: var(--primary); 
  border-radius: 50%; animation: spin 1s linear infinite; 
}
.status-log { 
  font-family: 'Courier New', monospace; font-size: 11px; 
  color: var(--success); background: rgba(0,0,0,0.3); 
  padding: 10px; border-radius: 8px; margin-bottom: 10px; 
  min-height: 20px; text-align: left; 
}
.btn-game { 
  background: rgba(91, 111, 237, 0.1); border: 1px solid var(--primary); 
  color: #8ba1ff; padding: 12px 20px; border-radius: 12px; font-size: 13px; 
  font-weight: 600; cursor: pointer; display: flex; align-items: center; 
  justify-content: center; gap: 10px; width: 100%; transition: all 0.2s; 
}
.btn-game:hover { background: var(--primary); color: white; }

#game-layer { 
  position: fixed; inset: 0; background: #1a1a2e; z-index: 100; 
  display: flex; flex-direction: column; 
}
#game-container { flex: 1; position: relative; overflow: hidden; background: #000; }
canvas { display: block; width: 100%; height: 100%; }

.game-header { 
  position: absolute; top: 0; left: 0; width: 100%; padding: 15px; 
  display: flex; justify-content: space-between; align-items: flex-start; 
  z-index: 110; pointer-events: none; 
}
.score-box { 
  background: rgba(0,0,0,0.5); padding: 8px 15px; border-radius: 12px; 
  border: 1px solid rgba(255,255,255,0.2); text-align: left; 
}
.score { font-family: 'Orbitron', monospace; font-size: 18px; color: #fff; }
.best-score { font-size: 10px; color: rgba(255,255,255,0.5); margin-top: 2px; }
.close-game { 
  background: rgba(255,255,255,0.1); border: none; color: #fff; 
  width: 36px; height: 36px; border-radius: 50%; font-size: 16px; 
  cursor: pointer; pointer-events: auto; 
}
.legend-bar { 
  position: absolute; top: 70px; width: 100%; display: flex; 
  justify-content: center; gap: 15px; pointer-events: none; z-index: 120; 
}
.legend-item { 
  background: rgba(0,0,0,0.6); padding: 5px 10px; border-radius: 15px; 
  border: 1px solid rgba(255,255,255,0.1); display: flex; align-items: center; gap: 6px; 
}
.legend-text { 
  font-size: 9px; color: #ccc; font-family: 'Inter', sans-serif; 
  text-transform: uppercase; font-weight: 600; 
}
.legend-bad { border-color: var(--error); color: var(--error); }
.legend-good { border-color: var(--success); color: var(--success); }

#error-overlay { 
  position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 200; 
  display: flex; flex-direction: column; justify-content: center; 
  align-items: center; padding: 30px; text-align: center;
}

/* ========================================
   14. UTILITIES
   ======================================== */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(5px);
  z-index: 2000; display: flex; align-items: center; justify-content: center;
  opacity: 1; transition: opacity 0.3s;
}
.modal-overlay.hidden { opacity: 0; pointer-events: none; }
.modal-content {
  background: #2a3d5f; padding: 25px; border-radius: var(--radius-lg);
  width: 90%; max-width: 400px; border: 1px solid var(--glass-border);
}

#loader, #loadingOverlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.loader-content {
    width: 90%; max-width: 350px; text-align: center;
    background: var(--card-bg); padding: 30px; border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
#loader .spinner-ring, #loadingOverlay .spinner-ring { margin-bottom: 15px; } /* Adjust spinner position */

.separator {
    display: flex; align-items: center; text-align: center;
    margin: 20px 0; color: var(--text-muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
}
.separator::before, .separator::after {
    content: ''; flex: 1; border-bottom: 1px solid var(--glass-border);
}
.separator::before { margin-right: 10px; }
.separator::after { margin-left: 10px; }

.locked-item {
    opacity: 0.4; pointer-events: none; filter: grayscale(100%); position: relative;
}
.locked-item::after {
    content: "\f023"; font-family: "Font Awesome 5 Free"; font-weight: 900;
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px; color: rgba(255,255,255,0.5);
}

/* ========================================
   15. ADVERTISING COMPONENTS
   ======================================== */
.ad-banner {
    background: #000; border: 1px dashed #444; border-radius: 8px;
    padding: 0; cursor: pointer; transition: all 0.2s;
    position: relative; overflow: hidden;
}
.ad-banner:hover { border-color: var(--primary); box-shadow: 0 0 15px rgba(91, 111, 237, 0.2); }
.ad-badge { position: absolute; top: 3px; right: 3px; font-size: 8px; padding: 2px 5px; border-radius: 3px; text-transform: uppercase; letter-spacing: 0.5px; z-index: 5; }

.game-ad-footer {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 80px;
    background: #0f172a; border-top: 2px solid var(--primary); z-index: 150;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.6);
}
.game-ad-footer .ad-banner { width: 96%; height: 90%; margin: 0; border: none; background: transparent; }

/* ========================================
   16. CATALOG & PRODUCT LISTS
   ======================================== */
.cat-card { 
    background: var(--card-bg); border-radius: 12px; margin-bottom: 12px; 
    border: 1px solid var(--glass-border); overflow: hidden; transition: all 0.2s;
}
.cat-header {
    padding: 15px; display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; background: rgba(255,255,255,0.03);
}
.cat-header:active { background: rgba(255,255,255,0.08); }
.cat-title { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 10px; color: #fff; flex: 1; }
.cat-badge { 
    background: rgba(0,0,0,0.3); padding: 2px 8px; border-radius: 10px; 
    font-size: 11px; color: var(--text-muted); margin-left: 8px;
}
.cat-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; padding-right: 10px; }
.btn-icon-sm {
    background: transparent; border: none; color: var(--text-muted);
    font-size: 14px; padding: 5px; cursor: pointer;
    transition: color 0.2s, transform 0.2s; display: flex; align-items: center; justify-content: center;
}
.btn-icon-sm:hover { color: var(--primary); transform: scale(1.1); }
.btn-icon-sm.text-error:hover { color: var(--error); }
.cat-body { display: none; padding: 0; border-top: 1px solid var(--glass-border); }
.cat-card.open .cat-body { display: block; animation: slideDown 0.3s ease-out; }
.cat-card.open .chevron { transform: rotate(180deg); }

/* --- Product Items --- */
.prod-item {
    padding: 15px; border-bottom: 1px solid var(--glass-border);
    display: flex; justify-content: space-between; align-items: center;
    background: rgba(0,0,0,0.1); gap: 10px;
}
.prod-item:last-child { border-bottom: none; }
.prod-info { flex: 1; padding-right: 5px; min-width: 0; }
.prod-info.clickable-area { cursor: pointer; transition: background-color 0.2s; }
.prod-info.clickable-area:hover { background-color: rgba(255, 255, 255, 0.05); }

.prod-name { font-size: 14px; font-weight: 600; margin-bottom: 4px; color: #fff; }
.prod-desc { font-size: 11px; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prod-full-name { font-size: 10px; color: var(--text-secondary); margin-bottom: 2px; font-style: italic; }

.status-ghost { border-left: 3px solid var(--text-muted); }
.status-ghost .prod-name { color: var(--text-muted); }
.status-active { border-left: 3px solid var(--success); background: rgba(76, 217, 100, 0.05); }

.prod-actions-group {
    display: flex; flex-direction: column; gap: 8px;
    align-items: center; min-width: 70px;
}
.btn-action {
    padding: 6px 12px; border-radius: 8px; font-size: 11px; font-weight: 600; border: none; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%;
    transition: transform 0.1s;
}
.btn-action:active { transform: scale(0.95); }
.btn-create { background: var(--primary); color: white; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.btn-edit { background: rgba(76, 217, 100, 0.15); color: var(--success); border: 1px solid rgba(76, 217, 100, 0.3); }

.btn-prod-delete {
    background: transparent; border: 1px solid var(--error); color: var(--error);
    padding: 6px; border-radius: 6px; font-size: 10px; width: 100%;
    cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 4px;
}
.btn-prod-delete:hover { background: var(--error); color: white; }

/* ========================================
   17. PAGE SPECIFIC STYLES
   ======================================== */
/* --- Legal Page --- */
.nav-tabs { display: flex; gap: 10px; margin-bottom: 20px; }
.nav-tab { flex: 1; padding: 12px; text-align: center; background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius-md); color: var(--text-muted); cursor: pointer; font-weight: 600; transition: all 0.2s; }
.nav-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 4px 15px rgba(91, 111, 237, 0.3); }
    
.legal-content { font-size: 13px; line-height: 1.6; color: var(--text-muted); height: 65vh; overflow-y: auto; padding-right: 10px; }
.legal-content h3 { color: #fff; margin-top: 20px; margin-bottom: 10px; font-size: 15px; border-bottom: 1px solid var(--glass-border); padding-bottom: 5px; }
.legal-content p { margin-bottom: 15px; }
.legal-content ul { margin-left: 20px; margin-bottom: 15px; }
.legal-content li { margin-bottom: 5px; }
.legal-content strong { color: var(--text-main); }
    
.affiliate-disclaimer { font-size: 11px; font-style: italic; opacity: 0.7; margin-top: 20px; border-top: 1px dashed var(--glass-border); padding-top: 10px; }


/* ========================================
   18. KNOWLEDGE BASE SPECIFIC
   ======================================== */
.kb-card {
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
  transition: background-color 0.2s;
}

.kb-header {
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.2s;
}
.kb-header:hover { background-color: var(--hover-bg); }

.kb-title {
  font-size: 15px;
  font-weight: 600;
  padding-right: 15px;
}

.kb-card.loading .chevron {
    animation: spin 1s linear infinite;
    color: var(--primary);
}

.kb-body {
  display: none;
  padding: 20px;
  border-top: 1px solid var(--glass-border);
  background: rgba(0,0,0,0.2);
}

.kb-card.open .kb-body {
  display: block;
  animation: fadeIn 0.5s ease;
}

.kb-body h3 {
  font-size: 13px;
  color: var(--primary);
  margin: 15px 0 10px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}
.kb-body h3:first-child { margin-top: 0; }

.kb-body .summary, .kb-body .answer-fragment {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-muted);
    padding-left: 15px;
    border-left: 2px solid var(--primary);
}

.kb-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed var(--glass-border);
}
.kb-section .question { font-weight: 600; margin-bottom: 8px; color: var(--text-main); }
.kb-section .answer { font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.kb-section .analogy {
    margin-top: 10px;
    padding: 10px;
    background: rgba(0,0,0,0.2);
    border-left: 2px solid var(--text-secondary);
    border-radius: 4px;
    font-size: 12px;
    font-style: italic;
    color: var(--text-secondary);
}

.utterance-list {
    list-style: none;
    padding: 0;
}
.utterance-list li {
    background: rgba(255,255,255,0.05);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-style: italic;
}

/* Stili per lo spinner del bottone Salva */
.fab-btn.saving .save-icon {
    display: none;
}
.fab-btn.saving .spinner-icon {
    display: inline-block;
}

/* ========================================
   19. ANIMATIONS
   ======================================== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }

/* ========================================
   20. TEAM MANAGER SPECIFIC
   ======================================== */

/* Team Member Cards */
.team-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.team-member-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 15px;
  transition: all 0.2s;
}

.team-member-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--primary);
}

.member-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
  flex-shrink: 0;
}

.member-info {
  flex: 1;
  min-width: 0;
}

.member-info h4 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: white;
}

.member-role {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 6px 0;
}

/* Badges for soft skills status - ADDING MORE STATES */
.badge-success {
  background: rgba(76, 217, 100, 0.15);
  color: var(--success);
  border: 1px solid rgba(76, 217, 100, 0.3);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state i {
  display: block;
  font-size: 48px;
  margin-bottom: 15px;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 14px;
  margin: 0;
}

/* Tag Container for skills display */
.tag-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 30px;
}

.tag-container .text-muted {
  padding: 5px 0;
}

/* Soft Skills Preview */
.soft-skills-preview {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
}

.skill-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border-left: 3px solid var(--primary);
}

.skill-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  text-transform: capitalize;
}

.skill-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  background: rgba(91, 111, 237, 0.1);
  padding: 4px 12px;
  border-radius: 6px;
}

/* Text colors utility (additions to existing) */
.text-success {
  color: var(--success) !important;
}

.text-warning {
  color: var(--warning) !important;
}

/* Highlight card (for important sections) */
.knowledge-card.highlight {
  border-left: 4px solid var(--primary);
  background: rgba(91, 111, 237, 0.05);
}

/* ========================================
   21. RESPONSIVE ADJUSTMENTS (TEAM)
   ======================================== */
@media (max-width: 600px) {
  .team-member-card {
    flex-wrap: wrap;
  }
  
  .team-member-card .btn {
    width: 100%;
    margin-top: 10px;
  }
  
  .skill-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* ========================================
   22. TASKS SYSTEM SPECIFIC
   ======================================== */

/* --- Task Cards --- */
.task-card {
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}

.task-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0,0,0,0.2);
}

.task-card:active {
  transform: translateY(0);
}

/* --- Target/Mission Option Cards --- */
.target-option,
.mission-option {
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.target-option:hover,
.mission-option:hover {
  background: var(--hover-bg);
  border-color: var(--primary);
  transform: translateX(5px);
}

.target-option:active,
.mission-option:active {
  transform: translateX(3px) scale(0.98);
}

/* --- Step Container Navigation --- */
.step-container {
  animation: fadeIn 0.3s ease-out;
}

/* --- Handshake UI Components --- */
#qr-container {
  position: relative;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

#radar-animation {
  animation: fadeIn 0.5s ease-out;
}

#connected-state {
  animation: slideDown 0.5s ease-out;
}

#connected-state .card {
  animation: pulse 0.5s ease-out;
}

/* --- Search Results --- */
#search-results {
  max-height: 400px;
  overflow-y: auto;
  margin-top: 15px;
}

#search-results::-webkit-scrollbar {
  width: 6px;
}

#search-results::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.2);
  border-radius: 3px;
}

#search-results::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 3px;
}

/* --- Photo Preview --- */
#photo-preview {
  animation: slideDown 0.3s ease-out;
}

#photo-preview img {
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/* --- Tasks List Specific --- */
#tasks-container {
  animation: fadeIn 0.5s ease-out;
}

/* Urgent task indicator glow effect */
.task-card[style*="border-left: 4px solid var(--error)"] {
  animation: urgentGlow 2s ease-in-out infinite;
}

@keyframes urgentGlow {
  0%, 100% { box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
  50% { box-shadow: 0 4px 25px rgba(255, 107, 107, 0.3); }
}

/* --- Responsive Adjustments for Tasks --- */
@media (max-width: 600px) {
  .target-option,
  .mission-option {
    padding: 15px;
  }
  
  .dash-icon {
    width: 45px !important;
    height: 45px !important;
    font-size: 20px !important;
  }
  
  #qr-code {
    width: 150px !important;
    height: 150px !important;
  }
  
  .task-card h3 {
    font-size: 15px;
  }
}
