/* ============================================================
   STYLES.CSS — Sistema de Cartas de Invitación
   H. Ayuntamiento de Ecatepec de Morelos
   ============================================================ */

:root {
    --color-primario: #722F37;
    --color-secundario: #5a252c;
    --color-primario-light: #8f3a44;
    --color-bg: #f5f5f5;
    --color-white: #ffffff;
    --color-text: #333333;
    --color-text-light: #666666;
    --color-border: #dddddd;
    --color-success: #28a745;
    --color-warning: #ffc107;
    --color-danger: #dc3545;
    --color-info: #17a2b8;
    --color-gray: #6c757d;
    --color-gray-light: #f8f9fa;
    --shadow: 0 2px 8px rgba(0,0,0,0.12);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.18);
    --radius: 6px;
    --navbar-height: 62px;
    --font: Arial, system-ui, -apple-system, sans-serif;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: var(--font); background: var(--color-bg); color: var(--color-text); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--color-primario); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
ul, ol { list-style: none; }

/* ---- Navbar ---- */
.navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    background: var(--color-primario);
    height: var(--navbar-height);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.2rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.navbar-brand {
    display: flex; align-items: center; gap: 0.7rem;
}
.navbar-logo {
    height: 48px; width: auto; border-radius: 4px;
}
.navbar-title {
    color: var(--color-white); font-size: 1.05rem; font-weight: 700;
    letter-spacing: 0.03em; white-space: nowrap;
}
.navbar-menu {
    display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap;
}
.nav-link {
    color: rgba(255,255,255,0.9); padding: 0.4rem 0.75rem; border-radius: var(--radius);
    font-size: 0.88rem; transition: background 0.2s; white-space: nowrap;
    text-decoration: none;
}
.nav-link:hover { background: rgba(255,255,255,0.15); text-decoration: none; color: #fff; }
.nav-user {
    display: flex; align-items: center; gap: 0.5rem; margin-left: 0.5rem;
    border-left: 1px solid rgba(255,255,255,0.3); padding-left: 0.75rem;
}
.nav-username { color: rgba(255,255,255,0.85); font-size: 0.83rem; }
.nav-badge {
    font-size: 0.72rem; padding: 0.18rem 0.55rem; border-radius: 20px; font-weight: 600; text-transform: uppercase;
}
.nav-badge--administrador { background: #fff; color: var(--color-primario); }
.nav-badge--supervisor { background: #d4ac0d; color: #333; }
.nav-badge--operador { background: #5dade2; color: #fff; }

.hamburger {
    display: none; background: none; border: none; cursor: pointer;
    color: #fff; font-size: 1.5rem; padding: 0.3rem; line-height: 1;
}

/* ---- Page Content ---- */
.page-content {
    flex: 1; margin-top: var(--navbar-height); padding: 1.6rem 1.4rem;
    max-width: 1280px; width: 100%; margin-left: auto; margin-right: auto;
    margin-top: calc(var(--navbar-height) + 0px);
}

/* ---- Footer ---- */
.site-footer {
    background: var(--color-secundario); color: rgba(255,255,255,0.75);
    text-align: center; padding: 0.8rem 1rem; font-size: 0.8rem;
    margin-top: auto;
}

/* ---- Cards ---- */
.card {
    background: var(--color-white); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 1.4rem; margin-bottom: 1.2rem;
}
.card-title {
    font-size: 1.1rem; font-weight: 700; color: var(--color-primario);
    margin-bottom: 1rem; padding-bottom: 0.6rem;
    border-bottom: 2px solid var(--color-border);
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1rem; flex-wrap: wrap; gap: 0.5rem;
}

/* ---- Stats Cards ---- */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--color-white); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 1.2rem 1.4rem;
    border-left: 5px solid var(--color-primario);
    display: flex; flex-direction: column; gap: 0.3rem;
}
.stat-card--total { border-color: var(--color-primario); }
.stat-card--entregado { border-color: var(--color-success); }
.stat-card--no_encontrado { border-color: var(--color-warning); }
.stat-card--inhabilitado { border-color: var(--color-danger); }
.stat-card--operadores { border-color: var(--color-info); }
.stat-card--hoy { border-color: var(--color-gray); }

.stat-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-light); font-weight: 600; }
.stat-value { font-size: 2.2rem; font-weight: 800; color: var(--color-text); line-height: 1; }
.stat-icon { font-size: 1.5rem; margin-bottom: 0.2rem; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.5rem 1.1rem; border-radius: var(--radius); border: none;
    font-size: 0.88rem; font-family: var(--font); font-weight: 600;
    cursor: pointer; transition: background 0.2s, transform 0.1s;
    text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--color-primario); color: #fff; }
