/* ═══════════════════════════════════════════════════
   La Quejoteca — Sistema de Diseño Moderno y Responsive
   ═══════════════════════════════════════════════════ */

/* ─── Variables de Diseño ─── */
:root {
    /* Marca — Burdeos como color principal */
    --primary: #7B1C1C;
    --primary-hover: #9B2C2C;
    --primary-light: #FEF2F2;
    --primary-subtle: rgba(123, 28, 28, 0.08);
    --primary-border: rgba(123, 28, 28, 0.20);

    /* Fondos y superficies */
    --bg: #F5F3EF;
    --surface: #FFFFFF;
    --surface-2: #F9F8F5;
    --surface-3: #F2F0EB;

    /* Bordes */
    --border: #E5E3DF;
    --border-strong: #C8C5C0;

    /* Texto */
    --text: #1C1917;
    --text-muted: #78716C;
    --text-faint: #A8A39E;

    /* Semánticos */
    --success: #166534;
    --success-bg: #DCFCE7;
    --success-border: rgba(22, 163, 74, 0.25);
    --error: #991B1B;
    --error-bg: #FEE2E2;
    --error-border: rgba(220, 38, 38, 0.25);
    --warning: #B45309;
    --warning-bg: #FEF3C7;
    --warning-border: rgba(217, 119, 6, 0.25);
    --info: #0C4A6E;
    --info-bg: #E0F2FE;

    /* Votos */
    --upvote: #16A34A;
    --downvote: #DC2626;

    /* Sombras */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.10), 0 4px 10px rgba(0, 0, 0, 0.04);

    /* Radios */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Transiciones */
    --transition: 180ms ease;
    --transition-slow: 300ms ease;
}

/* ─── Reset y Base ─── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    width: 100%;
}

/* ─── Layout General ─── */
.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow-x: hidden;
}

.container {
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

main {
    flex: 1;
    padding: 24px 0 48px;
}

/* ─── Banner de Cambio Obligatorio de Contraseña ─── */
.must-change-pw-banner {
    background: #FEF2F2;
    border-bottom: 1px solid #FECACA;
    color: #991B1B;
    padding: 10px 0;
    font-size: 14px;
}

/* ─── Cabecera ─── */
.site-header {
    background: linear-gradient(135deg, #5C0A0A 0%, #7B1C1C 60%, #6B1515 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.25), 0 1px 0 rgba(255,255,255,0.05) inset;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    max-width: 1100px;
    margin: 0 auto;
    gap: 12px;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: white;
    line-height: 1.1;
    flex-shrink: 0;
}

.site-logo-img {
    height: 38px;
    width: auto;
    max-width: 130px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

.logo-text-group {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.logo-name {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: white;
}

.logo-tagline {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.65);
    font-weight: 400;
}

/* Navegación principal */
.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.site-nav a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 7px 11px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.site-nav a:hover {
    background: rgba(255, 255, 255, 0.14);
    color: white;
}

.site-nav a.nav-cta {
    background: rgba(255, 255, 255, 0.16);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.25);
    font-weight: 600;
    margin-left: 2px;
}

.site-nav a.nav-cta:hover {
    background: rgba(255, 255, 255, 0.28);
}

.nav-admin-link {
    background: rgba(0, 0, 0, 0.25) !important;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #FEE2E2 !important;
    font-weight: 600 !important;
}

.nav-admin-link:hover {
    background: rgba(0, 0, 0, 0.40) !important;
}

.admin-badge-count {
    background: #DC2626;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: var(--radius-full);
}

.nav-divider {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.20);
    margin: 0 4px;
    flex-shrink: 0;
}

.nav-username-link {
    color: white !important;
    font-weight: 600 !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-avatar-img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.nav-avatar-initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    color: white;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.nav-logout {
    color: rgba(255, 255, 255, 0.60) !important;
    font-size: 13px !important;
}

/* ─── Flash Messages ─── */
.flash-messages {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 20px 0;
    width: 100%;
}

.alert {
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success-border);
}

.alert-error {
    background: var(--error-bg);
    color: var(--error);
    border-color: var(--error-border);
}

.alert-info {
    background: var(--info-bg);
    color: var(--info);
    border-color: rgba(12, 74, 110, 0.2);
}

/* ─── Cards Genéricas ─── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 13px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 20px;
}

/* ─── Panel de Estadísticas ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 14px;
    text-align: center;
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition), transform var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-number {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
    display: block;
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
    font-weight: 500;
}

/* ─── Banner Categoría Top ─── */
.top-category-banner {
    background: linear-gradient(135deg, var(--primary) 0%, #9B2C2C 100%);
    color: white;
    border-radius: var(--radius);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.top-cat-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.75);
    margin-bottom: 2px;
}

.top-cat-value {
    font-size: 15px;
    font-weight: 700;
}

/* ─── Queja Destacada ─── */
.featured-complaint {
    background: linear-gradient(135deg, #FEF2F2 0%, #FFFFFF 100%);
    border: 1.5px solid var(--primary-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.featured-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary);
    margin-bottom: 8px;
}

.featured-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    display: block;
    margin-bottom: 6px;
    line-height: 1.35;
    transition: color var(--transition);
}

.featured-title:hover { color: var(--primary); }

.featured-text {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 12px;
    line-height: 1.55;
}

/* ─── Buscador y Filtros ─── */
.search-card {
    margin-bottom: 20px;
}

.search-card .card-body {
    padding: 14px 16px;
}

.search-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.search-form input {
    flex: 2;
    min-width: 180px;
}

.search-form select {
    flex: 1;
    min-width: 160px;
}

.search-btn-group {
    display: flex;
    gap: 6px;
}

/* ─── Cabecera del Feed ─── */
.feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 10px;
}

