/* =============================================
   main.css — Bisazza Configurator Design System
   ============================================= */

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

/* =====================
   DESIGN TOKENS
   ===================== */
:root {
  /* Colors — Light */
  --c-bg:               #ffffff;
  --c-bg-secondary:     #f5f5f5;
  --c-bg-panel:         #f5f5f5;
  --c-text:             #000000;
  --c-text-secondary:   #666666;
  --c-border:           #e0e0e0;
  --c-border-input:     #d0d0d0;
  --c-border-focus:     #000000;
  --c-btn-bg:           #000000;
  --c-btn-text:         #ffffff;
  --c-btn-disabled:     #c0c0c0;
  --c-pill-active:      #000000;
  --c-pill-inactive:    #f5f5f5;
  --c-overlay:          rgba(0,0,0,0.50);
  --c-error:            #d32f2f;
  --c-success:          #388e3c;
  --c-warning:          #e65100;

  /* Typography */
  --font:        'Inter', system-ui, sans-serif;
  --font-logo:   Georgia, 'Times New Roman', serif;

  --text-xs:   11px;
  --text-sm:   13px;
  --text-base: 15px;
  --text-lg:   18px;
  --text-xl:   20px;
  --text-2xl:  24px;

  --fw-normal:   400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;

  /* Spacing */
  --sp-xs:  4px;
  --sp-sm:  8px;
  --sp-md:  16px;
  --sp-lg:  24px;
  --sp-xl:  32px;
  --sp-2xl: 48px;

  /* Layout */
  --panel-w:    340px;
  --navbar-h:   60px;

  /* Border radius */
  --r-sm:   4px;
  --r-md:   8px;
  --r-lg:   12px;
  --r-pill: 40px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.18);

  /* Transitions */
  --t-fast:   150ms ease;
  --t-normal: 250ms ease;
  --t-slow:   350ms ease;

  /* Z-index */
  --z-base:    1;
  --z-panel:   10;
  --z-navbar:  100;
  --z-drawer:  200;
  --z-modal:   300;
  --z-toast:   400;

  --ease: cubic-bezier(.22,.61,.36,1);
}

/* Dark mode */
body.dark {
  --c-bg:             #121212;
  --c-bg-secondary:   #1e1e1e;
  --c-bg-panel:       #1e1e1e;
  --c-text:           #ffffff;
  --c-text-secondary: #aaaaaa;
  --c-border:         #333333;
  --c-border-input:   #444444;
  --c-border-focus:   #ffffff;
  --c-btn-bg:         #ffffff;
  --c-btn-text:       #000000;
  --c-pill-active:    #ffffff;
  --c-pill-inactive:  #1e1e1e;
}

/* =====================
   RESET
   ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
ul, ol { list-style: none; }
h1,h2,h3,h4,h5,h6 { font-weight: var(--fw-semibold); line-height: 1.2; }

/* =====================
   APP LAYOUT
   ===================== */
#app { min-height: 100vh; }

/* Page views — shown/hidden by router */
.page-view { display: none; }
.page-view.active { display: flex; flex-direction: column; min-height: 100vh; }

/* Auth layout (split 50/50) */
.auth-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}
.auth-layout__image {
  background: #111;
  overflow: hidden;
  position: relative;
}
.auth-layout__image img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.9;
}
.auth-layout__form {
  background: var(--c-bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-2xl) var(--sp-xl);
}
.auth-form {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}
.auth-form__logo {
  font-family: var(--font-logo);
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: var(--sp-sm);
}
.auth-form__title {
  font-size: var(--text-xl);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--sp-sm);
}
.auth-form__footer {
  margin-top: var(--sp-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-sm);
  color: var(--c-text-secondary);
}

/* Main app layout */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.app-layout__content {
  flex: 1;
  display: flex;
  margin-top: var(--navbar-h);
}

/* Split layout (preview + panel) */
.split-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr var(--panel-w);
  min-height: calc(100vh - var(--navbar-h));
}
.split-layout__preview {
  position: relative;
  background: var(--c-bg-secondary);
  overflow: hidden;
}
.split-layout__panel {
  background: var(--c-bg);
  border-left: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Account layout (sidebar + content) */
.account-layout {
  display: grid;
  grid-template-columns: var(--panel-w) 1fr;
  min-height: calc(100vh - var(--navbar-h));
}
.account-sidebar {
  border-right: 1px solid var(--c-border);
  padding: var(--sp-md) 0;
  overflow-y: auto;
}
.account-sidebar__welcome {
  font-size: var(--text-xl);
  font-weight: var(--fw-semibold);
  padding: var(--sp-md) var(--sp-lg) var(--sp-lg);
  border-bottom: 1px solid var(--c-border);
  margin-bottom: var(--sp-sm);
}
.account-sidebar__item {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-md) var(--sp-lg);
  font-size: var(--text-base);
  cursor: pointer;
  transition: background var(--t-fast);
}
.account-sidebar__item:hover { background: var(--c-bg-secondary); }
.account-sidebar__item.active { font-weight: var(--fw-semibold); }
.account-content {
  padding: var(--sp-xl);
  max-width: 720px;
  overflow-y: auto;
}

