/* AutoVibe CSS update for project 1744819974606 - Iteration 4 */

/* --- Base Styles & Variables --- */
:root {
  --primary-color: #005f73; /* Dark Teal/Blue */
  --secondary-color: #0a9396; /* Medium Teal */
  --accent-color: #94d2bd; /* Light Teal/Green */
  --neutral-light: #e9d8a6; /* Light Beige/Yellow (for contrast/highlights) */
  --neutral-medium: #ee9b00; /* Medium Orange (for alerts/accents) */
  --neutral-dark: #001219; /* Very Dark Blue/Black (text) */
  --background-light: #f8f9fa; /* Light Gray */
  --background-white: #ffffff;
  --success-color: #2a9d8f; /* Green for positive feedback */
  --warning-color: #e9c46a; /* Yellow for warnings */
  --error-color: #e76f51; /* Red/Orange for errors */
  --font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  --border-radius: 4px;
  --box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  --box-shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* --- Reset & Base Body --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family-sans);
  padding: 0;
  background-color: var(--background-light);
  color: var(--neutral-dark);
  line-height: 1.6;
  margin: 0;
  display: flex;
  min-height: 100vh;
  flex-direction: row; /* Default: Sidebar left, content right */
}

/* --- Layout Structure --- */
header {
  background-color: var(--primary-color);
  color: var(--background-white);
  padding: 1.5em 2em;
  box-shadow: var(--box-shadow);
  text-align: center; /* Center header content */
}

header h1 {
  color: var(--background-white);
  margin: 0 0 0.2em 0;
  border-bottom: none;
  font-size: 2em;
  font-weight: 700;
}

header p {
  margin: 0;
  opacity: 0.9;
  font-size: 1em;
}

header p i {
  display: block;
  font-size: 0.9em;
  margin-top: 0.5em;
  color: var(--accent-color);
}

#app-navigation {
  background-color: var(--background-white);
  padding: 1.5em 1em;
  width: 260px; /* Slightly wider sidebar */
  flex-shrink: 0; /* Prevent sidebar from shrinking */
  box-shadow: var(--box-shadow-lg);
  border-right: 1px solid #dee2e6;
  display: flex;
  flex-direction: column;
}

#app-navigation h2 {
  margin-top: 0;
  margin-bottom: 1em;
  font-size: 1.2em;
  color: var(--primary-color);
  border-bottom: 2px solid var(--secondary-color);
  padding-bottom: 0.5em;
  font-weight: 600;
}

#app-navigation ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

#app-navigation li a {
  display: block;
  padding: 0.7em 1em; /* Slightly more padding */
  color: var(--primary-color);
  text-decoration: none;
  border-radius: var(--border-radius);
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
  margin-bottom: 0.3em; /* Space between links */
  font-weight: 500;
}

#app-navigation li a:hover {
  background-color: var(--secondary-color);
  color: var(--background-white);
  text-decoration: none;
  transform: translateX(3px);
}

#app-navigation li a.active {
  /* Style for active link (requires JS to add class) */
  background-color: var(--primary-color);
  color: var(--background-white);
  font-weight: 600;
}

main {
  flex: 1; /* Takes remaining horizontal space */
  padding: 2em 2.5em; /* More padding */
  max-width: calc(100% - 260px); /* Adjust based on sidebar width */
  overflow-y: auto; /* Allow vertical scroll in main content */
  background-color: var(--background-light);
}

.app-section {
  background-color: var(--background-white);
  padding: 2em; /* More padding */
  margin-bottom: 2.5em; /* More space between sections */
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  border: 1px solid #e9ecef;
}

.app-section h2 {
  margin-top: 0;
  border-bottom: 2px solid var(--accent-color);
  padding-bottom: 0.5em;
  margin-bottom: 1.5em; /* More space below heading */
  font-size: 1.8em; /* Larger section headings */
  color: var(--primary-color);
}

footer {
  text-align: center;
  padding: 1.2em;
  margin-top: auto; /* Push footer to bottom if content is short */
  background-color: var(--neutral-dark);
  color: var(--background-light);
  font-size: 0.9em;
  width: 100%; /* Ensure footer spans full width */
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
}

footer p {
  margin: 0;
}

/* --- Typography Refinements --- */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--primary-color);
  margin-top: 1.5em;
  margin-bottom: 0.8em;
  font-weight: 600;
  line-height: 1.3;
}

