/* ══════════════════════════════════════════════
   Panel de administracion — design tokens (ADR 0033, decision de estilo).
   Portados como CSS vanilla del :root de Memo-Nova/Frontend/src/styles.css.
   NO se porta theme.less (es de ng-zorro/Angular).
   ══════════════════════════════════════════════ */
:root {
    --brand-primary:      #1A1A2E;
    --brand-primary-end:  #2A2A4E;
    --brand-accent:       #C96A3A;
    --brand-accent-hover: #A84E25;
    --brand-accent-light: #FBF0E8;
    --brand-accent-ring:  rgba(201, 106, 58, 0.25);

    --color-success:      #4A7C59;
    --color-success-bg:   #E8F0E8;
    --color-error:        #ef4444;
    --color-error-bg:     #fee2e2;
    --color-warning-text: #92400e;
    --color-warning-bg:   #fef3c7;

    --text-primary:       #2D2D2D;
    --text-secondary:     #6b7280;
    --text-medium:        #374151;
    --text-muted:         #737373;

    --bg-page:            #F5F0E8;
    --bg-white:           #ffffff;
    --bg-gray-light:      #fafafa;

    --border-brand:       #E8E0D0;
    --border-default:     #d1d5db;

    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);

    --radius-default: 6px;
    --transition-suave: 0.15s ease;
    --font-inter: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-inter);
    background-color: var(--bg-page);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar oscuro ── */
.sidebar {
    width: 220px;
    background: linear-gradient(180deg, var(--brand-primary) 0%, var(--brand-primary-end) 100%);
    color: var(--bg-white);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sidebar h1 { font-size: 18px; margin: 0 0 24px; }
.sidebar a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: var(--radius-default);
    font-size: 14px;
}
.sidebar a:hover, .sidebar a.activo { background: rgba(255, 255, 255, 0.1); color: var(--bg-white); }
.sidebar .logout { margin-top: auto; }

/* ── Contenido ── */
.contenido { flex: 1; padding: 32px; max-width: 1100px; }
.contenido h2 { margin-top: 0; }

/* ── Cards (equivalente a .tech-card) ── */
.tech-card {
    background: var(--bg-white);
    border: 1px solid var(--border-brand);
    border-radius: var(--radius-default);
    box-shadow: var(--shadow-soft);
    padding: 24px;
    margin-bottom: 16px;
}

/* ── Metricas del dashboard ── */
.metricas { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.metrica { flex: 1; min-width: 160px; text-align: center; }
.metrica .numero { font-size: 36px; font-weight: 700; color: var(--brand-primary); }
.metrica .etiqueta { color: var(--text-secondary); font-size: 13px; text-transform: uppercase; }

/* ── Tabla ── */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--border-brand); font-size: 14px; }
th { color: var(--text-secondary); font-weight: 600; }

/* Contenedor que da scroll horizontal a la tabla en pantallas angostas. */
.tabla-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabla-scroll td, .tabla-scroll th { white-space: nowrap; }

/* ── Badges pill ── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.badge-activo { background: var(--color-success-bg); color: var(--color-success); }
.badge-bloqueado { background: var(--color-error-bg); color: var(--color-error); }

/* ── Botones ── */
.btn {
    display: inline-block;
    background: var(--brand-accent);
    color: var(--bg-white);
    border: none;
    border-radius: var(--radius-default);
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    transition: background var(--transition-suave), color var(--transition-suave),
                border-color var(--transition-suave);
}
.btn:hover { background: var(--brand-accent-hover); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-accent-ring); }
.btn-secundario { background: transparent; color: var(--brand-accent); border: 1px solid var(--brand-accent); }
.btn-secundario:hover { background: var(--brand-accent-light); }
.btn-peligro { background: var(--color-error); }
.btn-peligro:hover { background: var(--color-error); opacity: 0.9; }

/* ── Formularios ── */
label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
input[type="text"], input[type="password"], input[type="url"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-brand);
    border-radius: var(--radius-default);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-white);
    margin-bottom: 16px;
    transition: border-color var(--transition-suave), box-shadow var(--transition-suave);
}
input[type="text"]:focus, input[type="password"]:focus, input[type="url"]:focus {
    outline: none;
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 3px var(--brand-accent-ring);
}
input::placeholder { color: var(--text-muted); }