/* Preventivo layout */
.preventivo-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  min-height: calc(100vh - var(--navbar-h));
}
.preventivo-form-area { padding: var(--sp-xl); overflow-y: auto; }
.preventivo-sidebar {
  background: var(--c-bg-secondary);
  border-left: 1px solid var(--c-border);
  padding: var(--sp-lg);
  overflow-y: auto;
}

/* =====================
   UTILITY CLASSES
   ===================== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.hidden { display: none !important; }
.invisible { visibility: hidden; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.gap-xs { gap: var(--sp-xs); }
.gap-sm { gap: var(--sp-sm); }
.gap-md { gap: var(--sp-md); }
.gap-lg { gap: var(--sp-lg); }
.text-secondary { color: var(--c-text-secondary); }
.text-error { color: var(--c-error); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-lg { font-size: var(--text-lg); }
.font-medium { font-weight: var(--fw-medium); }
.font-semibold { font-weight: var(--fw-semibold); }
.uppercase { text-transform: uppercase; letter-spacing: 0.08em; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.overflow-y-auto { overflow-y: auto; }
.mt-xs { margin-top: var(--sp-xs); }
.mt-sm { margin-top: var(--sp-sm); }
.mt-md { margin-top: var(--sp-md); }
.mt-lg { margin-top: var(--sp-lg); }
.mt-xl { margin-top: var(--sp-xl); }
.mb-xs { margin-bottom: var(--sp-xs); }
.mb-sm { margin-bottom: var(--sp-sm); }
.mb-md { margin-bottom: var(--sp-md); }
.mb-lg { margin-bottom: var(--sp-lg); }
.p-md { padding: var(--sp-md); }
.p-lg { padding: var(--sp-lg); }
.px-lg { padding-left: var(--sp-lg); padding-right: var(--sp-lg); }
.py-lg { padding-top: var(--sp-lg); padding-bottom: var(--sp-lg); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-md); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-md); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-md); }

/* Masonry-like projects grid */
.masonry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-lg);
  padding: var(--sp-lg);
  align-content: start;
}

/* =====================
   DIVIDER
   ===================== */
.divider {
  display: flex; align-items: center; gap: var(--sp-md);
  color: var(--c-text-secondary); font-size: var(--text-sm);
  margin: var(--sp-sm) 0;
}
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px solid var(--c-border); }

/* =====================
   TOAST NOTIFICATIONS
   ===================== */
#toast-container {
  position: fixed;
  bottom: var(--sp-lg);
  right: var(--sp-lg);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  pointer-events: none;
}
.toast {
  background: var(--c-btn-bg);
  color: var(--c-btn-text);
  padding: var(--sp-md) var(--sp-lg);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-md);
  animation: toast-in var(--t-normal) forwards;
  max-width: 340px;
  pointer-events: all;
}
.toast--error   { background: var(--c-error); color: #fff; }
.toast--success { background: var(--c-success); color: #fff; }
.toast--warning { background: var(--c-warning); color: #fff; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =====================
   LOADER / SPINNER
   ===================== */
.loader {
  display: flex; align-items: center; justify-content: center;
  min-height: 200px;
}
.spinner {
  width: 32px; height: 32px;
  border: 2px solid var(--c-border);
  border-top-color: var(--c-text);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner--sm { width: 18px; height: 18px; }
@keyframes spin { to { transform: rotate(360deg); } }

.page-loader {
  position: fixed; inset: 0;
  background: var(--c-bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: var(--z-modal);
  gap: var(--sp-lg);
}
.page-loader__logo {
  font-family: var(--font-logo);
  font-size: var(--text-2xl);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: var(--fw-bold);
}

/* =====================
   EMPTY STATE
   ===================== */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: var(--sp-md); padding: var(--sp-2xl);
  text-align: center; min-height: 300px;
}
.empty-state__icon { font-size: 48px; color: var(--c-border); margin-bottom: var(--sp-sm); }
.empty-state__title { font-size: var(--text-lg); font-weight: var(--fw-semibold); }
.empty-state__desc { font-size: var(--text-sm); color: var(--c-text-secondary); max-width: 320px; }

/* =====================
   TABLE
   ===================== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: var(--sp-md);
  border-bottom: 1px solid var(--c-border);
  text-align: left;
  font-size: var(--text-sm);
}
.table th {
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-text-secondary);
}
.table tr:hover td { background: var(--c-bg-secondary); }

/* =====================
   SECTION TITLE
   ===================== */
.section-title {
  font-size: var(--text-xl);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--sp-lg);
}
.section-subtitle {
  font-size: var(--text-sm);
  color: var(--c-text-secondary);
  margin-top: calc(-1 * var(--sp-md));
  margin-bottom: var(--sp-lg);
}
