/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
  --blue: #1a56db;
  --blue-dark: #1e40af;
  --blue-light: #eff6ff;
  --blue-mid: #bfdbfe;
  --green: #057a55;
  --green-dark: #065f46;
  --green-light: #f0fdf4;
  --green-mid: #a7f3d0;
  --gray: #374151;
  --gray-light: #f9fafb;
  --gray-mid: #e5e7eb;
  --gray-border: #d1d5db;
  --text: #111827;
  --text-light: #6b7280;
  --white: #ffffff;
  --red: #dc2626;
  --red-light: #fef2f2;
  --yellow: #d97706;
  --yellow-light: #fffbeb;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.05);
  --radius: 8px;
  --radius-lg: 12px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Reset & Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: var(--font);
  background: #f4f6fa;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ── Navbar ────────────────────────────────────────────────────────────── */
.navbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-mid);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.navbar-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.navbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--blue-dark);
}

.navbar-menu {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  color: var(--gray);
  transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--gray-light); color: var(--blue); }
.nav-link.active { background: var(--blue-light); color: var(--blue); }

.btn-primary-nav {
  background: var(--blue);
  color: var(--white) !important;
}
.btn-primary-nav:hover { background: var(--blue-dark) !important; color: var(--white) !important; }

.nav-logout { color: var(--text-light) !important; }
.nav-logout:hover { background: var(--red-light) !important; color: var(--red) !important; }

/* ── Page Wrapper ──────────────────────────────────────────────────────── */
.page-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: .9rem;
  color: var(--text-light);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .8rem;
  color: var(--text-light);
  margin-bottom: 6px;
  transition: color .15s;
}
.back-link:hover { color: var(--blue); }

.quote-number-badge {
  background: var(--blue-light);
  color: var(--blue-dark);
  font-size: .85rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--blue-mid);
  white-space: nowrap;
}

/* ── Alerts ────────────────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: 20px;
}
.alert-success { background: var(--green-light); color: var(--green-dark); border: 1px solid var(--green-mid); }
.alert-error   { background: var(--red-light);   color: var(--red);        border: 1px solid #fecaca; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, box-shadow .15s, transform .1s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--blue);
  color: var(--white);
  box-shadow: 0 1px 3px rgba(26,86,219,.3);
}
.btn-primary:hover { background: var(--blue-dark); box-shadow: 0 4px 8px rgba(26,86,219,.3); }

.btn-outline {
  background: var(--white);
  color: var(--blue);
  border: 1.5px solid var(--blue);
}
.btn-outline:hover { background: var(--blue-light); }

.btn-ghost {
  background: transparent;
  color: var(--gray);
  border: 1.5px solid var(--gray-border);
}
.btn-ghost:hover { background: var(--gray-light); }

.btn-lg { padding: 12px 28px; font-size: .95rem; }
.btn-sm { padding: 6px 12px; font-size: .8rem; }

/* ── Stats Grid ────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 768px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border-left: 4px solid transparent;
}
.stat-blue   { border-color: var(--blue);   }
.stat-green  { border-color: var(--green);  }
.stat-yellow { border-color: var(--yellow); }
.stat-gray   { border-color: var(--gray);   }

.stat-number {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.stat-label { font-size: .8rem; color: var(--text-light); font-weight: 500; }

/* ── Table Card ────────────────────────────────────────────────────────── */
.table-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-responsive { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.data-table thead tr {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
}

.data-table th {
  padding: 14px 16px;
  text-align: left;
  font-size: .78rem;
  font-weight: 600;
  color: var(--white);
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--gray-mid);
  transition: background .1s;
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--blue-light); }

.data-table td { padding: 14px 16px; vertical-align: middle; }

.quote-number {
  font-weight: 700;
  color: var(--blue-dark);
  font-size: .85rem;
  background: var(--blue-light);
  padding: 3px 10px;
  border-radius: 20px;
}

.client-name   { display: block; font-weight: 600; color: var(--text); }
.client-company { display: block; font-size: .8rem; color: var(--text-light); }
.date-text     { color: var(--text-light); font-size: .875rem; }

.total-amount {
  font-weight: 700;
  color: var(--green-dark);
  font-size: .95rem;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: capitalize;
}
.badge-pendiente { background: var(--yellow-light); color: var(--yellow); }
.badge-enviada   { background: var(--blue-light);   color: var(--blue);   }
.badge-aceptada  { background: var(--green-light);  color: var(--green);  }
.badge-rechazada { background: var(--red-light);    color: var(--red);    }

/* Action buttons */
.action-buttons { display: flex; align-items: center; gap: 4px; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: .78rem;
  font-weight: 600;
  transition: background .15s;
  background: transparent;
}