h3 {
  font-size: 1.4em;
  color: var(--secondary-color);
  margin-bottom: 1em;
}

h4 {
  font-size: 1.2em;
  color: var(--primary-color);
  opacity: 0.9;
}

p {
  margin-bottom: 1.2em;
  color: #343a40; /* Slightly softer text color */
}

a {
  color: var(--secondary-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

/* --- Form Elements Styling --- */
form#business-model-form {
  display: grid;
  gap: 2em; /* More space between fieldsets */
}

fieldset {
  border: 1px solid #dee2e6;
  padding: 1.5em 2em; /* More padding */
  border-radius: var(--border-radius);
  background-color: #fdfdfd;
}

legend {
  font-weight: 600;
  color: var(--primary-color);
  padding: 0 0.8em;
  font-size: 1.2em; /* Larger legend */
  margin-bottom: 1em; /* Space below legend */
}

fieldset > div {
  margin-bottom: 1.2em; /* Space between form fields */
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--neutral-dark);
  font-size: 0.95em;
}

input[type='text'],
input[type='number'],
select,
textarea {
  width: 100%;
  padding: 10px 14px; /* Slightly larger padding */
  margin-bottom: 5px; /* Reduced margin below input */
  border: 1px solid #ced4da;
  border-radius: var(--border-radius);
  box-sizing: border-box;
  font-family: inherit;
  font-size: 1em;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type='text']:focus,
input[type='number']:focus,
select:focus,
textarea:focus {
  border-color: var(--secondary-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(10, 147, 150, 0.25); /* Slightly stronger focus ring */
}

/* Styling the '?' help icons (span with tooltip class) */
.tooltip {
  display: inline-block;
  margin-left: 8px; /* More space */
  cursor: help;
  color: var(--secondary-color);
  font-weight: bold;
  border: 1px solid var(--secondary-color);
  border-radius: 50%;
  width: 20px; /* Slightly larger */
  height: 20px;
  line-height: 18px; /* Adjust for new size */
  text-align: center;
  font-size: 0.85em;
  background-color: #e0f2f7;
  vertical-align: middle;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.tooltip:hover {
  background-color: var(--secondary-color);
  color: white;
}

/* Range input styling */
input[type='range'] {
  width: calc(100% - 60px); /* Adjust width to accommodate output */
  margin-right: 10px;
  vertical-align: middle;
  cursor: pointer;
}

output {
  display: inline-block;
  min-width: 40px; /* Ensure space for text */
  text-align: right;
  font-weight: 500;
  color: var(--primary-color);
  vertical-align: middle;
}

#scenario-controls label {
  margin-right: 10px;
}
#scenario-controls div {
  /* Better alignment for label, range, output */
  display: flex;
  align-items: center;
  margin-bottom: 1em;
}
#scenario-controls label {
  flex-basis: 200px; /* Fixed width for labels */
  flex-shrink: 0;
}
#scenario-controls input[type='range'] {
  flex-grow: 1; /* Range takes remaining space */
}
#scenario-controls output {
  flex-basis: 50px; /* Fixed width for output */
  flex-shrink: 0;
}

/* --- Button Styles --- */
button,
.stButton > button {
  background-color: var(--secondary-color);
  color: var(--background-white);
  border: none;
  padding: 12px 25px;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 1.05em; /* Slightly larger */
  font-weight: 600; /* Bolder */
  transition: background-color 0.2s ease, transform 0.1s ease,
    box-shadow 0.2s ease;
  margin-right: 10px;
  margin-top: 10px;
  box-shadow: var(--box-shadow);
}

button:hover,
.stButton > button:hover {
  background-color: var(--primary-color);
  transform: translateY(-2px); /* More lift effect */
  box-shadow: var(--box-shadow-lg);
}

button:active,
.stButton > button:active {
  transform: translateY(0px);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

button:disabled {
  background-color: #adb5bd;
  cursor: not-allowed;
  opacity: 0.7;
  box-shadow: none;
  transform: none;
}

button[type='reset'] {
  background-color: #6c757d; /* Grey for reset */
}
button[type='reset']:hover {
  background-color: #5a6268;
}

/* Specific Button IDs */
#calculate-button {
  background-color: var(--success-color);
}
#calculate-button:hover {
  background-color: #1f796e; /* Darker success color */
}