.btn-primary:hover { background: var(--color-secundario); color: #fff; }
.btn-secondary { background: var(--color-gray); color: #fff; }
.btn-secondary:hover { background: #5a6268; color: #fff; }
.btn-success { background: var(--color-success); color: #fff; }
.btn-success:hover { background: #1e7e34; color: #fff; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #b02a37; color: #fff; }
.btn-warning { background: var(--color-warning); color: #333; }
.btn-warning:hover { background: #d39e00; color: #333; }
.btn-info { background: var(--color-info); color: #fff; }
.btn-info:hover { background: #117a8b; color: #fff; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn-outline { background: transparent; border: 2px solid var(--color-primario); color: var(--color-primario); }
.btn-outline:hover { background: var(--color-primario); color: #fff; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1rem; }
.form-label {
    display: block; font-size: 0.85rem; font-weight: 600;
    margin-bottom: 0.35rem; color: var(--color-text);
}
.form-control {
    width: 100%; padding: 0.55rem 0.75rem; border: 1px solid var(--color-border);
    border-radius: var(--radius); font-size: 0.9rem; font-family: var(--font);
    color: var(--color-text); background: #fff; transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
    outline: none; border-color: var(--color-primario);
    box-shadow: 0 0 0 3px rgba(114,47,55,0.15);
}
.form-control[readonly] { background: #f0f0f0; color: #555; }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.form-hint { font-size: 0.78rem; color: var(--color-text-light); margin-top: 0.25rem; }
.form-error { font-size: 0.78rem; color: var(--color-danger); margin-top: 0.25rem; }

/* Radio group estatus */
.radio-group { display: flex; gap: 1.2rem; flex-wrap: wrap; padding: 0.4rem 0; }
.radio-option {
    display: flex; align-items: center; gap: 0.4rem; cursor: pointer;
    padding: 0.45rem 0.9rem; border-radius: 20px; border: 2px solid var(--color-border);
    font-size: 0.88rem; font-weight: 600; transition: all 0.2s;
}
.radio-option:hover { border-color: var(--color-primario); }
.radio-option input[type=radio] { display: none; }
.radio-option.entregado.selected { background: #d4edda; border-color: var(--color-success); color: #155724; }
.radio-option.no_encontrado.selected { background: #fff3cd; border-color: #d39e00; color: #856404; }
.radio-option.inhabilitado.selected { background: #f8d7da; border-color: var(--color-danger); color: #721c24; }

/* GPS field */
.gps-group { display: flex; gap: 0.5rem; align-items: flex-end; }
.gps-group .form-control { flex: 1; }
#gpsStatus { font-size: 0.78rem; color: var(--color-text-light); margin-top: 0.25rem; min-height: 1.2em; }

/* File inputs */
.file-input-wrapper { position: relative; }
input[type=file].form-control { padding: 0.35rem 0.75rem; cursor: pointer; }

/* ---- Filtros ---- */
.filtros-form {
    background: var(--color-white); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 1rem 1.2rem; margin-bottom: 1.2rem;
}
.filtros-form .form-row { gap: 0.6rem; }
.filtros-form .form-control { font-size: 0.82rem; padding: 0.42rem 0.6rem; }
.filtros-actions { display: flex; gap: 0.5rem; align-items: flex-end; flex-wrap: wrap; margin-top: 0.6rem; }

/* ---- Table ---- */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
table.data-table {
    width: 100%; border-collapse: collapse; background: var(--color-white);
    font-size: 0.85rem;
}
table.data-table thead tr {
    background: var(--color-primario); color: #fff;
}
table.data-table thead th {
    padding: 0.75rem 0.85rem; text-align: left; font-weight: 700;
    font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase;
    white-space: nowrap;
}
table.data-table tbody tr { transition: background 0.15s; }
table.data-table tbody tr:nth-child(even) { background: #f9f4f5; }
table.data-table tbody tr:hover { background: #f0e5e6; }
table.data-table td { padding: 0.65rem 0.85rem; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
table.data-table .td-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.no-data { text-align: center; padding: 2.5rem; color: var(--color-text-light); font-size: 0.95rem; }

/* ---- Badges ---- */
.badge {
    display: inline-block; padding: 0.25rem 0.65rem; border-radius: 20px;
    font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-entregado { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.badge-no_encontrado { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.badge-inhabilitado { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.badge-activo { background: #d4edda; color: #155724; }
.badge-inactivo { background: #f8d7da; color: #721c24; }
.badge-administrador { background: #ede2e3; color: var(--color-primario); }
.badge-supervisor { background: #fff3cd; color: #856404; }
.badge-operador { background: #d1ecf1; color: #0c5460; }

/* ---- Pagination ---- */
.pagination-wrapper {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 0.8rem; padding: 1rem 0.2rem;
}
.pagination { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.page-btn {
    padding: 0.38rem 0.7rem; border-radius: var(--radius);
    border: 1px solid var(--color-border); background: #fff; cursor: pointer;
    font-size: 0.83rem; color: var(--color-text); text-decoration: none;
    transition: background 0.15s;
}
.page-btn:hover { background: var(--color-primario); color: #fff; border-color: var(--color-primario); text-decoration: none; }
.page-btn.active { background: var(--color-primario); color: #fff; border-color: var(--color-primario); font-weight: 700; }
.page-btn.disabled { opacity: 0.45; pointer-events: none; }
.pagination-info { font-size: 0.82rem; color: var(--color-text-light); }

/* ---- Modal ---- */
.modal-overlay {
    display: none; position: fixed; inset: 0; z-index: 2000;
    background: rgba(0,0,0,0.55); align-items: center; justify-content: center;
    padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: var(--color-white); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); width: 100%; max-width: 780px; max-height: 90vh;
    overflow-y: auto; display: flex; flex-direction: column;
}
.modal-header {
    background: var(--color-primario); color: #fff;
    padding: 1rem 1.3rem; display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; z-index: 1;
}
.modal-title { font-size: 1.05rem; font-weight: 700; }
.modal-close {
    background: none; border: none; color: #fff; font-size: 1.4rem;
    cursor: pointer; line-height: 1; padding: 0.2rem 0.4rem; border-radius: 4px;
    transition: background 0.2s;
}
.modal-close:hover { background: rgba(255,255,255,0.2); }
.modal-body { padding: 1.3rem; }
.modal-fotos { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-top: 0.8rem; }
.modal-foto {
    width: 180px; height: 140px; object-fit: cover;
    border-radius: var(--radius); border: 2px solid var(--color-border);
    cursor: pointer; transition: transform 0.2s, border-color 0.2s;
}
.modal-foto:hover { transform: scale(1.03); border-color: var(--color-primario); }
.modal-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 1.5rem; }
.modal-detail-item { font-size: 0.87rem; }
.modal-detail-item strong { display: block; font-size: 0.75rem; color: var(--color-text-light); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.1rem; }

/* Lightbox */
.lightbox-overlay {
    display: none; position: fixed; inset: 0; z-index: 3000;
    background: rgba(0,0,0,0.88); align-items: center; justify-content: center; cursor: pointer;
}
.lightbox-overlay.open { display: flex; }
.lightbox-overlay img { max-width: 94vw; max-height: 90vh; border-radius: var(--radius); box-shadow: var(--shadow-lg); }

/* ---- Login ---- */
.login-wrapper {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--color-primario) 0%, var(--color-secundario) 100%);
    padding: 1rem;
}
.login-box {
    background: var(--color-white); border-radius: 10px;
    box-shadow: var(--shadow-lg); padding: 2.4rem 2rem; width: 100%; max-width: 400px;
}
.login-logo { display: block; margin: 0 auto 1.2rem; max-height: 80px; }
.login-title { text-align: center; font-size: 1.25rem; font-weight: 800; color: var(--color-primario); margin-bottom: 0.2rem; }
.login-subtitle { text-align: center; font-size: 0.82rem; color: var(--color-text-light); margin-bottom: 1.6rem; }
.login-footer { text-align: center; font-size: 0.78rem; color: var(--color-text-light); margin-top: 1.5rem; }

/* ---- Alerts ---- */
.alert {
    padding: 0.8rem 1rem; border-radius: var(--radius); margin-bottom: 1rem;
    font-size: 0.88rem; border: 1px solid transparent;
}
.alert-success { background: #d4edda; color: #155724; border-color: #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border-color: #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border-color: #ffeeba; }
.alert-info { background: #d1ecf1; color: #0c5460; border-color: #bee5eb; }

/* ---- Success Box (after registro) ---- */
.success-box {
    display: none; background: #d4edda; border: 2px solid var(--color-success);
    border-radius: var(--radius); padding: 1.4rem 1.6rem; text-align: center; margin-bottom: 1.2rem;
}
.success-box .folio-display {
    font-size: 1.8rem; font-weight: 800; color: var(--color-success); letter-spacing: 0.05em; margin: 0.5rem 0;
}

/* ---- Mapa ---- */
#mapa { width: 100%; height: 520px; border-radius: var(--radius); border: 2px solid var(--color-border); }
.mapa-leyenda {
    display: flex; gap: 1rem; flex-wrap: wrap; padding: 0.7rem 0; font-size: 0.84rem;
}
.leyenda-item { display: flex; align-items: center; gap: 0.4rem; }
.leyenda-dot { width: 16px; height: 16px; border-radius: 50%; display: inline-block; border: 2px solid rgba(0,0,0,0.2); }

/* ---- Page Header ---- */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.3rem; flex-wrap: wrap; gap: 0.6rem; }
.page-header h1 { font-size: 1.3rem; font-weight: 800; color: var(--color-primario); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .hamburger { display: block; }
    .navbar-menu {
        display: none; position: fixed; top: var(--navbar-height); left: 0; right: 0;
        background: var(--color-secundario); flex-direction: column; align-items: stretch;
        padding: 0.8rem; gap: 0.3rem; box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    }
    .navbar-menu.open { display: flex; }
    .nav-link { padding: 0.6rem 1rem; font-size: 0.95rem; }
    .nav-user { border-left: none; border-top: 1px solid rgba(255,255,255,0.2); padding-top: 0.7rem; margin-left: 0; flex-direction: column; align-items: flex-start; }
    .page-content { padding: 1rem 0.7rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .modal-detail-grid { grid-template-columns: 1fr; }
    .navbar-title { display: none; }
    #mapa { height: 360px; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .login-box { padding: 1.6rem 1.2rem; }
    .pagination { justify-content: center; }
}


/* ---- Preview de fotos ---- */
.foto-preview {
    display: none;
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 2px solid var(--color-border);
    margin-top: 8px;
}
.foto-preview.visible {
    display: block;
}
