/* ============================================================
   Orbita Soluciones — app.css
   Tema light, limpio y responsivo
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --brand:        #1A6FD4;
  --brand-hover:  #1558AA;
  --brand-light:  #EBF3FC;
  --brand-border: rgba(26,111,212,0.18);

  --surface:      #F4F7FB;
  --card:         #FFFFFF;
  --card-border:  #E4EAF3;

  --text-1:       #0D1B2E;
  --text-2:       #4A607A;
  --text-3:       #8AA0BC;

  --success:      #10B981;
  --success-bg:   #ECFDF5;
  --warning:      #F59E0B;
  --warning-bg:   #FFFBEB;
  --danger:       #EF4444;
  --danger-bg:    #FEF2F2;
  --info:         #3B82F6;
  --info-bg:      #EFF6FF;

  --sidebar-w:    240px;
  --topbar-h:     60px;
  --radius:       10px;
  --radius-lg:    14px;
  --shadow:       0 1px 4px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
  --shadow-md:    0 4px 24px rgba(26,111,212,0.10);

  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--surface); color: var(--text-1); line-height: 1.6; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }
img { max-width: 100%; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ── Login ──────────────────────────────────────────────────── */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #F0F5FB; overflow: hidden; position: relative; }
.login-bg   { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.orbit-ring { position: absolute; border-radius: 50%; top: 50%; left: 50%; transform: translate(-50%,-50%); }
.orbit-ring.r1 { width: 520px; height: 520px; border: 1px solid rgba(26,111,212,.14); }
.orbit-ring.r2 { width: 760px; height: 760px; border: 1px solid rgba(26,111,212,.09); }
.orbit-ring.r3 { width: 1050px; height: 1050px; border: 1px solid rgba(26,111,212,.05); }
.orbit-dot  { position: absolute; border-radius: 50%; top: 50%; left: 50%; transform-origin: 0 0; }
.orbit-dot.d1 { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: #1A6FD4; box-shadow: 0 0 8px 2px rgba(26,111,212,.4); animation: spin1 18s linear infinite; }
.orbit-dot.d2 { width: 4px; height: 4px; margin: -2px 0 0 -2px; background: #5A9EE8; box-shadow: 0 0 6px 1px rgba(90,158,232,.35); animation: spin2 28s linear infinite reverse; }
.bg-glow    { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 700px; height: 500px; background: radial-gradient(ellipse at center, rgba(26,111,212,.07) 0%, transparent 70%); pointer-events: none; }
@keyframes spin1 { from { transform: rotate(0deg) translateX(260px); } to { transform: rotate(360deg) translateX(260px); } }
@keyframes spin2 { from { transform: rotate(0deg) translateX(380px); } to { transform: rotate(360deg) translateX(380px); } }
.login-wrapper { position: relative; z-index: 10; width: 100%; max-width: 420px; padding: 0 20px; }
.login-card { background: #fff; border: 1px solid var(--brand-border); border-radius: 20px; padding: 44px 40px 40px; box-shadow: 0 8px 40px rgba(26,111,212,.08), 0 2px 8px rgba(0,0,0,.06); position: relative; overflow: hidden; }
.login-card::before { content: ''; position: absolute; top: 0; left: 30px; right: 30px; height: 1px; background: linear-gradient(90deg, transparent, rgba(26,111,212,.4), transparent); }
.login-logo-area { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 32px; }
.login-logo-area img { height: 50px; object-fit: contain; }
.login-tagline { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--text-3); }
.login-title { font-size: 18px; font-weight: 500; color: var(--text-1); margin-bottom: 4px; }
.login-subtitle { font-size: 13px; color: var(--text-2); margin-bottom: 24px; font-weight: 300; }
.login-card-footer { text-align: center; margin-top: 20px; }
.login-card-footer p { font-size: 12px; color: var(--text-3); }
.login-support { text-align: center; margin-top: 16px; font-size: 12px; color: var(--text-3); }
.login-support a { color: var(--text-2); transition: color .2s; }
.login-support a:hover { color: var(--brand); }
.btn-login { width: 100%; margin-top: 8px; padding: 13px; background: var(--brand); border: none; border-radius: var(--radius); font-size: 14px; font-weight: 500; color: #fff; cursor: pointer; transition: background .2s, transform .15s; }
.btn-login:hover { background: var(--brand-hover); transform: translateY(-1px); }
.btn-login:active { transform: translateY(0); }

/* ── Form fields ─────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px; }
.input-wrap { position: relative; }
.input-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); display: flex; pointer-events: none; }
.input-icon svg { width: 16px; height: 16px; }
.field-row { display: flex; justify-content: flex-end; margin-top: -6px; margin-bottom: 16px; }

/* Estilos globales para todos los inputs, selects y textareas */
input:not([type="file"]):not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  background: #F5F9FF;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-1);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  font-family: var(--font);
  line-height: 1.5;
  appearance: none;
  -webkit-appearance: none;
}
select {
  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='%238AA0BC' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}
textarea {
  resize: vertical;
  min-height: 80px;
}
input::placeholder,
textarea::placeholder {
  color: var(--text-3);
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26,111,212,.12);
  background: #fff;
}
input:disabled,
select:disabled,
textarea:disabled {
  background: var(--surface);
  color: var(--text-3);
  cursor: not-allowed;
}
.with-icon { padding-left: 38px; }

/* Inputs pequeños dentro de tablas o componentes compactos */
input[style*="width:"],
select[style*="width:"] {
  width: auto;
}
.cond-select {
  width: auto;
  padding: 5px 32px 5px 10px;
  font-size: 13px;
}
input[type="number"] {
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  opacity: 0.4;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar { width: var(--sidebar-w); height: 100vh; background: #fff; border-right: 1px solid var(--card-border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; z-index: 100; transition: transform .25s; }
.sidebar-header { padding: 20px 20px 16px; border-bottom: 1px solid var(--card-border); }
.sidebar-logo { height: 36px; object-fit: contain; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; font-size: 14px; color: var(--text-2); transition: background .15s, color .15s; margin-bottom: 2px; }
.nav-item:hover, .nav-item.active { background: var(--brand-light); color: var(--brand); }
.nav-item.active { font-weight: 500; }
.nav-item i { width: 18px; text-align: center; flex-shrink: 0; }
.nav-separator { padding: 14px 12px 4px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.sidebar-footer { padding: 14px 12px; border-top: 1px solid var(--card-border); display: flex; align-items: center; gap: 8px; }
.user-info { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
a.user-info:hover .user-name { color: var(--brand); }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-light); color: var(--brand); font-weight: 600; font-size: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-size: 13px; font-weight: 500; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-3); text-transform: capitalize; }
.btn-logout { padding: 6px 8px; border-radius: 6px; color: var(--text-3); transition: color .15s, background .15s; }
.btn-logout:hover { color: var(--danger); background: var(--danger-bg); }

/* ── Main wrapper ────────────────────────────────────────── */
.main-wrapper { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { height: var(--topbar-h); background: #fff; border-bottom: 1px solid var(--card-border); display: flex; align-items: center; gap: 14px; padding: 0 24px; position: sticky; top: 0; z-index: 50; }
.page-title { font-size: 16px; font-weight: 500; color: var(--text-1); flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.sidebar-toggle { display: none; background: none; border: none; cursor: pointer; color: var(--text-2); padding: 6px; border-radius: 6px; }
.sidebar-toggle:hover { background: var(--surface); }
.main-content { flex: 1; padding: 24px; max-width: 1200px; width: 100%; }

/* ── Cards ───────────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius-lg); padding: 20px 24px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-title { font-size: 15px; font-weight: 500; color: var(--text-1); }
.card + .card { margin-top: 16px; }

/* ── Stat cards ──────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius-lg); padding: 18px 20px; }
.stat-label { font-size: 12px; color: var(--text-3); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 600; color: var(--text-1); }
.stat-icon  { font-size: 20px; margin-bottom: 8px; }

/* ── Botones ─────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; transition: background .15s, border-color .15s, transform .1s; border: 1px solid transparent; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); color: #fff; }
.btn-secondary { background: var(--surface); border-color: var(--card-border); color: var(--text-1); }
.btn-secondary:hover { background: var(--card-border); }
.btn-danger  { background: var(--danger-bg); border-color: #FCA5A5; color: var(--danger); }
.btn-danger:hover { background: #FEE2E2; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 7px; border-radius: 7px; }

/* ── Tablas ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); padding: 10px 14px; border-bottom: 1px solid var(--card-border); }
tbody td { padding: 12px 14px; border-bottom: 1px solid #F0F4FA; color: var(--text-1); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface); }

/* ── Badges ──────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-success  { background: var(--success-bg);  color: #059669; }
.badge-warning  { background: var(--warning-bg);  color: #D97706; }
.badge-danger   { background: var(--danger-bg);   color: #DC2626; }
.badge-info     { background: var(--info-bg);     color: #2563EB; }
.badge-neutral  { background: var(--surface);     color: var(--text-2); border: 1px solid var(--card-border); }

/* ── Flash messages ──────────────────────────────────────── */
.flash { padding: 12px 16px; border-radius: var(--radius); margin: 0 24px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; }
.flash-success { background: var(--success-bg); color: #065F46; border: 1px solid #A7F3D0; }
.flash-error   { background: var(--danger-bg);  color: #991B1B; border: 1px solid #FCA5A5; }
.flash-info    { background: var(--info-bg);    color: #1E40AF; border: 1px solid #BFDBFE; }
.flash-warning { background: var(--warning-bg); color: #92400E; border: 1px solid #FDE68A; }
.flash-close   { background: none; border: none; cursor: pointer; font-size: 14px; opacity: .6; }
.flash-close:hover { opacity: 1; }

/* ── Condición de componente ─────────────────────────────── */
.cond-bueno         { color: #059669; }
.cond-regular       { color: #D97706; }
.cond-malo          { color: #DC2626; }
.cond-requiere_cambio { color: #7C3AED; }
select.cond-select  { border-radius: 6px; padding: 4px 8px; font-size: 13px; }

/* ── Adjuntos ────────────────────────────────────────────── */
.adjuntos-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.adjunto-thumb { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; border: 1px solid var(--card-border); cursor: pointer; transition: opacity .15s; }
.adjunto-thumb:hover { opacity: .85; }
.adjunto-video { width: 72px; height: 72px; border-radius: 8px; background: var(--surface); border: 1px solid var(--card-border); display: flex; align-items: center; justify-content: center; font-size: 22px; cursor: pointer; }
.file-upload-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1px dashed var(--brand-border); border-radius: 8px; color: var(--brand); font-size: 13px; cursor: pointer; transition: background .15s; }
.file-upload-btn:hover { background: var(--brand-light); }
input[type="file"] { display: none; }

/* ── Firma canvas ────────────────────────────────────────── */
.firma-canvas-wrap { border: 1px solid var(--card-border); border-radius: var(--radius); background: #fff; display: inline-block; touch-action: none; }
canvas.firma-canvas { display: block; cursor: crosshair; }
.firma-actions { display: flex; gap: 8px; margin-top: 8px; }
.firma-preview img { max-height: 80px; border: 1px solid var(--card-border); border-radius: 8px; }

/* ── Calendario ──────────────────────────────────────────── */
#calendario { background: var(--card); border-radius: var(--radius-lg); border: 1px solid var(--card-border); }

/* ── Condición colored row ───────────────────────────────── */
.row-malo { background: #FFF5F5; }
.row-regular { background: #FFFBEB; }

/* ── Sección de mantención ───────────────────────────────── */
.section-block { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius-lg); margin-bottom: 16px; overflow: hidden; }
.section-block-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--card-border); background: var(--surface); cursor: pointer; user-select: none; }
.section-block-title { font-size: 14px; font-weight: 500; color: var(--text-1); }
.section-block-body  { padding: 20px; }

/* ── Parametro grid ──────────────────────────────────────── */
.param-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.param-card { background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 16px; }
.param-title { font-size: 13px; font-weight: 500; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 12px; }
.param-row   { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 10px; }
.param-row .field { flex: 1; margin-bottom: 0; }

/* ── Public layout ───────────────────────────────────────── */
.body-public { background: var(--surface); }
.public-header { background: #fff; border-bottom: 1px solid var(--card-border); padding: 16px 40px; }
.public-logo { height: 40px; object-fit: contain; }
.public-content { max-width: 960px; margin: 0 auto; padding: 32px 20px; }
.public-footer { text-align: center; padding: 24px; font-size: 12px; color: var(--text-3); border-top: 1px solid var(--card-border); margin-top: 32px; }

/* ── Icons (SVG inline, reemplazar por iconset real) ──────── */
.icon-grid::before       { content: '⊞'; }
.icon-calendar::before   { content: '📅'; }
.icon-tool::before       { content: '🔧'; }
.icon-building::before   { content: '🏢'; }
.icon-map-pin::before    { content: '📍'; }
.icon-users::before      { content: '👥'; }
.icon-cpu::before        { content: '⚙️'; }
.icon-package::before    { content: '📦'; }
.icon-logout::before     { content: '→'; font-size: 16px; }
.icon-menu::before       { content: '☰'; font-size: 18px; }
/* Reemplazar por fuente de íconos como Lucide o Tabler en producción */
[class^="icon-"] { font-style: normal; }

/* ── Utilidades ──────────────────────────────────────────── */
.mb-4    { margin-bottom: 16px; }
.mb-6    { margin-bottom: 24px; }
.mt-4    { margin-top: 16px; }
.flex    { display: flex; }
.gap-2   { gap: 8px; }
.gap-3   { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-muted { color: var(--text-3); }
.w-full  { width: 100%; }
.grid-2  { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3  { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.divider { border: none; border-top: 1px solid var(--card-border); margin: 20px 0; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty-state p { font-size: 14px; margin-top: 8px; }

/* ── Responsivo ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.1); }
  .main-wrapper { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .main-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .login-card { padding: 32px 24px; }
  .stats-grid { grid-template-columns: 1fr; }
  .param-grid { grid-template-columns: 1fr; }
}
