/* ============================================================
   Estilos compartidos — Lista de Contactos Dinámica
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

:root {
    --blue:      #2b6cb0;
    --blue-dark: #1a4f8a;
    --red:       #e53e3e;
    --green:     #38a169;
    --gray-50:   #f7fafc;
    --gray-100:  #edf2f7;
    --gray-200:  #e2e8f0;
    --gray-400:  #a0aec0;
    --gray-600:  #718096;
    --gray-800:  #2d3748;
    --white:     #ffffff;
    --radius:    8px;
    --shadow:    0 2px 8px rgba(0,0,0,0.08);
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    background: var(--gray-50);
    color: var(--gray-800);
    font-size: 15px;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Botones ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: bold;
    transition: opacity 0.15s, background 0.15s;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn:hover:not(:disabled) { opacity: 0.88; }

.btn-primary   { background: var(--blue);    color: var(--white); }
.btn-danger    { background: var(--red);     color: var(--white); }
.btn-secondary { background: var(--gray-200);color: var(--gray-800); }
.btn-ghost     { background: transparent; color: var(--blue); border: 1px solid var(--blue); }
.btn-link      { background: transparent; color: var(--blue); padding: 4px 0; font-weight: normal; }
.btn-full      { width: 100%; }
.btn-sm        { padding: 4px 10px; font-size: 0.8rem; font-weight: normal; }

/* ── Inputs ───────────────────────────────────────────────── */
.input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: var(--white);
    color: var(--gray-800);
    transition: border-color 0.15s;
}
.input:focus  { outline: none; border-color: var(--blue); }
.input.error  { border-color: var(--red); }
.input::placeholder { color: var(--gray-400); }

/* ── Mensajes ─────────────────────────────────────────────── */
.msg {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-top: 10px;
}
.msg-error   { background: #fff5f5; border: 1px solid #feb2b2; color: var(--red); }
.msg-success { background: #f0fff4; border: 1px solid #9ae6b4; color: var(--green); }
.msg-info    { background: #ebf8ff; border: 1px solid #90cdf4; color: var(--blue); }

/* ── Toast ────────────────────────────────────────────────── */
#toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--gray-800);
    color: var(--white);
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    z-index: 1000;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Card ─────────────────────────────────────────────────── */
.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

/* ── Navbar ───────────────────────────────────────────────── */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}
.navbar-brand {
    font-weight: bold;
    font-size: 1rem;
    color: var(--blue);
}
.navbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--gray-600);
}

/* ── Tablas ───────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

table {
    border-collapse: collapse;
    width: 100%;
    min-width: 460px;
}
th, td {
    border-bottom: 1px solid var(--gray-200);
    padding: 9px 12px;
    text-align: left;
    font-size: 0.875rem;
}
th {
    background: var(--gray-100);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-600);
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }

.td-pos     { color: var(--gray-400); font-size: 0.8rem; width: 32px; }
.td-actions { white-space: nowrap; }

/* ── Secciones de tabla ───────────────────────────────────── */
.section {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}
.section-header h3 { margin: 0; font-size: 0.95rem; }

.badge {
    background: var(--blue);
    color: var(--white);
    border-radius: 12px;
    padding: 2px 9px;
    font-size: 0.75rem;
}

.empty {
    text-align: center;
    color: var(--gray-400);
    padding: 28px;
    font-size: 0.875rem;
}

/* ── Contenido principal ──────────────────────────────────── */
.main {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* ── Lang switcher ────────────────────────────────────────── */
.lang-switch {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--gray-100);
    border-radius: 6px;
    padding: 2px;
}

.lang-btn {
    background: transparent;
    border: none;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 0.78rem;
    font-weight: bold;
    color: var(--gray-600);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.lang-btn:hover { color: var(--blue); }

.lang-btn.active {
    background: var(--white);
    color: var(--blue);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

@media (max-width: 600px) {
    .navbar { padding: 0 12px; }
    .main   { padding: 16px 10px; }
}