.feed-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.feed-count-tag {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-muted);
}

/* Pestañas de ordenación */
.sort-tabs {
    display: flex;
    gap: 2px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px;
    box-shadow: var(--shadow-xs);
}

.sort-tab {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.sort-tab:hover {
    background: var(--surface-2);
    color: var(--text);
}

.sort-tab.active {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

/* ─── Cards de Quejas (Feed) ─── */
.feed-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.complaint-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.complaint-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--primary-border);
}

.complaint-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.complaint-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    line-height: 1.35;
    flex: 1;
    transition: color var(--transition);
}

.complaint-card-title:hover { color: var(--primary); }

.complaint-card-excerpt {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.complaint-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-muted);
}

.author-inline {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--text);
}

.avatar-inline-img {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    object-fit: cover;
}

.author-name-link {
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}
.author-name-link:hover { color: var(--primary); }

.meta-sep { color: var(--border-strong); }

.complaint-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.card-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.score-indicator {
    font-size: 13px;
    color: var(--text-muted);
}

/* ─── Imágenes de quejas ─── */
.complaint-image-container {
    margin: 10px 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 400px;
}

.complaint-image {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    display: block;
}

.complaint-detail-body .complaint-image-container {
    margin: 16px 0 0 0;
    max-height: 520px;
}

.complaint-detail-body .complaint-image {
    max-height: 520px;
    object-fit: contain;
    background: var(--surface-2);
}