/* ── Tarjeta de formulario (encabezado, cuerpo, pie) ── */
.tarjeta-form { padding: 0; max-width: 720px; overflow: hidden; }
.tarjeta-encabezado { padding: 20px 24px 16px; border-bottom: 1px solid var(--border-brand); }
.tarjeta-encabezado h3 { margin: 0 0 4px; font-size: 18px; color: var(--brand-primary); }
.tarjeta-subtitulo { margin: 0; font-size: 13px; color: var(--text-secondary); }
.tarjeta-cuerpo { padding: 20px 24px 8px; }
.tarjeta-pie {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: var(--bg-gray-light);
    border-top: 1px solid var(--border-brand);
}
.enlace-secundario {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: color var(--transition-suave);
}
.enlace-secundario:hover { color: var(--brand-accent); }
.enlace-secundario:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 2px; }

/* Dos columnas (como .form-grid de Memo-Nova); el campo ancho ocupa la fila entera. */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.campo { min-width: 0; margin-bottom: 16px; }
.campo-ancho { grid-column: 1 / -1; }
.campo input[type="text"], .campo input[type="url"] { margin-bottom: 4px; }
.campo label { font-size: 13px; color: var(--text-medium); }
.ayuda { display: block; font-size: 12px; color: var(--text-secondary); }
.nota { margin: 0 0 16px; font-size: 12px; color: var(--text-muted); }
.campo-etiqueta { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text-medium); }

/* ── Interruptor: sigue siendo un <input type="checkbox"> nativo ── */
.interruptor {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    margin: 0;
    cursor: pointer;
}
.interruptor input {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    flex: none;
    width: 40px;
    height: 22px;
    margin: 0;
    border-radius: 999px;
    background: var(--border-default);
    cursor: pointer;
    transition: background var(--transition-suave), box-shadow var(--transition-suave);
}
.interruptor input::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bg-white);
    box-shadow: var(--shadow-soft);
    transition: transform var(--transition-suave);
}
.interruptor input:checked { background: var(--brand-accent); }
.interruptor input:checked::before { transform: translateX(18px); }
.interruptor input:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-accent-ring); }
.interruptor-texto { font-size: 14px; font-weight: 600; }
.interruptor-aviso {
    flex-basis: 100%;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: var(--radius-default);
    transition: background var(--transition-suave), color var(--transition-suave);
}
.interruptor input:checked ~ .interruptor-aviso {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
}

/* ── Datos de la conexion recien autorizada ── */
.datos-conexion { display: flex; gap: 32px; flex-wrap: wrap; margin: 0 0 16px; }
.datos-conexion dt { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; }
.datos-conexion dd { margin: 2px 0 0; font-size: 15px; font-weight: 600; }

/* ── Avisos ── */
.aviso { padding: 12px 16px; border-radius: var(--radius-default); margin-bottom: 16px; font-size: 14px; }
.aviso-error { background: var(--color-error-bg); color: var(--color-error); }
.aviso-exito { background: var(--color-success-bg); color: var(--color-success); }
.aviso-secreto { background: var(--color-warning-bg); color: var(--color-warning-text); }

/* ── Secreto recien generado + boton Copiar ── */
.secreto-grupo { display: flex; align-items: stretch; gap: 8px; margin-bottom: 16px; }
.secreto-valor {
    flex: 1;
    min-width: 0;
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: 13px;
    background: var(--bg-gray-light);
    border: 1px solid var(--border-brand);
    border-radius: var(--radius-default);
    padding: 12px;
    word-break: break-all;
    display: block;
}
.btn-copiar { flex: none; min-width: 96px; }
.btn-copiar.copiado { background: var(--color-success-bg); color: var(--color-success); border-color: var(--color-success); }
.solo-lectores {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* ── Login (centrado, sin sidebar) ── */
body.login { align-items: center; justify-content: center; }
.login-card { width: 360px; }
.login-card h1 { text-align: center; color: var(--brand-primary); }

/* ── Telefono: una columna, sin scroll horizontal ── */
@media (max-width: 640px) {
    body { flex-direction: column; }
    body.login { align-items: center; }
    .sidebar { width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; }
    .sidebar h1 { margin: 0 12px 0 0; }
    .sidebar .logout { margin: 0 0 0 auto; }
    .contenido { padding: 16px; max-width: 100%; min-width: 0; }
    .login-card { width: 100%; max-width: 360px; }
    .form-grid { grid-template-columns: 1fr; }
    .tarjeta-pie { flex-direction: column-reverse; align-items: stretch; text-align: center; }
    .secreto-grupo { flex-direction: column; }
}
