/* ================================================================
   ACITIM CRM - Design System
   Paletă corporate elegantă inspirată de brandul ACITIM:
   - Navy profund pentru autoritate și încredere
   - Auriu cald ca accent premium
   - Neutre calde pentru un aspect ne-corporate-rece
   ================================================================ */

:root {
  /* Culori brand */
  --navy-950: #061a34;
  --navy-900: #0d2b4e;
  --navy-800: #133c66;
  --navy-700: #1e4a80;
  --navy-600: #2e5c96;

  --gold-500: #c9a961;
  --gold-400: #d6ba7e;
  --gold-600: #a88a48;

  /* Neutre */
  --stone-50:  #fafaf9;
  --stone-100: #f5f5f4;
  --stone-200: #e7e5e4;
  --stone-300: #d6d3d1;
  --stone-400: #a8a29e;
  --stone-500: #78716c;
  --stone-600: #57534e;
  --stone-700: #44403c;
  --stone-800: #292524;
  --stone-900: #1c1917;

  /* Semantice */
  --success: #10b981;
  --warning: #f59e0b;
  --danger:  #ef4444;
  --info:    #3b82f6;

  /* Design tokens */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm:  0 1px 2px rgba(6, 26, 52, 0.05);
  --shadow:     0 4px 12px rgba(6, 26, 52, 0.08);
  --shadow-lg:  0 12px 32px rgba(6, 26, 52, 0.12);
  --shadow-xl:  0 24px 64px rgba(6, 26, 52, 0.16);

  --font-sans: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-serif: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--stone-50);
  color: var(--stone-800);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Tipografie ---------- */
h1, h2, h3, h4 { color: var(--navy-900); font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.1; }
h2 { font-size: clamp(1.5rem, 2.5vw, 2rem); }
h3 { font-size: 1.25rem; }
p  { color: var(--stone-600); }

.display {
  font-family: var(--font-serif);
  font-weight: 500;
  font-style: italic;
  color: var(--gold-500);
}

/* ---------- Butoane ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--navy-900);
  color: white;
  box-shadow: var(--shadow);
}
.btn-primary:hover { background: var(--navy-800); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn-gold {
  background: var(--gold-500);
  color: white;
  box-shadow: 0 4px 12px rgba(201, 169, 97, 0.35);
}
.btn-gold:hover { background: var(--gold-600); transform: translateY(-1px); }
.btn-outline {
  background: transparent;
  color: var(--navy-900);
  border: 1.5px solid var(--stone-300);
}
.btn-outline:hover { border-color: var(--navy-900); background: var(--navy-900); color: white; }
.btn-ghost { background: transparent; color: var(--stone-600); }
.btn-ghost:hover { background: var(--stone-100); color: var(--navy-900); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-lg { padding: 16px 32px; font-size: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ---------- Card ---------- */
.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--stone-200);
  overflow: hidden;
}
.card-body { padding: 24px; }
.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--stone-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h2, .card-header h3 { margin: 0; }

/* ---------- Formulare ---------- */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--stone-700);
  margin-bottom: 6px;
}
.field label .req { color: var(--danger); margin-left: 2px; }
.field .help { font-size: 12px; color: var(--stone-500); margin-top: 4px; }
.field .error { font-size: 12px; color: var(--danger); margin-top: 4px; }

input[type="text"], input[type="email"], input[type="tel"],
input[type="password"], input[type="number"], input[type="date"],
select, textarea {
  width: 100%;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  color: var(--stone-800);
  background: white;
  border: 1.5px solid var(--stone-300);
  border-radius: var(--radius);
  transition: border 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--navy-700);
  box-shadow: 0 0 0 3px rgba(30, 74, 128, 0.15);
}
textarea { min-height: 100px; resize: vertical; }
select { cursor: pointer; }