/* ─── Barra de Votos ─── */
.vote-bar-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vote-bar {
    height: 6px;
    background: var(--error-bg);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.vote-bar-fill {
    height: 100%;
    background: var(--upvote);
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

.vote-stats {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
}

.vote-up { color: var(--upvote); }
.vote-down { color: var(--downvote); }
.vote-count-label { color: var(--text-faint); font-size: 11px; font-weight: 500; }

/* ─── Badges e Insignias ─── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    white-space: nowrap;
}

.badge-cat {
    background: var(--primary-subtle);
    color: var(--primary);
    border: 1px solid var(--primary-border);
    font-weight: 600;
}

.badge-rank {
    background: var(--surface-3);
    color: var(--text-muted);
    border: 1px solid var(--border);
    font-size: 11px;
    padding: 2px 7px;
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid var(--warning-border);
    font-weight: 600;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success-border);
    font-weight: 600;
}

/* ─── Botones ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: background var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition);
    font-family: inherit;
    line-height: 1.2;
    white-space: nowrap;
    -webkit-appearance: none;
    min-height: 38px;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-hover); color: white; }

.btn-secondary {
    background: var(--surface-2);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-3); color: var(--text); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    min-height: 34px;
}

.btn-link-danger {
    background: none;
    border: none;
    color: var(--error);
    font-size: 12px;
    cursor: pointer;
    font-weight: 500;
    padding: 2px 4px;
    text-decoration: underline;
}

/* Botones de voto */
.btn-upvote {
    background: var(--success-bg);
    color: var(--upvote);
    border: 1px solid var(--success-border);
}
.btn-upvote:hover,
.btn-upvote.active {
    background: var(--upvote);
    color: white;
    border-color: var(--upvote);
}

.btn-downvote {
    background: var(--error-bg);
    color: var(--downvote);
    border: 1px solid var(--error-border);
}
.btn-downvote:hover,
.btn-downvote.active {
    background: var(--downvote);
    color: white;
    border-color: var(--downvote);
}

/* Botones de compartir */
.btn-whatsapp {
    background: #25D366;
    color: white;
    border: none;
}
.btn-whatsapp:hover { background: #1EBC59; color: white; }

.btn-twitter {
    background: #0F0F0F;
    color: white;
    border: none;
}
.btn-twitter:hover { background: #333; color: white; }

.btn-copy {
    background: var(--surface-2);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-copy:hover { background: var(--surface-3); color: var(--text); }

/* ─── Formularios ─── */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 5px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-subtle);
}

.form-control::placeholder { color: var(--text-faint); }
textarea.form-control { resize: vertical; min-height: 100px; line-height: 1.6; }

/* ─── Detalle de Queja ─── */
.back-nav-container { margin-bottom: 16px; }
.back-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color var(--transition);
}
.back-link:hover { color: var(--primary); }

.complaint-detail-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
}

.complaint-detail-header {
    padding: 22px 24px 18px;
    border-bottom: 1px solid var(--border);
}

.complaint-detail-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.3;
    margin: 8px 0 12px;
    letter-spacing: -0.3px;
}

.complaint-detail-body {
    padding: 22px 24px;
    border-bottom: 1px solid var(--border);
}

.complaint-detail-text {
    font-size: 15px;
    line-height: 1.75;
    white-space: pre-line;
    color: var(--text);
}

.complaint-detail-footer {
    padding: 18px 24px;
    background: var(--surface-2);
}

/* Veredicto */
.verdict-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 16px;
    text-align: center;
}

.verdict-positive { border-left: 4px solid var(--upvote); }
.verdict-negative { border-left: 4px solid var(--downvote); }
.verdict-neutral { border-left: 4px solid var(--border-strong); }

.verdict-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.verdict-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.verdict-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
}

.detail-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

.vote-actions-group {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.mod-actions-group {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.report-inline-form {
    display: flex;
    gap: 6px;
    align-items: center;
    margin: 0;
}

.report-select {
    font-size: 12px;
    padding: 6px 8px;
    width: auto;
    min-width: 140px;
    height: 34px;
}

/* ─── Sección de Compartir ─── */
.share-section {
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.share-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-faint);
    margin-bottom: 8px;
}

.share-buttons-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.copy-feedback {
    font-size: 12px;
    font-weight: 600;
    color: var(--upvote);
    opacity: 0;
    transition: opacity 0.2s;
}

.copy-feedback.show { opacity: 1; }

/* ─── Comentarios ─── */
.comments-card .card-body {
    padding: 20px 24px;
}

.comment-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.comment-item:last-of-type { border-bottom: none; }

.comment-author {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 5px;
}

.comment-author-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    text-decoration: none;
}

.comment-author-name:hover { color: var(--primary); }

.comment-time {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
}

.comment-content {
    font-size: 14px;
    color: var(--text);
    line-height: 1.6;
    white-space: pre-line;
}

.no-comments-msg {
    color: var(--text-muted);
    text-align: center;
    padding: 24px 0;
    font-style: italic;
    margin: 0;
    font-size: 14px;
}

.comment-form-wrapper {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.login-to-comment-box {
    margin-top: 16px;
    padding: 14px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 14px;
}

/* ─── Páginas de Autenticación ─── */
.auth-wrapper {
    max-width: 400px;
    margin: 36px auto;
    width: 100%;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px 28px;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    text-align: center;
    margin-bottom: 14px;
}

.auth-logo-img {
    height: 48px;
    width: auto;
    object-fit: contain;
    display: inline-block;
}

.auth-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    text-align: center;
    margin-bottom: 4px;
    letter-spacing: -0.3px;
}

