* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a3a52 0%, #2c5aa0 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    padding: 40px;
    text-align: center;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.header {
    margin-bottom: 40px;
}

.logo {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #1a3a52 0%, #2c5aa0 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 30px;
}

h1 {
    color: #333;
    font-size: 28px;
    margin-bottom: 10px;
}

.subtitle {
    color: #999;
    font-size: 16px;
    margin-bottom: 10px;
}

.joyeria-nombre {
    color: #2c5aa0;
    font-weight: 600;
    font-size: 20px;
}

.opciones {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 40px 0;
}

.opcion {
    padding: 25px;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.opcion:hover {
    border-color: #2c5aa0;
    background: #f5f5f5;
    transform: translateY(-5px);
}

.opcion.selected {
    color: white;
}

.opcion-icon {
    font-size: 40px;
}

.opcion-texto {
    font-size: 16px;
    font-weight: 600;
}

.opcion.malo:hover, .opcion.malo.selected {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-color: #f5576c;
}

.opcion.regular:hover, .opcion.regular.selected {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    border-color: #fee140;
}

.opcion.bueno:hover, .opcion.bueno.selected {
    background: linear-gradient(135deg, #30b0fe 0%, #58e368 100%);
    border-color: #58e368;
}

.opcion.excelente:hover, .opcion.excelente.selected {
    background: linear-gradient(135deg, #ffa751 0%, #ffe259 100%);
    border-color: #ffe259;
}

@media (max-width: 500px) {
    .opciones { grid-template-columns: 1fr; }
    .container { padding: 30px 20px; }
    h1 { font-size: 24px; }
}

.mensaje {
    display: none;
    padding: 20px;
    border-radius: 10px;
    margin-top: 30px;
    font-size: 16px;
    font-weight: 600;
}

.mensaje.success {
    background: #e8f5e9;
    color: #2e7d32;
    display: block;
}

.mensaje.error {
    background: #ffebee;
    color: #c62828;
    display: block;
}

.loading {
    display: none;
}

.loading.active {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
}

.spinner {
    width: 8px;
    height: 8px;
    background: #2c5aa0;
    border-radius: 50%;
    animation: spin 1s infinite;
}

.spinner:nth-child(2) { animation-delay: 0.2s; }
.spinner:nth-child(3) { animation-delay: 0.4s; }

@keyframes spin {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.redirect-contador {
    color: #2c5aa0;
    font-size: 14px;
    margin-top: 15px;
}

/* ---- Admin ---- */

.dashboard-shell {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    text-align: left;
    animation: slideUp 0.5s ease-out;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    text-align: left;
    color: white;
}

.admin-header h1 {
    color: white;
}

.admin-header .subtitle {
    color: rgba(255, 255, 255, 0.75);
}

.panel-block {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 24px;
    margin-bottom: 20px;
}

.panel-block h2 {
    font-size: 16px;
    color: #333;
    margin-bottom: 16px;
}

.panel-block.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

@media (max-width: 700px) {
    .panel-block.two-col {
        grid-template-columns: 1fr;
    }
}

.btn {
    background: #2c5aa0;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn:hover { background: #1a3a52; }

.btn-danger { background: #c62828; }
.btn-danger:hover { background: #8e0000; }

.btn-secondary { background: #999; }
.btn-secondary:hover { background: #666; }

.form-group {
    text-align: left;
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 5px;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: #2c5aa0;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    text-align: left;
}

th, td {
    padding: 10px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

th {
    color: #555;
    font-size: 12px;
    text-transform: uppercase;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge.activo { background: #e8f5e9; color: #2e7d32; }
.badge.inactivo { background: #ffebee; color: #c62828; }

.stats-row {
    display: flex;
    gap: 8px;
    font-size: 12px;
}

.error-text {
    color: #c62828;
    font-size: 14px;
    margin-top: 10px;
}

/* ---- Dashboard stats cards ---- */

.stats-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

@media (max-width: 700px) {
    .stats-cards { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 30px;
    font-weight: 700;
    color: #2c5aa0;
}

.stat-label {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ---- Grafico de barras por zona (CSS puro) ---- */

.zona-chart-row {
    display: grid;
    grid-template-columns: 140px 1fr 110px;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 13px;
}

.zona-chart-label {
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.zona-chart-track {
    background: #f0f0f0;
    border-radius: 6px;
    height: 18px;
    overflow: hidden;
}

.zona-chart-fill {
    height: 100%;
    background: linear-gradient(90deg, #2c5aa0, #58e368);
    border-radius: 6px;
}

.zona-chart-meta {
    color: #666;
    text-align: right;
    white-space: nowrap;
}

/* ---- Rankings top/bottom ---- */

.ranking {
    list-style: none;
    counter-reset: rank;
}

.ranking li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.ranking li:last-child { border-bottom: none; }

.ranking .rank-nombre {
    font-weight: 600;
    color: #333;
}

.ranking .rank-detalle {
    color: #999;
    font-size: 12px;
}

.ranking .rank-pct {
    font-weight: 700;
}

/* ---- Toolbar / buscador ---- */

.toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

#buscador {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
}

#buscador:focus { outline: 2px solid #58e368; }

/* ---- Acordeon de zonas ---- */

.zona-grupo {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    margin-bottom: 12px;
    overflow: hidden;
}

.zona-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    color: #1a3a52;
    text-align: left;
}

.zona-header:hover { background: #f8f9fb; }

.zona-header-meta {
    font-size: 12px;
    font-weight: 500;
    color: #999;
}

.zona-caret {
    transition: transform 0.2s ease;
    margin-left: 12px;
}

.zona-grupo.abierta .zona-caret { transform: rotate(180deg); }

.zona-tabla-wrap { display: none; padding: 0 20px 16px; }
.zona-grupo.abierta .zona-tabla-wrap { display: block; }

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 8px;
}

.acciones-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ---- Modal QR ---- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal-box {
    background: white;
    border-radius: 16px;
    padding: 30px;
    max-width: 340px;
    width: 100%;
    text-align: center;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.qr-link {
    font-size: 12px;
    color: #666;
    word-break: break-all;
    margin: 12px 0;
}

.admin-body {
    align-items: flex-start;
    padding-top: 40px;
    padding-bottom: 40px;
}
