﻿/* ═══════════════════════════════════════════════════════════════
   ROTULACIONES ASC — ESTILO MODERNO SHADCN/UI & TAILWIND
   ═══════════════════════════════════════════════════════════════ */

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

:root {
  --background: #f8fafc;
  --foreground: #0f172a;
  --card: #ffffff;
  --card-foreground: #0f172a;
  --popover: #ffffff;
  --popover-foreground: #0f172a;
  --primary: #c0392b;
  --primary-foreground: #ffffff;
  --primary-hover: #a93226;
  --secondary: #f1f5f9;
  --secondary-foreground: #1e293b;
  --muted: #f1f5f9;
  --muted-foreground: #64748b;
  --accent: #f8fafc;
  --accent-foreground: #0f172a;
  --destructive: #ef4444;
  --destructive-foreground: #ffffff;
  --border: #e2e8f0;
  --input: #e2e8f0;
  --ring: #c0392b;
  --radius: 0.65rem;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT CONTENEDOR PRINCIPAL ── */
.app-shell {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── HEADER MODERNO ── */
.modern-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

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

.modern-header .brand img {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.modern-header .brand-text h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--foreground);
  letter-spacing: -0.01em;
}

.modern-header .brand-text p {
  font-size: 11.5px;
  color: var(--muted-foreground);
}

.modern-header .user-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── TABS SHADCN PILL ── */
.shadcn-tabs {
  display: inline-flex;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background-color: #f1f5f9;
  padding: 3px;
  border: 1px solid var(--border);
  margin-bottom: 20px;
  width: 100%;
  overflow-x: auto;
}

.shadcn-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border-radius: calc(var(--radius) - 2px);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-foreground);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  gap: 6px;
  flex: 1;
}

.shadcn-tab-btn:hover {
  color: var(--foreground);
}

.shadcn-tab-btn.active {
  background-color: #ffffff;
  color: var(--foreground);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ── TARJETAS Y PANELES ── */
.modern-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  padding: 24px;
  margin-bottom: 20px;
}

.panel-tab {
  display: none;
}

.panel-tab.active {
  display: block;
  animation: fadeIn 0.18s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── FORMULARIOS Y CONTROLES ── */
.form-section-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--foreground);
  letter-spacing: -0.01em;
  margin: 18px 0 10px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-section-title:first-child {
  margin-top: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
}

.input-group label {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

.shadcn-input, select.shadcn-input, textarea.shadcn-input {
  width: 100%;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: #ffffff;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--foreground);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}

.shadcn-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.12);
}

/* ── BOTONES SHADCN ── */
.btn-shadcn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: calc(var(--radius) - 2px);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  gap: 6px;
  white-space: nowrap;
}

.btn-shadcn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-shadcn-primary:hover {
  background: var(--primary-hover);
}

.btn-shadcn-default {
  background: #0f172a;
  color: #ffffff;
}

.btn-shadcn-default:hover {
  background: #1e293b;
}

.btn-shadcn-outline {
  background: #ffffff;
  border-color: var(--border);
  color: #0f172a;
}

.btn-shadcn-outline:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-shadcn-ghost {
  background: transparent;
  color: var(--muted-foreground);
}

.btn-shadcn-ghost:hover {
  background: #f1f5f9;
  color: var(--foreground);
}

.btn-shadcn-destructive {
  background: #ef4444;
  color: #ffffff;
}

.btn-shadcn-destructive:hover {
  background: #dc2626;
}

.btn-shadcn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* ── TARJETAS DE ÓRDENES (DASHBOARD) ── */
.orders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}

.order-item-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.order-item-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.order-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 8px;
}

.order-badge-ref {
  font-size: 13px;
  font-weight: 800;
  color: var(--primary);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.status-badge.pendiente {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.status-badge.en_curso {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.status-badge.firmada {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.order-item-client {
  font-size: 15px;
  font-weight: 700;
  color: var(--foreground);
}

.order-item-meta {
  font-size: 12px;
  color: var(--muted-foreground);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.order-item-meta a {
  color: inherit;
  text-decoration: none;
}

.order-item-meta a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.order-item-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #f8fafc;
}

/* ── TABLA DE POSICIONES Y PRECIOS ── */
.positions-table-wrap {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  overflow-x: auto;
  margin: 10px 0;
  background: #ffffff;
}

.positions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.positions-table th {
  background: #f8fafc;
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--muted-foreground);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
}

.positions-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.positions-table input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 12px;
}

.positions-table input:focus {
  border-color: var(--primary);
  outline: none;
}

.total-summary-card {
  margin-left: auto;
  max-width: 280px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  margin-bottom: 18px;
}

.total-summary-card .row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted-foreground);
}

.total-summary-card .row.total-final {
  border-top: 1px solid var(--border);
  padding-top: 6px;
  font-size: 14px;
  font-weight: 800;
  color: var(--primary);
}

/* ── PANTALLA DE LOGIN SHADCN ── */
.login-backdrop {
  position: fixed;
  inset: 0;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 99999;
}

.login-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
  width: 100%;
  max-width: 400px;
  padding: 30px 28px;
}

/* ── MODALES ── */
.modern-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 10000;
}

.modern-modal-backdrop.open {
  display: flex;
}

.modern-modal-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.14);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modern-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modern-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modern-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  background: #f8fafc;
}

/* ── CANVAS DE FIRMA ── */
.sig-canvas-container {
  border: 1.5px dashed #cbd5e1;
  border-radius: calc(var(--radius) - 2px);
  background: #ffffff;
  overflow: hidden;
  position: relative;
  touch-action: none;
}

.sig-canvas-container canvas {
  width: 100%;
  height: 180px;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

/* ── TOAST MODERNO ── */
.modern-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: calc(var(--radius) - 2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  font-size: 13px;
  font-weight: 500;
  display: none;
  align-items: center;
  gap: 8px;
  z-index: 100000;
  animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modern-toast.success { background: #065f46; }
.modern-toast.error { background: #b91c1c; }
.modern-toast.info { background: #1e3a8a; }
