/* ============================================================
   JDN Creative Group — Hoja de estilos principal
   ============================================================ */

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

:root {
  --bg:        #f5f5f3;
  --surface:   #ffffff;
  --border:    #e0ddd6;
  --border-md: #c8c5be;
  --text:      #1a1a1a;
  --text-2:    #555550;
  --text-3:    #888882;
  --accent:    #1a1a1a;
  --radius:    10px;
  --radius-sm: 6px;
  --font:      -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;

  /* semáforo */
  --red:    #E24B4A; --red-bg:    #FCEBEB; --red-text:    #791F1F;
  --yellow: #EF9F27; --yellow-bg: #FAEEDA; --yellow-text: #633806;
  --green:  #639922; --green-bg:  #EAF3DE; --green-text:  #27500A;
  --blue:   #378ADD; --blue-bg:   #E6F1FB; --blue-text:   #0C447C;
}

html { font-size: 14px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.5; }
a    { color: inherit; text-decoration: none; }
img  { max-width: 100%; display: block; }

/* --- Layout shell ----------------------------------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar ---------------------------------------------- */
.sidebar {
  width: 210px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
}

.sidebar-brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand img {
  height: 32px;
  width: auto;
}
.sidebar-brand .brand-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-top: 4px;
}
.sidebar-brand .brand-sub {
  font-size: 11px;
  color: var(--text-3);
}

.sidebar-nav {
  padding: 10px 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 18px;
  font-size: 13px;
  color: var(--text-2);
  border-radius: 0;
  transition: background .12s, color .12s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-link:hover, .nav-link.active {
  background: var(--bg);
  color: var(--text);
}
.nav-link.active { font-weight: 600; }
.nav-link .nav-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 0 16px;
  border-top: 1px solid var(--border);
}

/* --- Main content ----------------------------------------- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.page-body { padding: 24px; flex: 1; }

/* --- Cards ------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.card-sm { padding: 14px 16px; }

/* --- Métricas --------------------------------------------- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.metric-card {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.metric-label { font-size: 11px; color: var(--text-3); margin-bottom: 4px; }
.metric-value { font-size: 24px; font-weight: 600; line-height: 1; }
.metric-sub   { font-size: 11px; color: var(--text-3); margin-top: 4px; }

/* --- Barra de horas --------------------------------------- */
.hours-bar-wrap { margin-bottom: 24px; }
.hours-bar-info { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 8px; }
.hours-big   { font-size: 26px; font-weight: 700; }
.hours-sub   { font-size: 12px; color: var(--text-3); }
.hours-track { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.hours-fill  { height: 100%; border-radius: 4px; background: var(--blue); transition: width .4s; }
.hours-fill.warn   { background: var(--yellow); }
.hours-fill.danger { background: var(--red); }
.hours-meta  { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-top: 5px; }

/* --- Tabla ------------------------------------------------ */
.table-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-top: 6px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th   { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; color: var(--text-3); background: var(--bg); border-bottom: 1px solid var(--border); letter-spacing: .03em; text-transform: uppercase; }
td   { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafaf8; }

/* --- Badges / semáforo ------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.badge-pendiente { background: var(--red-bg);    color: var(--red-text); }
.badge-pendiente .badge-dot { background: var(--red); }

.badge-proceso   { background: var(--yellow-bg); color: var(--yellow-text); }
.badge-proceso .badge-dot   { background: var(--yellow); }

.badge-completado{ background: var(--green-bg);  color: var(--green-text); }
.badge-completado .badge-dot{ background: var(--green); }

/* --- Barra de horas en tabla ------------------------------ */
.mini-bar { width: 80px; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.mini-fill { height: 100%; border-radius: 3px; background: var(--blue); }
.mini-fill.warn   { background: var(--yellow); }
.mini-fill.danger { background: var(--red); }

/* --- Botones ---------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; font-size: 13px;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  cursor: pointer; transition: background .12s;
  font-family: var(--font);
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { opacity: .85; background: var(--accent); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; }

/* --- Formularios ------------------------------------------ */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 5px; }
.form-hint  { font-size: 11px; color: var(--text-3); margin-top: 3px; }

.form-control {
  width: 100%; padding: 8px 11px; font-size: 13px;
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-family: var(--font); transition: border-color .12s;
}
.form-control:focus { outline: none; border-color: var(--accent); }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* --- Tipo de trabajo (selector tarjetas) ------------------ */
.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-opt  {
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  padding: 12px 14px; cursor: pointer;
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; color: var(--text);
  transition: all .15s;
}
.type-opt:hover { background: var(--bg); }
.type-opt.selected { border-color: var(--blue); background: var(--blue-bg); color: var(--blue-text); }
.type-opt input { display: none; }
.type-icon { width: 22px; height: 22px; flex-shrink: 0; }

/* --- Upload area ------------------------------------------ */
.upload-area {
  border: 1.5px dashed var(--border-md); border-radius: var(--radius-sm);
  padding: 20px; text-align: center; cursor: pointer;
  transition: background .15s;
}
.upload-area:hover { background: var(--bg); }
.upload-area p { font-size: 13px; color: var(--text-2); margin-top: 6px; }
.upload-area small { font-size: 11px; color: var(--text-3); }
.upload-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.upload-file { display: flex; align-items: center; gap: 8px; font-size: 12px; background: var(--bg); border-radius: var(--radius-sm); padding: 6px 10px; }
.upload-file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-file-rm { cursor: pointer; color: var(--text-3); font-size: 16px; line-height: 1; }
.upload-file-rm:hover { color: var(--red); }

/* --- Avatar ----------------------------------------------- */
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--blue-bg); color: var(--blue-text);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 52px; height: 52px; font-size: 18px; }