.btn-pdf    { color: var(--green); }
.btn-pdf:hover { background: var(--green-light); }
.btn-edit   { color: var(--blue); }
.btn-edit:hover { background: var(--blue-light); }
.btn-delete { color: var(--red); }
.btn-delete:hover { background: var(--red-light); }

.inline-form { display: inline; }

/* Empty state */
.empty-state {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 64px 24px;
  text-align: center;
  box-shadow: var(--shadow);
}
.empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  background: var(--blue-light);
  border-radius: 50%;
  margin: 0 auto 20px;
  color: var(--blue);
}
.empty-state h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; }
.empty-state p  { color: var(--text-light); margin-bottom: 24px; }

/* ── Form Cards ────────────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 768px) { .form-grid { grid-template-columns: 1fr; } }

.form-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.mt-4 { margin-top: 20px; }

.form-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: linear-gradient(to right, var(--blue-light), var(--white));
  border-bottom: 1px solid var(--gray-mid);
  font-size: .9rem;
  font-weight: 700;
  color: var(--blue-dark);
}
.header-spacer { flex: 1; }

.form-card-body { padding: 20px; }
.form-card-body.p-0 { padding: 0; }

.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }

.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--gray);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--gray-border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: .875rem;
  color: var(--text);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,86,219,.1);
}
.form-input::placeholder { color: var(--text-light); }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

/* ── Items Table ───────────────────────────────────────────────────────── */
.items-table-wrap { overflow-x: auto; }

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

.items-table thead tr {
  background: var(--gray-light);
  border-bottom: 2px solid var(--gray-mid);
}

.items-table th {
  padding: 11px 12px;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.items-table .col-desc  { width: 50%; min-width: 220px; }
.items-table .col-qty   { width: 12%; min-width: 80px; }
.items-table .col-price { width: 18%; min-width: 110px; }
.items-table .col-total { width: 15%; min-width: 100px; }
.items-table .col-del   { width: 5%;  min-width: 40px; }

.items-table .item-row td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--gray-mid);
  vertical-align: middle;
}
.items-table .item-row:last-child td { border-bottom: none; }
.items-table .item-row:hover { background: var(--blue-light); }

.items-table .form-input {
  border-color: transparent;
  background: transparent;
  padding: 6px 8px;
}
.items-table .form-input:focus {
  background: var(--white);
  border-color: var(--blue);
}

.item-total-display {
  font-weight: 700;
  color: var(--green-dark);
  font-size: .9rem;
  display: block;
  text-align: right;
  padding-right: 8px;
}

.btn-remove-item {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color .15s, background .15s;
}
.btn-remove-item:hover { color: var(--red); background: var(--red-light); }

/* Totales */
.totals-panel {
  padding: 20px;
  border-top: 2px solid var(--gray-mid);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.totals-row {
  display: flex;
  gap: 32px;
  font-size: .875rem;
  color: var(--gray);
  min-width: 280px;
  justify-content: space-between;
}

.totals-row span:last-child { font-weight: 600; min-width: 100px; text-align: right; }

.totals-total {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--white);
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  padding: 12px 20px;
  border-radius: var(--radius);
  min-width: 280px;
  margin-top: 4px;
}

/* Form Actions */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-bottom: 32px;
}

/* ── Login Page ────────────────────────────────────────────────────────── */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--blue-light) 0%, #e0f2fe 50%, var(--green-light) 100%);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 2;
}

.login-logo {
  text-align: center;
  margin-bottom: 24px;
}
.login-logo img { height: 56px; width: auto; object-fit: contain; }
.login-brand { font-size: 1.5rem; font-weight: 800; color: var(--blue-dark); }

.login-title {
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
  color: var(--text);
}
.login-subtitle {
  text-align: center;
  color: var(--text-light);
  font-size: .875rem;
  margin-bottom: 28px;
}

.input-icon-wrap { position: relative; }
.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}
.input-icon-wrap .form-input { padding-left: 38px; }

.btn-login {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: box-shadow .15s, transform .1s;
  box-shadow: 0 4px 14px rgba(26,86,219,.3);
}
.btn-login:hover { box-shadow: 0 6px 20px rgba(26,86,219,.4); transform: translateY(-1px); }
.btn-login:active { transform: translateY(0); }

/* Decorative circles */
.login-decoration { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.deco-circle {
  position: absolute;
  border-radius: 50%;
  opacity: 0.6;
}
.deco-1 { width: 300px; height: 300px; background: radial-gradient(circle, var(--blue-mid), transparent); top: -100px; right: -80px; }
.deco-2 { width: 200px; height: 200px; background: radial-gradient(circle, var(--green-mid), transparent); bottom: -60px; left: -60px; }
.deco-3 { width: 150px; height: 150px; background: radial-gradient(circle, var(--blue-mid), transparent); bottom: 40px; right: 20px; }

/* ── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gray-light); }
::-webkit-scrollbar-thumb { background: var(--gray-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--blue); }
