/* ==========================================================================
   ARCODIC SpA - Admin Master Panel CSS Stylesheet (Full CMS v2.0)
   ========================================================================== */

:root {
  --bg-dark: #0F172A;
  --bg-surface: #1E293B;
  --bg-card: #1E293B;
  --bg-sidebar: #0B1120;
  
  --primary-cyan: #06B6D4;
  --primary-cyan-hover: #0891B2;
  --accent-orange: #F97316;
  --accent-orange-hover: #EA580C;
  --success-green: #10B981;
  --warning-amber: #F59E0B;
  --danger-red: #EF4444;

  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-dim: #64748B;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: rgba(6, 182, 212, 0.4);

  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* AUTENTICACIÓN */
.auth-wrapper {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #1e293b 0%, #0b1120 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.auth-logo-box {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary-cyan), #0284c7);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.5rem;
  color: #fff;
}

.auth-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.75rem;
}

/* LAYOUT PRINCIPAL */
.admin-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-navbar {
  height: 64px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #fff;
}

.nav-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: var(--primary-cyan);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #000;
}

.nav-brand .brand-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
}

.nav-brand .brand-status {
  font-size: 0.75rem;
  color: var(--primary-cyan);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--success-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--success-green);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-container {
  display: flex;
  flex: 1;
}

/* SIDEBAR NAVIGATION */
.admin-sidebar {
  width: 270px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
  max-height: calc(100vh - 64px);
}

.sidebar-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0.75rem 0.75rem 0.25rem;
  letter-spacing: 0.08em;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.nav-item.active {
  background: rgba(6, 182, 212, 0.12);
  color: var(--primary-cyan);
  font-weight: 600;
  border-left: 3px solid var(--primary-cyan);
}

.nav-item i {
  width: 20px;
  margin-right: 0.5rem;
}

.badge {
  background: var(--accent-orange);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
}

/* MAIN CONTENT AREA */
.admin-main {
  flex: 1;
  padding: 2rem;
  background: var(--bg-dark);
  overflow-y: auto;
  max-height: calc(100vh - 64px);
}

.tab-content {
  display: none;
}

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

.panel-header {
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.panel-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
}

.panel-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* CARDS & PANELS */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* METRICS GRID */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.icon-cyan { background: rgba(6, 182, 212, 0.15); color: var(--primary-cyan); }
.icon-orange { background: rgba(249, 115, 22, 0.15); color: var(--accent-orange); }
.icon-green { background: rgba(16, 185, 129, 0.15); color: var(--success-green); }
.icon-purple { background: rgba(168, 85, 247, 0.15); color: #a855f7; }

.metric-val {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
}

.metric-lbl {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* FORM CONTROLS */
.form-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
}

.form-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-main);
}

.form-control {
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.9rem;
  transition: border-color 0.15s ease;
  width: 100%;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-cyan);
}

textarea.form-control {
  resize: vertical;
}

/* BOTONES */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary { background: var(--primary-cyan); color: #000; }
.btn-primary:hover { background: var(--primary-cyan-hover); }

.btn-orange { background: var(--accent-orange); color: #fff; }
.btn-orange:hover { background: var(--accent-orange-hover); }

.btn-secondary { background: rgba(255, 255, 255, 0.08); color: var(--text-main); }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.15); }

.btn-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger-red); }
.btn-danger:hover { background: var(--danger-red); color: #fff; }

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }

/* TABLAS */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.admin-table th {
  background: #0f172a;
  padding: 0.85rem 1rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

.admin-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* BADGES DE ESTADO */
.status-pill {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-block;
}

.status-nuevo { background: rgba(6, 182, 212, 0.15); color: var(--primary-cyan); }
.status-revision { background: rgba(245, 158, 11, 0.15); color: var(--warning-amber); }
.status-cotizado { background: rgba(16, 185, 129, 0.15); color: var(--success-green); }
.status-cerrado { background: rgba(100, 116, 139, 0.2); color: var(--text-muted); }

/* MODALES */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 550px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-close:hover { color: #fff; }

/* UTILITIES */
.text-cyan { color: var(--primary-cyan); }
.text-orange { color: var(--accent-orange); }
.text-green { color: var(--success-green); }
.text-muted { color: var(--text-muted); }

/* LIVE PREVIEW IFRAME VIEW */
.preview-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 170px);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.preview-bar {
  background: #0b1120;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #0f172a;
}