.auth-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 22px;
}

/* Botón Google OAuth */
.btn-google-auth {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition);
    cursor: pointer;
    min-height: 42px;
}

.btn-google-auth:hover {
    background: var(--surface-2);
    border-color: var(--text-muted);
}

.google-icon {
    flex-shrink: 0;
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 18px 0;
    color: var(--text-faint);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.auth-divider span {
    padding: 0 10px;
}

.auth-footer {
    margin-top: 18px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}
.auth-footer a:hover { text-decoration: underline; }

/* ─── Nueva Queja ─── */
.new-complaint-wrapper {
    max-width: 680px;
    margin: 0 auto;
}

.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.form-card-header {
    background: linear-gradient(135deg, var(--primary) 0%, #9B2C2C 100%);
    color: white;
    padding: 18px 24px;
}

.form-card-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 3px;
}

.form-card-subtitle {
    font-size: 13px;
    color: rgba(255,255,255,0.75);
}

.form-card-body {
    padding: 24px;
}

/* ─── Ranking ─── */
.ranking-header-section {
    margin-bottom: 20px;
}

.page-title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.4px;
    margin-bottom: 4px;
    color: var(--text);
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

.ranking-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.my-position-badge {
    background: var(--primary-light);
    border: 1px solid var(--primary-border);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text);
}

.my-position-badge strong {
    color: var(--primary);
    font-size: 16px;
    margin-left: 4px;
}

.ranking-hint-text {
    font-size: 13px;
    color: var(--text-muted);
}

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition), transform var(--transition);
}

.ranking-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.ranking-item.is-current-user {
    border-color: var(--primary-border);
    background: var(--primary-light);
}

.ranking-position {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-muted);
    width: 32px;
    text-align: center;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.ranking-position.pos-1 { color: #D97706; font-size: 18px; }
.ranking-position.pos-2 { color: #64748B; font-size: 17px; }
.ranking-position.pos-3 { color: #B45309; font-size: 17px; }

.ranking-avatar-col {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ranking-avatar-img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}

.ranking-avatar-fallback {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.ranking-info { flex: 1; min-width: 0; }

.ranking-username {
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
    text-decoration: none;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-username:hover { color: var(--primary); }

.ranking-level {
    margin-top: 2px;
}

.ranking-xp-col {
    text-align: right;
    flex-shrink: 0;
}

.ranking-xp {
    font-size: 18px;
    font-weight: 800;
    color: var(--primary);
    white-space: nowrap;
    letter-spacing: -0.3px;
}

.ranking-xp-unit {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.ranking-total-xp {
    font-size: 11px;
    color: var(--text-faint);
    margin-top: 1px;
}

/* ─── Perfil ─── */
.profile-header-card {
    background: linear-gradient(135deg, #5C0A0A 0%, #7B1C1C 100%);
    color: white;
    border-radius: var(--radius-xl);
    padding: 30px 24px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.profile-avatar-container {
    margin: 0 auto 12px;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.4);
    box-shadow: var(--shadow-md);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 800;
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
}

.profile-username {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 4px;
    letter-spacing: -0.4px;
}

.profile-level-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 16px;
    font-weight: 500;
}

.profile-xp-bar-track {
    background: rgba(255, 255, 255, 0.20);
    border-radius: var(--radius-full);
    height: 8px;
    max-width: 300px;
    margin: 0 auto 8px;
    overflow: hidden;
}

.profile-xp-bar-fill {
    height: 100%;
    background: rgba(255, 255, 255, 0.90);
    border-radius: var(--radius-full);
    transition: width 0.6s ease;
}

.profile-xp-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.70);
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.profile-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 12px;
    text-align: center;
    box-shadow: var(--shadow-xs);
}

.profile-stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
    display: block;
    line-height: 1;
    letter-spacing: -0.4px;
}

.profile-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 5px;
    display: block;
    font-weight: 500;
}

/* Badges del perfil */
.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.badge-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 10px;
    text-align: center;
    box-shadow: var(--shadow-xs);
}

.badge-card-emoji {
    font-size: 30px;
    display: block;
    margin-bottom: 6px;
}

.badge-card-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    display: block;
    margin-bottom: 2px;
}