#run-scenario-button {
  background-color: var(--neutral-medium);
}
#run-scenario-button:hover {
  background-color: #d48c00; /* Darker warning color */
}
#reset-scenario-button {
  background-color: #6c757d;
}
#reset-scenario-button:hover {
  background-color: #5a6268;
}

/* --- Data Display Styles (Metrics, KPIs) --- */
#summary-metrics ul,
#kpi-details ul {
  list-style: none;
  padding-left: 0;
  display: grid; /* Grid layout for metrics */
  grid-template-columns: repeat(
    auto-fit,
    minmax(200px, 1fr)
  ); /* Responsive grid */
  gap: 1.5em;
}

#summary-metrics li,
#kpi-details li {
  background-color: var(--background-light);
  padding: 1em 1.2em;
  border-radius: var(--border-radius);
  border: 1px solid #e9ecef;
  box-shadow: var(--box-shadow);
  font-size: 0.95em;
  display: flex;
  flex-direction: column; /* Stack label and value */
}

#summary-metrics li .metric-label,
#kpi-details li .kpi-label {
  font-size: 0.9em;
  color: #6c757d; /* Grey label */
  margin-bottom: 0.3em;
  text-transform: uppercase;
  font-weight: 500;
}

#summary-metrics li span, /* The value */
#kpi-details li span {
  font-weight: 600;
  font-size: 1.3em; /* Larger value */
  color: var(--primary-color);
  margin-left: 0; /* Reset margin */
}

/* Placeholder Div Styling */
#charts-placeholder-projections,
#financial-statements p, /* Target the placeholder paragraph specifically */
#scenario-results,
#sensitivity-chart-placeholder,
#charts-placeholder-kpi,
#report-preview {
  background-color: #e9ecef; /* Slightly darker background */
  border: 1px dashed #adb5bd; /* Dashed border */
  padding: 30px; /* More padding */
  margin-top: 20px;
  text-align: center;
  color: #6c757d; /* Grey text */
  border-radius: var(--border-radius);
  min-height: 150px; /* Minimum height */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
#financial-statements p {
  /* Keep the paragraph simple */
  background-color: transparent;
  border: none;
  padding: 0;
  margin-top: 0;
  min-height: auto;
  text-align: left;
  color: var(--neutral-dark);
}

/* --- Table Styles --- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 25px;
  box-shadow: var(--box-shadow);
  overflow: hidden; /* Needed for border-radius on table */
  border-radius: var(--border-radius);
  border: 1px solid #dee2e6;
}

th,
td {
  border: 1px solid #dee2e6;
  padding: 12px 15px;
  text-align: left;
  vertical-align: middle;
}

th {
  background-color: var(--primary-color);
  color: var(--background-white);
  font-weight: 600;
  font-size: 1.05em;
  text-transform: uppercase; /* Uppercase headers */
  letter-spacing: 0.5px;
}

td {
  font-size: 0.95em;
}

tr:nth-child(even) td {
  /* Zebra striping for rows */
  background-color: var(--background-light);
}

tr:hover td {
  background-color: #e9ecef; /* Subtle hover effect */
}

/* Specific table adjustments */
#scenario-results table th,
#scenario-results table td {
  text-align: right; /* Align numbers to the right */
}
#scenario-results table th:first-child,
#scenario-results table td:first-child {
  text-align: left; /* Align metric names to the left */
}

/* --- Visual Feedback Colors & Classes --- */
.positive {
  color: var(--success-color) !important; /* Use important if needed */
  font-weight: bold;
}
.negative {
  color: var(--error-color) !important;
  font-weight: bold;
}
.warning {
  background-color: var(--warning-color);
  color: var(--neutral-dark);
  padding: 0.2em 0.5em;
  border-radius: var(--border-radius);
}
.success {
  background-color: var(--success-color);
  color: var(--background-white);
  padding: 0.2em 0.5em;
  border-radius: var(--border-radius);
}
.error {
  background-color: var(--error-color);
  color: var(--background-white);
  padding: 0.2em 0.5em;
  border-radius: var(--border-radius);
}
.highlight {
  background-color: var(--accent-color);
  color: var(--neutral-dark);
}

/* --- Simulated Elements (Keep for reference/future use) --- */