/* --- Alertas ---------------------------------------------- */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; display: flex; align-items: flex-start; gap: 8px; }
.alert-error   { background: var(--red-bg);    color: var(--red-text); }
.alert-success { background: var(--green-bg);  color: var(--green-text); }
.alert-warning { background: var(--yellow-bg); color: var(--yellow-text); }
.alert-info    { background: var(--blue-bg);   color: var(--blue-text); }

/* --- Section header --------------------------------------- */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.section-title { font-size: 14px; font-weight: 600; }

/* --- Filtros ---------------------------------------------- */
.filter-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-row select { font-size: 12px; padding: 5px 9px; border: 1px solid var(--border-md); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); cursor: pointer; }

/* --- Logo cliente en portal ------------------------------- */
.client-logo-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.client-logo-img { height: 36px; width: auto; max-width: 120px; object-fit: contain; }
.client-logo-initials {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--bg); display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: var(--text-2);
  flex-shrink: 0;
}

/* --- LOGIN page ------------------------------------------- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-wrap  { width: 100%; padding: 20px; }
.login-card  {
  max-width: 380px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 36px 32px;
}
.login-logo     { text-align: center; margin-bottom: 24px; }
.login-logo-img { height: 44px; width: auto; margin: 0 auto 10px; }
.login-sub      { font-size: 13px; color: var(--text-3); text-align: center; }
.btn-submit {
  width: 100%; padding: 10px; font-size: 14px; font-weight: 600;
  background: var(--accent); color: #fff; border: none;
  border-radius: var(--radius-sm); cursor: pointer; transition: opacity .15s;
  font-family: var(--font); margin-top: 6px;
}
.btn-submit:hover { opacity: .85; }
.login-footer { text-align: center; font-size: 12px; color: var(--text-3); margin-top: 18px; }
.login-footer a { color: var(--blue); }
.input-icon-wrap { position: relative; }
.input-icon-wrap .form-control { padding-right: 36px; }
.toggle-pass {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--text-3); padding: 2px;
}
.toggle-pass:hover { color: var(--text); }

/* --- Paquete horas badge ---------------------------------- */
.paquete-badge {
  display: inline-block; background: var(--blue-bg); color: var(--blue-text);
  padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600;
}

/* --- Job card (cliente) ----------------------------------- */
.job-list { display: flex; flex-direction: column; gap: 8px; }
.job-card  {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 14px;
  display: flex; align-items: center; gap: 10px;
}
.job-card:hover { border-color: var(--border-md); }
.job-card-info  { flex: 1; min-width: 0; }
.job-card-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-card-meta  { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.job-card-right { text-align: right; flex-shrink: 0; }
.job-card-date  { font-size: 10px; color: var(--text-3); margin-top: 4px; }
.state-dot      { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* --- Responsive básico ------------------------------------ */
@media (max-width: 768px) {
  .sidebar   { display: none; }
  .form-row  { grid-template-columns: 1fr; }
  .page-body { padding: 16px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
}

/* --- Botones de acción con texto ASCII --- */
.btn-edit   { font-size:14px; padding:4px 10px; }
.btn-edit::before { content: '✎ '; }


/* --- Comentarios --- */
.comments-wrap  { display:flex; flex-direction:column; gap:10px; margin-bottom:16px; }
.comment-bubble { padding:10px 14px; border-radius:var(--radius-sm); max-width:90%; }
.comment-admin  { background:var(--bg); border:1px solid var(--border); align-self:flex-start; }
.comment-client { background:var(--blue-bg); border:1px solid var(--border); align-self:flex-end; }
.comment-meta   { font-size:11px; color:var(--text-3); margin-bottom:4px; }
.comment-text   { font-size:13px; color:var(--text); line-height:1.5; white-space:pre-wrap; }
.comment-empty  { text-align:center; color:var(--text-3); font-size:13px; padding:20px 0; }
.comments-box   { border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; }
.comments-list  { padding:14px; max-height:320px; overflow-y:auto; display:flex; flex-direction:column; gap:10px; }
.comments-input { border-top:1px solid var(--border); padding:12px 14px; background:var(--bg); }