.badge-card-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.35;
}

/* ─── Admin Panel ─── */
.admin-reports-list {
    display: flex;
    flex-direction: column;
}

.admin-report-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.admin-report-row:last-child {
    border-bottom: none;
}

.admin-report-main {
    flex: 1;
    min-width: 0;
}

.admin-complaint-title {
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    font-size: 15px;
    display: block;
    margin-bottom: 4px;
}

.admin-complaint-title:hover { color: var(--primary); }

.admin-complaint-excerpt {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.admin-report-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* ─── Estado vacío ─── */
.empty-state {
    text-align: center;
    padding: 44px 20px;
    color: var(--text-muted);
}

.empty-state-text {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 16px;
}

.load-more {
    text-align: center;
    margin-top: 20px;
}

/* ─── Botón de Menú Móvil (Tres puntos ⋯) y Drawer ─── */
.mobile-nav-toggle-wrap {
    display: none;
    align-items: center;
    gap: 8px;
}

.mobile-menu-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
    user-select: none;
    touch-action: manipulation;
}

.mobile-menu-btn:hover,
.mobile-menu-btn:active {
    background: rgba(255, 255, 255, 0.28);
}

.mobile-menu-btn .dots-icon {
    font-size: 22px;
    line-height: 1;
    font-weight: 900;
    letter-spacing: 1px;
    margin-top: -4px;
}

.mobile-quick-cta {
    background: rgba(255, 255, 255, 0.20) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    padding: 6px 10px !important;
}

.mobile-menu-drawer {
    background: #5C0A0A;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
    width: 100%;
    animation: slideDown 200ms ease;
}

.mobile-menu-drawer[hidden] {
    display: none !important;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.mobile-menu-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 16px 16px;
}

.mobile-menu-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mobile-menu-link {
    color: white !important;
    text-decoration: none;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 14.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.06);
    transition: background var(--transition);
}

.mobile-menu-link:hover,
.mobile-menu-link:active {
    background: rgba(255, 255, 255, 0.18);
}

.mobile-menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin: 8px 0;
}

.mobile-cta-link {
    background: var(--primary) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: white !important;
}

.mobile-admin-link {
    background: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #FEE2E2 !important;
}

.mobile-logout-link {
    color: rgba(255, 255, 255, 0.75) !important;
    font-size: 13.5px;
}

/* ─── Pie de Página (Footer & Acerca de) ─── */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 22px 0;
    margin-top: auto;
    font-size: 13.5px;
    color: var(--text-muted);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-brand-title {
    font-weight: 700;
    color: var(--text);
    font-size: 14px;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition);
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-links a.footer-about-link {
    font-weight: 600;
    color: var(--primary);
}

.footer-sep {
    color: var(--border-strong);
}

.footer-copy p {
    margin: 0;
    font-size: 13px;
    color: var(--text-faint);
}

/* ─── Página Acerca de (/acerca-de) ─── */
.about-container {
    max-width: 780px;
    margin: 0 auto 36px;
}

.about-header {
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.about-main-title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.6px;
    color: var(--text);
    margin-bottom: 8px;
}

.about-lead {
    font-size: 15.5px;
    line-height: 1.6;
    color: var(--text-muted);
    margin: 0;
}

.about-content-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.about-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
}

.about-section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
    letter-spacing: -0.3px;
}

.about-section p {
    font-size: 14.5px;
    line-height: 1.65;
    color: var(--text-muted);
    margin: 0 0 10px;
}

.about-section p:last-child {
    margin-bottom: 0;
}

.about-steps-list {
    margin: 10px 0 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.about-steps-list li {
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-muted);
}

.about-steps-list li strong {
    color: var(--text);
}

.about-section-server {
    background: var(--surface-2);
}

.about-subtle-text {
    font-size: 13.5px !important;
    color: var(--text-muted);
}

.about-contact-link {
    color: var(--primary);
    text-decoration: underline;
    font-weight: 600;
    word-break: break-all;
}

