/* ══════════════════════════════════════════════════════════
   INFORMES IO — CSS RESPONSIVO COMPLETO
   Mobile-first: base = móvil, luego tablet, luego desktop
   ══════════════════════════════════════════════════════════ */

:root {
  --naranja:      #E8820C;
  --naranja-dark: #c46e08;
  --naranja-light:#fff4e8;
  --azul:         #1a2744;
  --azul-light:   #2d4a8a;
  --gris-header:  #2d2d2d;
  --fondo:        #f4f5f7;
  --borde:        #dde1e7;
  --texto:        #333;
  --sidebar-w:    240px;
  --topbar-h:     52px;
  --radius:       8px;
  --shadow:       0 2px 8px rgba(0,0,0,.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: 'Segoe UI', system-ui, Arial, sans-serif; background: var(--fondo); color: var(--texto); line-height: 1.5; }
img  { max-width: 100%; }
a    { text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

/* ══ LOGIN ════════════════════════════════════════════════ */
.login-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, var(--azul) 0%, var(--azul-light) 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; z-index: 9999;
}
.login-box {
  background: white; border-radius: 14px; padding: 32px 28px;
  width: 100%; max-width: 380px;
  box-shadow: 0 24px 64px rgba(0,0,0,.35); text-align: center;
}
.login-logo   { height: 52px; margin-bottom: 14px; object-fit: contain; }
.login-box h2 { color: var(--azul); font-size: 20px; margin-bottom: 4px; }
.login-sub    { color: #888; font-size: 13px; margin-bottom: 16px; }
.login-sep    { height: 2px; background: var(--naranja); margin: 0 0 18px; border-radius: 2px; }
.login-error  { color: #c0392b; font-size: 13px; margin-top: 10px; }
.login-hint   { color: #ccc; font-size: 11px; margin-top: 12px; }

/* ══ LAYOUT ═══════════════════════════════════════════════ */
.app-layout { display: flex; min-height: 100vh; }

/* Sidebar — oculto por defecto en móvil, visible desde md */
.sidebar {
  width: var(--sidebar-w); background: var(--azul);
  position: fixed; top: 0; left: 0; height: 100vh;
  overflow-y: auto; z-index: 200;
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform .25s ease;
}
.sidebar.open { transform: translateX(0); }

.sidebar-logo       { padding: 16px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-logo img   { height: 32px; object-fit: contain; }
.nav-section        { color: rgba(255,255,255,.4); font-size: 10px; text-transform: uppercase; letter-spacing: 1px; padding: 14px 16px 5px; font-weight: 700; }
.nav-item           { display: block; padding: 9px 16px; color: rgba(255,255,255,.75); font-size: 13px; border-left: 3px solid transparent; transition: all .2s; cursor: pointer; }
.nav-item:hover,
.nav-item.active    { background: rgba(232,130,12,.15); color: var(--naranja); border-left-color: var(--naranja); }

/* Overlay backdrop para móvil */
.sidebar-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 199;
}
.sidebar-backdrop.open { display: block; }

/* Main area */
.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* Topbar */
.topbar {
  background: white; border-bottom: 1px solid var(--borde);
  padding: 0 16px; height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100; gap: 12px;
}
.topbar-left  { display: flex; align-items: center; gap: 10px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-user  { font-size: 13px; color: #666; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }

/* Hamburger */
.hamburger {
  background: none; border: none; cursor: pointer; padding: 6px;
  display: flex; flex-direction: column; gap: 4px;
}
.hamburger span { display: block; width: 22px; height: 2px; background: var(--azul); border-radius: 2px; transition: all .2s; }

/* Content */
.content-area { padding: 16px; flex: 1; }

/* ══ TABLET md: 768px ══════════════════════════════════ */
@media (min-width: 768px) {
  .content-area { padding: 20px; }
  .topbar { padding: 0 22px; }
}

/* ══ DESKTOP lg: 1024px ════════════════════════════════ */
@media (min-width: 1024px) {
  .sidebar            { transform: translateX(0); } /* siempre visible */
  .hamburger          { display: none; }
  .sidebar-backdrop   { display: none !important; }
  .main-area          { margin-left: var(--sidebar-w); }
  .content-area       { padding: 22px 24px; }
  .topbar             { padding: 0 24px; }
  .topbar-user        { max-width: 260px; }
}

/* ══ GENERAL ══════════════════════════════════════════════ */
.page-title  { font-size: 17px; font-weight: 700; color: var(--azul); margin-bottom: 16px; }
.page-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.page-header .page-title { margin-bottom: 0; }

.card {
  background: white; border-radius: var(--radius);
  border: 1px solid var(--borde); padding: 16px;
  margin-bottom: 14px; box-shadow: var(--shadow);
}
.card-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 2px solid var(--naranja); }
.card-header h3 { font-size: 14px; font-weight: 600; color: var(--azul); }
.sec-header { background: var(--gris-header); color: white; padding: 8px 14px; border-radius: 5px; font-size: 12.5px; font-weight: 600; text-align: center; letter-spacing: .5px; margin-bottom: 12px; }
.hint-text  { font-size: 12px; color: #999; margin-bottom: 8px; }
.empty-msg  { color: #888; font-size: 13px; padding: 14px 0; }

.mt-16 { margin-top: 16px; }
.mt-12 { margin-top: 12px; }
.mt-10 { margin-top: 10px; }
.mb-12 { margin-bottom: 12px; }
.mb-10 { margin-bottom: 10px; }

/* ══ FORMS ════════════════════════════════════════════════ */
.field-group { display: flex; flex-direction: column; gap: 4px; }
.field-group label { font-size: 11px; font-weight: 700; color: #666; text-transform: uppercase; letter-spacing: .5px; }
.field-group input,
.field-group select,
.field-group textarea {
  padding: 8px 11px; border: 1.5px solid #ddd; border-radius: 6px;
  font-size: 14px; outline: none; transition: border-color .2s; background: white; width: 100%;
}
.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus { border-color: var(--naranja); box-shadow: 0 0 0 3px rgba(232,130,12,.08); }
.field-group textarea { resize: vertical; min-height: 52px; }

.form-grid   { display: grid; gap: 12px; }
/* 1 col en móvil */
.form-grid-2 { grid-template-columns: 1fr; }
.form-grid-3 { grid-template-columns: 1fr; }

@media (min-width: 600px) {
  .form-grid-2 { grid-template-columns: repeat(2, 1fr); }
  .form-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .form-grid-3 { grid-template-columns: repeat(3, 1fr); }
}

.form-inline { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.form-inline input,
.form-inline select { padding: 8px 11px; border: 1.5px solid #ddd; border-radius: 6px; font-size: 13px; outline: none; flex: 1; min-width: 140px; }
.btn-full { width: 100%; justify-content: center; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ══ BUTTONS ══════════════════════════════════════════════ */
.btn-primary, .btn-secondary, .btn-success, .btn-danger {
  padding: 9px 16px; border-radius: 7px; border: none; cursor: pointer;
  font-size: 13px; font-weight: 600; display: inline-flex; align-items: center;
  gap: 6px; transition: all .2s; white-space: nowrap;
}
.btn-primary   { background: var(--naranja); color: white; }
.btn-primary:hover   { background: var(--naranja-dark); }
.btn-secondary { background: white; color: var(--azul); border: 1.5px solid #ddd; }
.btn-secondary:hover { background: #f5f5f5; }
.btn-success   { background: #27ae60; color: white; }
.btn-success:hover   { background: #219a52; }
.btn-danger    { background: #e74c3c; color: white; }
.btn-danger:hover    { background: #c0392b; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 5px; }
.disabled { pointer-events: none; opacity: .5; }

/* ══ TABLES ═══════════════════════════════════════════════ */
/* Wrapper para scroll horizontal en móvil */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
.data-table th { background: #f8f8f8; padding: 9px 10px; text-align: left; font-weight: 600; color: #555; border-bottom: 2px solid #e0e0e0; font-size: 11px; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 9px 10px; border-bottom: 1px solid #f0f0f0; }
.data-table tr:hover td { background: #fafafa; }
.data-table .actions { display: flex; gap: 5px; flex-wrap: wrap; }

.badge        { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-green  { background: #d4edda; color: #1a6b35; }
.badge-orange { background: #fff3cd; color: #856404; }
.badge-red    { background: #f8d7da; color: #721c24; }

/* ══ COMPONENT TABLE HW/SW/MP ═════════════════════════════ */
.comp-table { border: 1px solid #e8e8e8; border-radius: 6px; overflow: hidden; }

/* Desktop: 3 columnas */
.comp-table-header {
  display: none; /* oculto en móvil */
  background: #f5f5f5; padding: 7px 10px;
  font-size: 11px; font-weight: 700; color: #666; text-transform: uppercase;
}
/* Filas: cards apiladas en móvil */
.comp-row {
  display: flex; flex-direction: column;
  border-top: 1px solid #f0f0f0; padding: 8px 10px; gap: 6px;
}
.comp-row:hover { background: #fafafa; }
.comp-label     { font-size: 13px; font-weight: 600; color: var(--azul); }
.comp-row select,
.comp-row textarea {
  width: 100%; border: 1.5px solid #ddd; border-radius: 5px;
  padding: 6px 9px; font-size: 13px; background: white; outline: none; font-family: inherit;
}
.comp-row select:focus,
.comp-row textarea:focus { border-color: var(--naranja); }
.comp-row textarea { resize: vertical; min-height: 34px; }
.comp-row-labels { display: flex; gap: 6px; }
.comp-row-label-s { font-size: 10px; color: #999; text-transform: uppercase; font-weight: 600; }

@media (min-width: 768px) {
  .comp-table-header { display: grid; grid-template-columns: 170px 190px 1fr; }
  .comp-row          { flex-direction: row; align-items: center; padding: 4px 0; gap: 0; }
  .comp-label        { width: 170px; min-width: 170px; padding: 6px 10px; font-weight: 400; color: var(--texto); }
  .comp-row select   { width: 190px; min-width: 190px; border: none; border-left: 1px solid #eee; border-right: 1px solid #eee; border-radius: 0; height: 36px; }
  .comp-row textarea { border: none; border-radius: 0; min-height: 34px; flex: 1; }
  .comp-row-labels   { display: none; }
}

/* ══ PHOTOS ═══════════════════════════════════════════════ */
.photo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 600px) { .photo-grid { grid-template-columns: repeat(3, 1fr); } }

.photo-slot {
  border: 2px dashed #ddd; border-radius: 8px; min-height: 160px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative; overflow: hidden; background: #fafafa; transition: border-color .2s;
}
.photo-slot:hover   { border-color: var(--naranja); }
.photo-slot img     { width: 100%; height: 140px; object-fit: cover; }
.photo-add          { display: flex; flex-direction: column; align-items: center; gap: 6px; color: #bbb; font-size: 12px; cursor: pointer; padding: 16px; text-align: center; }
.photo-cap          { width: 100%; border: none; border-top: 1px solid #eee; padding: 5px 8px; font-size: 11px; background: white; font-family: inherit; }
.photo-remove       { position: absolute; top: 5px; right: 5px; background: rgba(231,76,60,.85); color: white; border: none; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.photo-add-slot     { cursor: pointer; color: #bbb; font-size: 12px; }
.photo-add-slot:hover { border-color: var(--naranja); color: var(--naranja); }

/* ══ STATS ════════════════════════════════════════════════ */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
@media (min-width: 768px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }

.stat-card  { background: white; border-radius: var(--radius); border: 1px solid var(--borde); padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.stat-icon  { width: 44px; height: 44px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.stat-num   { font-size: 22px; font-weight: 700; color: var(--azul); }
.stat-lbl   { font-size: 11.5px; color: #888; }

/* ══ ALERTS ═══════════════════════════════════════════════ */
.alert        { padding: 11px 16px; border-radius: 7px; margin-bottom: 14px; font-size: 13px; }
.alert-success { background: #d4edda; color: #1a6b35; border: 1px solid #c3e6cb; }
.alert-danger  { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ══ MODAL ════════════════════════════════════════════════ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 500; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal         { background: white; border-radius: 12px; padding: 24px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal h3      { margin-bottom: 8px; color: var(--azul); }
.modal-footer  { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid #eee; }

/* ══ TABS ═════════════════════════════════════════════════ */
.tabs         { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; border-bottom: 2px solid #eee; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tab-btn      { padding: 8px 14px; border: none; background: none; cursor: pointer; font-size: 13px; font-weight: 500; color: #888; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .2s; white-space: nowrap; flex-shrink: 0; }
.tab-btn.active,
.tab-btn:hover { color: var(--naranja); border-bottom-color: var(--naranja); }

/* ══ SEARCH ═══════════════════════════════════════════════ */
.search-input { width: 100%; padding: 9px 14px; border: 1.5px solid #ddd; border-radius: 8px; font-size: 13px; outline: none; margin-bottom: 12px; }
.search-input:focus { border-color: var(--naranja); }

/* ══ UTILITIES ════════════════════════════════════════════ */
.text-center { text-align: center; }
.text-muted  { color: #888; font-size: 13px; }
.w-full      { width: 100%; }
.flex        { display: flex; }
.flex-wrap   { flex-wrap: wrap; }
.items-center { align-items: center; }
.gap-8       { gap: 8px; }
.gap-10      { gap: 10px; }

/* ══ INFORME FORM: botones en móvil apilados ══════════════ */
.form-actions { display: flex; flex-direction: column; gap: 8px; }
@media (min-width: 600px) { .form-actions { flex-direction: row; align-items: center; flex-wrap: wrap; } }