/* Checkbox/multiselect grid */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid var(--stone-300);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  background: white;
}
.checkbox-item:hover { border-color: var(--navy-700); background: var(--stone-50); }
.checkbox-item input { accent-color: var(--navy-900); cursor: pointer; }
.checkbox-item.checked { border-color: var(--navy-900); background: rgba(13, 43, 78, 0.03); }

/* File upload */
.file-drop {
  border: 2px dashed var(--stone-300);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--stone-50);
}
.file-drop:hover, .file-drop.drag-over { border-color: var(--gold-500); background: rgba(201, 169, 97, 0.05); }
.file-drop input { display: none; }
.file-drop-icon { font-size: 32px; margin-bottom: 8px; color: var(--stone-400); }
.file-list { margin-top: 12px; }
.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: white;
  border: 1px solid var(--stone-200);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 13px;
}
.file-remove { color: var(--danger); cursor: pointer; background: none; border: none; font-size: 18px; }

/* ---------- Badge / Chip ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  background: var(--stone-100);
  color: var(--stone-700);
}
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
}
table.data th {
  text-align: left;
  padding: 12px 16px;
  background: var(--stone-50);
  border-bottom: 1px solid var(--stone-200);
  font-size: 12px;
  font-weight: 600;
  color: var(--stone-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
table.data td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--stone-100);
  font-size: 14px;
  color: var(--stone-700);
}
table.data tr:hover td { background: var(--stone-50); }
table.data tr:last-child td { border-bottom: none; }

/* ---------- Alerts ---------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
  border-left: 4px solid;
}
.alert-success { background: #ecfdf5; border-color: var(--success); color: #065f46; }
.alert-error   { background: #fef2f2; border-color: var(--danger);  color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: var(--warning); color: #92400e; }
.alert-info    { background: #eff6ff; border-color: var(--info);    color: #1e40af; }

/* ---------- Layout admin ---------- */
.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--navy-950);
  color: white;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
}
.sidebar-brand {
  padding: 0 24px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand .logo-text {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: white;
}
.sidebar-brand .logo-sub {
  font-size: 11px;
  color: var(--gold-500);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-top: 2px;
}
.sidebar-nav { flex: 1; padding: 16px 0; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  background: rgba(255,255,255,0.05);
  color: white;
  border-left-color: var(--gold-500);
}
.sidebar-nav a .icon { font-size: 18px; opacity: 0.8; }

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: rgba(255,255,255,0.5);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gold-500);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}
.sidebar-user .name { color: white; font-weight: 500; }

.main {
  padding: 32px 40px;
  overflow-y: auto;
  max-height: 100vh;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.page-header h1 { font-size: 26px; }
.page-header .subtitle { color: var(--stone-500); font-size: 14px; margin-top: 2px; }

/* ---------- Grid layout helpers ---------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; }
.row-between { display: flex; justify-content: space-between; align-items: center; }

/* ---------- Stat card ---------- */
.stat {
  background: white;
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--stone-200);
  box-shadow: var(--shadow-sm);
}
.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--stone-500);
  margin-bottom: 8px;
}
.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--navy-900);
  line-height: 1;
}
.stat-delta { font-size: 12px; margin-top: 6px; }
.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--danger); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 26, 52, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--stone-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--stone-200);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--stone-400);
  cursor: pointer;
  line-height: 1;
}

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--stone-500);
}
.empty-icon { font-size: 48px; opacity: 0.3; margin-bottom: 12px; }

/* ---------- Loading ---------- */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--navy-900);
  color: white;
  padding: 14px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  min-width: 280px;
  border-left: 4px solid var(--gold-500);
  animation: slide-in 0.3s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
@keyframes slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.3s;
    z-index: 50;
  }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 20px; }
  .mobile-menu-btn { display: inline-flex !important; }
}
.mobile-menu-btn { display: none; }

/* ---------- Utility ---------- */
.hidden { display: none !important; }
.text-muted { color: var(--stone-500); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex-1 { flex: 1; }