.about-contact-link:hover {
    color: var(--primary-hover);
}

.about-cta-section {
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 20px;
}

.about-cta-heading {
    font-size: 19px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.about-cta-subtext {
    font-size: 14.5px;
    color: var(--text-muted);
    margin-bottom: 18px;
}

.about-cta-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ─── Responsive Media Queries ─── */

/* Tablets & Móviles */
@media (max-width: 600px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    .about-section {
        padding: 18px 16px;
    }
    .about-header {
        text-align: center;
    }
}

/* Móviles y pantallas medianas (max-width: 768px) */
@media (max-width: 768px) {
    .desktop-nav {
        display: none !important;
    }

    .mobile-nav-toggle-wrap {
        display: flex;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .admin-report-row {
        flex-direction: column;
        gap: 12px;
    }

    .admin-report-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

/* Móviles y pantallas medianas (max-width: 768px) */
@media (max-width: 768px) {
    .header-inner {
        padding: 8px 14px;
        gap: 8px;
    }

    .site-logo {
        gap: 8px;
    }

    .site-logo-img {
        height: 32px;
        max-width: 100px;
    }

    .logo-name { font-size: 16px; }
    .logo-tagline { display: none; }

    .site-nav {
        gap: 2px;
    }

    .site-nav a {
        padding: 6px 8px;
        font-size: 13px;
    }

    .site-nav a.nav-cta {
        margin-left: 0;
    }

    .container {
        padding: 0 14px;
    }

    main {
        padding: 18px 0 36px;
    }

    .page-title {
        font-size: 20px;
    }

    .complaint-detail-header,
    .complaint-detail-footer {
        padding: 16px 16px;
    }

    .complaint-detail-body {
        padding: 16px;
    }

    .complaint-detail-title {
        font-size: 19px;
    }

    .comments-card .card-body {
        padding: 16px;
    }

    .detail-actions-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .mod-actions-group {
        width: 100%;
    }

    .report-inline-form {
        width: 100%;
        flex-wrap: wrap;
    }

    .report-select {
        flex: 1;
        min-width: 130px;
    }

    .auth-card {
        padding: 24px 18px;
    }

    .auth-wrapper {
        margin: 20px auto;
    }

    .form-card-body {
        padding: 18px 16px;
    }

    .form-card-header {
        padding: 16px;
    }

    .profile-header-card {
        padding: 24px 16px;
    }

    .profile-stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .profile-stat-card {
        padding: 12px 6px;
    }

    .profile-stat-value {
        font-size: 20px;
    }

    .profile-stat-label {
        font-size: 11px;
    }

    .feed-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .sort-tabs {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sort-tab {
        flex: 1;
        text-align: center;
        justify-content: center;
        padding: 6px 8px;
        font-size: 12px;
    }

    .search-form {
        flex-direction: column;
        align-items: stretch;
    }

    .search-form input,
    .search-form select,
    .search-btn-group {
        width: 100%;
        flex: unset;
    }

    .search-btn-group button,
    .search-btn-group a {
        flex: 1;
        text-align: center;
    }
}

/* Móviles estrechos (max-width: 480px) */
@media (max-width: 480px) {
    .site-nav .nav-divider {
        display: none;
    }

    .site-nav a {
        padding: 5px 6px;
        font-size: 12px;
    }

    .nav-username-text {
        max-width: 70px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 12px 8px;
    }

    .stat-number {
        font-size: 20px;
    }

    .profile-stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .badges-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .complaint-card {
        padding: 14px;
    }

    .complaint-card-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .card-actions {
        width: 100%;
    }

    .card-actions .btn {
        flex: 1;
        text-align: center;
    }

    .share-buttons-row {
        width: 100%;
    }

    .share-buttons-row .btn {
        flex: 1;
        text-align: center;
        padding: 6px 8px;
        font-size: 12px;
    }

    .ranking-item {
        padding: 10px 12px;
        gap: 8px;
    }

    .ranking-position {
        font-size: 14px;
        width: 24px;
    }

    .ranking-avatar-img,
    .ranking-avatar-fallback {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .ranking-xp {
        font-size: 15px;
    }
}