/**
 * Alonsso Invitaciones — Estilos Globales
 * Compartido por todas las páginas del sistema.
 *
 * Estructura:
 *   1. Reset & Base
 *   2. Sidebar
 *   3. Layout principal
 *   4. Topbar
 *   5. Botones
 *   6. Cards
 *   7. Formularios
 *   8. Tabla
 *   9. Badges
 *  10. Alerts
 *  11. Modal
 *  12. Estado vacío
 *  13. Avatar
 */

/* ══════════════════════════════════════════════════════════════
   1. RESET & BASE
══════════════════════════════════════════════════════════════ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: #f2ede8;
    color: #1a1a1a;
    min-height: 100vh;
}

/* ══════════════════════════════════════════════════════════════
   2. SIDEBAR
══════════════════════════════════════════════════════════════ */

.sidebar {
    width: 220px;
    min-height: 100vh;
    background: #1a0f10;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 28px 24px 22px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-brand .marca {
    font-size: 16px;
    letter-spacing: 4px;
    color: #fff;
    text-transform: uppercase;
    font-weight: 400;
}

.sidebar-brand .sub {
    font-size: 10px;
    color: #c9a96e;
    letter-spacing: 2px;
    margin-top: 4px;
}

.nav {
    padding: 12px 0;
    flex: 1;
}

.nav-section {
    font-size: 9px;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.25);
    padding: 14px 24px 5px;
    text-transform: uppercase;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 24px;
    font-size: 13px;
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: all 0.15s;
}

.nav-item:hover {
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.04);
}

.nav-item.active {
    color: #fff;
    border-left-color: #c9a96e;
    background: rgba(255,255,255,0.06);
}

.nav-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255,255,255,0.07);
}

.sidebar-user {
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    margin-bottom: 10px;
}

.sidebar-user strong {
    display: block;
    color: rgba(255,255,255,0.75);
    font-size: 13px;
    margin-bottom: 2px;
}

/* ══════════════════════════════════════════════════════════════
   3. LAYOUT PRINCIPAL
══════════════════════════════════════════════════════════════ */

/* Para páginas con sidebar fijo */
body.has-sidebar {
    display: flex;
}

.main {
    margin-left: 220px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.content {
    padding: 24px 28px;
    flex: 1;
}

/* ══════════════════════════════════════════════════════════════
   4. TOPBAR
══════════════════════════════════════════════════════════════ */

.topbar {
    background: #fff;
    border-bottom: 1px solid #e8e2dc;
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-size: 15px;
    font-weight: 500;
    color: #1a1a1a;
}

.topbar-sub {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

.topbar-actions {
    display: flex;
    gap: 10px;
}

/* ══════════════════════════════════════════════════════════════
   5. BOTONES
══════════════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 12px;
    font-family: inherit;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid #e0dbd6;
    background: #fff;
    color: #1a1a1a;
    transition: all 0.15s;
    font-weight: 500;
}

.btn:hover         { background: #f7f4f1; }
.btn-sm            { padding: 5px 10px; font-size: 11px; }

.btn-primary       { background: #1a0f10; color: #fff; border-color: #1a0f10; }
.btn-primary:hover { background: #2d1a1c; }

.btn-ghost         { background: transparent; border-color: transparent; color: rgba(255,255,255,0.6); }
.btn-ghost:hover   { background: rgba(255,255,255,0.08); color: #fff; border-color: transparent; }

.btn-export        { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.btn-export:hover  { background: #dcfce7; }

.btn-edit          { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.btn-edit:hover    { background: #dbeafe; }

.btn-warning       { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.btn-warning:hover { background: #fef3c7; }

.btn-success       { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.btn-success:hover { background: #dcfce7; }

.btn-danger        { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.btn-danger:hover  { background: #fee2e2; }

/* ══════════════════════════════════════════════════════════════
   6. CARDS
══════════════════════════════════════════════════════════════ */

.card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e8e2dc;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f0ebe6;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title    { font-size: 14px; font-weight: 500; }
.card-subtitle { font-size: 11px; color: #aaa; margin-left: auto; }

.card-body { padding: 20px; }

/* ══════════════════════════════════════════════════════════════
   7. FORMULARIOS
══════════════════════════════════════════════════════════════ */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 14px;
}

.form-group label,
label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.8px;
    color: #999;
    text-transform: uppercase;
}

.form-group input,
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid #e0dbd6;
    border-radius: 8px;
    font-size: 14px;
    color: #1a1a1a;
    background: #faf9f7;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
}

.form-group input:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #1a0f10;
    box-shadow: 0 0 0 3px rgba(26,15,16,0.07);
    background: #fff;
}

textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

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='%23999' stroke-width='2'%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;
}

.form-hint {
    font-size: 11px;
    color: #aaa;
    margin-top: 2px;
}

/* ══════════════════════════════════════════════════════════════
   8. TABLA
══════════════════════════════════════════════════════════════ */

.table-wrap {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e8e2dc;
    overflow: hidden;
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f0ebe6;
}

.table-title { font-size: 13px; font-weight: 500; }
.table-count { font-size: 11px; color: #aaa; }

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: #aaa;
    padding: 10px 20px;
    text-align: left;
    background: #faf8f6;
    border-bottom: 1px solid #f0ebe6;
}

tbody td {
    padding: 13px 20px;
    font-size: 13px;
    color: #1a1a1a;
    border-bottom: 1px solid #f5f1ee;
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td      { background: #faf8f6; }

.row-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════════════
   9. BADGES
══════════════════════════════════════════════════════════════ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.badge-enviada   { background: #f0fdf4; color: #166534; }
.badge-pendiente { background: #fffbeb; color: #92400e; }
.badge-error     { background: #fef2f2; color: #b91c1c; }
.badge-tienda    { background: #eff6ff; color: #1e40af; }
.badge-activo    { background: #f0fdf4; color: #166534; }
.badge-inactivo  { background: #f5f1ee; color: #888; }

/* ══════════════════════════════════════════════════════════════
   10. ALERTS
══════════════════════════════════════════════════════════════ */

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }

/* ══════════════════════════════════════════════════════════════
   11. MODAL
══════════════════════════════════════════════════════════════ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 540px;
    max-height: 85vh;
    overflow-y: auto;
    margin: 20px;
}

.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid #f0ebe6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}

.modal-title  { font-size: 15px; font-weight: 500; }
.modal-close  { background: none; border: none; font-size: 20px; color: #aaa; cursor: pointer; line-height: 1; }
.modal-close:hover { color: #1a1a1a; }
.modal-body   { padding: 20px 24px 24px; }

/* ══════════════════════════════════════════════════════════════
   12. ESTADO VACÍO
══════════════════════════════════════════════════════════════ */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #aaa;
}

.empty-state p { font-size: 14px; margin-bottom: 16px; }

/* ══════════════════════════════════════════════════════════════
   13. AVATAR
══════════════════════════════════════════════════════════════ */

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f0e8d8;
    color: #9a7a40;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.name-cell  { display: flex; align-items: center; gap: 10px; }
.name-text  { font-weight: 500; font-size: 13px; }
.email-text { font-size: 11px; color: #888; }
.user-text  { font-size: 11px; color: #888; font-family: monospace; }