/* Simulating Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid #dee2e6;
  margin-bottom: 20px;
}

.tab-button {
  padding: 10px 18px;
  cursor: pointer;
  border: none;
  background-color: transparent;
  border-bottom: 3px solid transparent;
  margin-right: 5px;
  font-size: 1em;
  color: #6c757d;
  transition: border-color 0.2s ease, color 0.2s ease;
}

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

.tab-button.active {
  border-bottom-color: var(--secondary-color);
  font-weight: 600;
  color: var(--primary-color);
}

.tab-content {
  display: none;
  padding: 20px;
  border: 1px solid #dee2e6;
  border-top: none;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
}

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

/* --- Responsiveness --- */
@media (max-width: 1200px) {
  #summary-metrics ul,
  #kpi-details ul {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

@media (max-width: 992px) {
  body {
    flex-direction: column; /* Stack header, nav, main */
  }
  header {
    /* Header remains full width */
  }
  #app-navigation {
    width: 100%; /* Full width nav on smaller screens */
    border-right: none;
    border-bottom: 1px solid #dee2e6;
    height: auto;
    margin-bottom: 0; /* Remove margin below nav */
    box-shadow: var(--box-shadow); /* Less prominent shadow */
    padding: 0.5em 1em; /* Reduced padding */
    flex-direction: row; /* Horizontal layout */
    align-items: center;
  }
  #app-navigation h2 {
    display: none; /* Hide "Navigazione" title */
  }
  #app-navigation ul {
    display: flex; /* Horizontal list */
    flex-wrap: wrap; /* Allow wrapping */
    justify-content: flex-start; /* Align left */
    width: 100%;
  }
  #app-navigation li {
    margin: 0 5px; /* Spacing between horizontal items */
  }
  #app-navigation li a {
    padding: 0.6em 0.8em; /* Adjust padding */
    margin-bottom: 0;
  }
  #app-navigation li a:hover {
    transform: none; /* Remove horizontal transform */
  }
  main {
    max-width: 100%; /* Main takes full width */
    padding: 1.5em;
  }
  footer {
    position: static; /* Ensure footer stays at bottom */
  }
}

@media (max-width: 768px) {
  header h1 {
    font-size: 1.6em;
  }
  .app-section h2 {
    font-size: 1.5em;
  }
  h3 {
    font-size: 1.3em;
  }
  button,
  .stButton > button {
    padding: 10px 20px;
    font-size: 1em;
  }
  input[type='text'],
  input[type='number'],
  select,
  textarea {
    padding: 9px 12px;
  }
  th,
  td {
    padding: 10px 12px;
    font-size: 0.9em;
  }
  #summary-metrics ul,
  #kpi-details ul {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1em;
  }
  #summary-metrics li,
  #kpi-details li {
    padding: 0.8em 1em;
  }
  #summary-metrics li span,
  #kpi-details li span {
    font-size: 1.2em;
  }
  #scenario-controls div {
    flex-direction: column;
    align-items: flex-start;
  }
  #scenario-controls label {
    flex-basis: auto;
    margin-bottom: 5px;
  }
  #scenario-controls input[type='range'] {
    width: 100%;
    margin-right: 0;
    margin-bottom: 5px;
  }
  #scenario-controls output {
    flex-basis: auto;
    text-align: left;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 15px; /* Slightly smaller base font */
  }
  header {
    padding: 1em 1em;
  }
  header h1 {
    font-size: 1.4em;
  }
  header p {
    font-size: 0.9em;
  }
  main {
    padding: 1em;
  }
  .app-section {
    padding: 1.2em;
    margin-bottom: 1.5em;
  }
  .app-section h2 {
    font-size: 1.3em;
    margin-bottom: 1em;
  }
  h3 {
    font-size: 1.1em;
  }
  form#business-model-form {
    gap: 1.5em;
  }
  fieldset {
    padding: 1em 1.2em;
  }
  legend {
    font-size: 1.1em;
  }
  #app-navigation ul {
    justify-content: space-around; /* Distribute items */
  }
  #app-navigation li a {
    padding: 0.5em 0.6em;
    font-size: 0.9em;
  }
  button,
  .stButton > button {
    width: 100%; /* Full width buttons */
    margin-right: 0;
    margin-bottom: 10px; /* Stack buttons */
  }
  button:last-of-type {
    margin-bottom: 0;
  }
  th,
  td {
    padding: 8px 10px;
    font-size: 0.85em;
  }
  #summary-metrics ul,
  #kpi-details ul {
    grid-template-columns: 1fr; /* Single column metrics */
  }
}