/**
 * WA Frontend Tickets — Frontend Panel Styles
 *
 * Styles for the My Account management panels:
 * events, products, templates, and tickets list.
 */

/* ── Panel Layout ─────────────────────────────────────────── */

.wa-frontend-panel {
    margin-top: 10px;
}

.wa-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.wa-panel-header h3 {
    margin: 0;
    font-size: 1.3em;
}

/* ── Buttons ──────────────────────────────────────────────── */

.wa-btn-primary {
    background-color: #2271b1 !important;
    color: #fff !important;
    border-color: #2271b1 !important;
}

.wa-btn-primary:hover {
    background-color: #135e96 !important;
    border-color: #135e96 !important;
}

.wa-btn-danger {
    color: #d63638 !important;
    border-color: #d63638 !important;
}

.wa-btn-danger:hover {
    background-color: #d63638 !important;
    color: #fff !important;
}

.wa-btn-pdf {
    background-color: #cc3333 !important;
    color: #fff !important;
    border-color: #cc3333 !important;
}

.wa-btn-pdf:hover {
    background-color: #a62626 !important;
}

.wa-btn-download-pdf {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* ── Tables ───────────────────────────────────────────────── */

.wa-panel-table {
    width: 100%;
    font-size: 0.9em;
}

.wa-panel-table th {
    background-color: #f7f7f7;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}

.wa-panel-table td {
    vertical-align: middle;
}

.wa-panel-table .button-small {
    font-size: 0.85em;
    padding: 3px 10px;
    margin: 2px;
}

/* ── Status Badges ────────────────────────────────────────── */

.wa-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wa-status-publish,
.wa-status-active {
    background-color: #e6f4ea;
    color: #1e7e34;
}

.wa-status-draft {
    background-color: #fef3e2;
    color: #b45309;
}

.wa-status-pending {
    background-color: #fff3cd;
    color: #856404;
}

.wa-status-used {
    background-color: #e2e3e5;
    color: #383d41;
}

.wa-status-cancelled {
    background-color: #f8d7da;
    color: #721c24;
}

/* ── Empty State ──────────────────────────────────────────── */

.wa-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 1em;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px dashed #ddd;
}

/* ── Forms ─────────────────────────────────────────────────── */

.wa-form {
    max-width: 800px;
}

.wa-form .wa-form-row {
    margin-bottom: 15px;
}

.wa-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.wa-form label .required {
    color: #d63638;
}

.wa-form .input-text,
.wa-form input[type="text"],
.wa-form input[type="number"],
.wa-form input[type="datetime-local"],
.wa-form textarea,
.wa-form select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 0.95em;
}

.wa-form .input-text:focus,
.wa-form input:focus,
.wa-form textarea:focus,
.wa-form select:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 1px #2271b1;
}

.wa-form-row-split {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.wa-form-row-split .wa-half {
    flex: 1;
    min-width: 200px;
}

.wa-form-actions {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

/* ── Filters ──────────────────────────────────────────────── */

.wa-tickets-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.wa-tickets-filters select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 150px;
}

/* ── Tickets grouped by order ─────────────────────────────── */

.wa-tickets-order-group {
    margin-bottom: 30px;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
}

.wa-tickets-order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f7f7f7;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
    gap: 10px;
}

.wa-tickets-order-header h4 {
    margin: 0;
    font-size: 1em;
}

.wa-tickets-order-header h4 small {
    font-weight: 400;
    color: #999;
    margin-left: 8px;
}

.wa-tickets-order-group .wa-panel-table {
    margin-bottom: 0;
}

/* ── Builder frontend overrides ───────────────────────────── */
/* Main builder styles come from ticket-builder.css (shared).  */
/* These are minor context-specific adjustments for My Account */

.wa-builder-frontend {
    margin-top: 20px;
    border-radius: 8px;
}

.wa-builder-frontend .wa-builder-sidebar h3,
.wa-builder-frontend .wa-builder-layers h3 {
    font-size: 12px;
}

/* ── KPI Cards ────────────────────────────────────────────── */

.wa-kpi-row {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.wa-kpi-card {
    flex: 1;
    min-width: 120px;
    padding: 16px;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 8px;
    text-align: center;
}

.wa-kpi-number {
    font-size: 1.8em;
    font-weight: 700;
    color: #333;
    line-height: 1.2;
}

.wa-kpi-label {
    font-size: 0.8em;
    color: #777;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.wa-kpi-active {
    border-left: 3px solid #1e7e34;
}

.wa-kpi-active .wa-kpi-number {
    color: #1e7e34;
}

.wa-kpi-used {
    border-left: 3px solid #2271b1;
}

.wa-kpi-used .wa-kpi-number {
    color: #2271b1;
}

.wa-kpi-cancelled {
    border-left: 3px solid #d63638;
}

.wa-kpi-cancelled .wa-kpi-number {
    color: #d63638;
}

/* ── Charts ───────────────────────────────────────────────── */

.wa-charts-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.wa-chart-container {
    flex: 1;
    min-width: 300px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
}

.wa-chart-container h4 {
    margin: 0 0 12px;
    font-size: 0.95em;
    color: #555;
}

.wa-chart-full {
    flex: 1 1 100%;
}

/* ── Progress Bars ────────────────────────────────────────── */

.wa-progress-bar {
    position: relative;
    background: #e9ecef;
    border-radius: 12px;
    height: 22px;
    overflow: hidden;
    min-width: 100px;
}

.wa-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #2271b1, #1e7e34);
    border-radius: 12px;
    transition: width 0.4s ease;
}

.wa-progress-bar span {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 0.75em;
    font-weight: 600;
    color: #333;
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 768px) {
    .wa-panel-header {
        flex-direction: column;
        align-items: stretch;
    }

    .wa-form-row-split {
        flex-direction: column;
    }

    .wa-tickets-order-header {
        flex-direction: column;
        align-items: stretch;
    }

    .wa-panel-table {
        font-size: 0.8em;
    }

    .wa-panel-table .button-small {
        font-size: 0.75em;
        padding: 2px 6px;
    }

    .wa-kpi-row {
        flex-direction: column;
    }

    .wa-kpi-card {
        min-width: auto;
    }

    .wa-charts-row {
        flex-direction: column;
    }

    .wa-chart-container {
        min-width: auto;
    }

    .wa-tickets-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .wa-pagination {
        flex-direction: column;
        text-align: center;
    }
}

/* ── Pagination ──────────────────────────────────────────── */

.wa-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    flex-wrap: wrap;
}

.wa-pagination-info {
    font-size: 0.85em;
    color: #666;
}

/* ── WooCommerce overrides for My Account ──────────────────── */

.woocommerce-MyAccount-content .wa-frontend-panel .woocommerce-message {
    margin-bottom: 15px;
}

.woocommerce-MyAccount-content .wa-frontend-panel .woocommerce-error {
    margin-bottom: 15px;
}

/* ── Mis Tickets (2.9.8, D-P31) ──────────────────────────────
   Colores del tema de entradas (wopytickets, oscuro: --wt-*) con respaldo claro para los
   demás temas. Tarjetas en una columna en el celular; botones de 44 px de alto. */

.wa-mis-tickets {
    --wa-mt-borde: var(--wt-border, #e3e6ea);
    --wa-mt-fondo: var(--wt-bg-card, #ffffff);
    --wa-mt-campo: var(--wt-bg-surface, #ffffff);
    --wa-mt-texto: var(--wt-text, #1f2933);
    --wa-mt-titulo: var(--wt-text-heading, #111827);
    --wa-mt-suave: var(--wt-text-secondary, #5b6573);
    --wa-mt-acento: var(--wt-primary, #2271b1);
    --wa-mt-radio: var(--wt-radius, 10px);
    color: var(--wa-mt-texto);
}

.wa-mis-tickets .wa-empty-state {
    background: var(--wa-mt-fondo);
    border-color: var(--wa-mt-borde);
    color: var(--wa-mt-suave);
}

.wa-mt-elegir {
    margin: 0 0 20px;
}

.wa-mt-elegir label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--wa-mt-titulo);
}

.wa-mt-elegir__fila {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* width: 100% no es decorativo: sin un ancho en porcentaje, el selector aporta al ancho mínimo de
   la página el de su opción más larga (un evento de nombre largo empujaba la columna de Mi cuenta
   del tema a ~700 px en el celular). */
.wa-mt-elegir select {
    flex: 1 1 220px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--wa-mt-borde);
    border-radius: var(--wt-radius-sm, 6px);
    background: var(--wa-mt-campo);
    color: var(--wa-mt-texto);
}

.wa-mt-elegir .button,
.wa-mt-entrada__pdf {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.wa-mt-eventos,
.wa-mt-entradas {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.wa-mt-eventos {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
}

.wa-mt-evento,
.wa-mt-entrada {
    margin: 0;
    min-width: 0;
}

.wa-mt-evento__enlace {
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 100%;
    padding: 16px;
    border: 1px solid var(--wa-mt-borde);
    border-radius: var(--wa-mt-radio);
    background: var(--wa-mt-fondo);
    color: var(--wa-mt-texto);
    text-decoration: none;
}

.wa-mt-evento__enlace:hover,
.wa-mt-evento__enlace:focus-visible {
    border-color: var(--wa-mt-acento);
    color: var(--wa-mt-texto);
}

.wa-mt-evento__enlace:focus-visible {
    outline: 2px solid var(--wa-mt-acento);
    outline-offset: 2px;
}

.wa-mt-evento__titulo {
    font-size: 1.05em;
    font-weight: 700;
    color: var(--wa-mt-titulo);
    overflow-wrap: anywhere;
}

.wa-mt-evento__meta {
    color: var(--wa-mt-suave);
    font-size: 0.9em;
    overflow-wrap: anywhere;
}

p.wa-mt-evento__meta {
    margin: -10px 0 16px;
}

.wa-mt-evento__cantidad {
    margin-top: 6px;
    font-weight: 600;
}

.wa-mt-evento__ver {
    margin-top: auto;
    padding-top: 6px;
    font-weight: 600;
    color: var(--wa-mt-acento);
}

.wa-mt-entrada {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--wa-mt-borde);
    border-radius: var(--wa-mt-radio);
    background: var(--wa-mt-fondo);
}

.wa-mt-entrada__datos {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    min-width: 0;
}

.wa-mt-entrada__datos strong {
    color: var(--wa-mt-titulo);
}

.wa-mt-entrada__datos span:not(.wa-status) {
    color: var(--wa-mt-suave);
    font-size: 0.9em;
    overflow-wrap: anywhere;
}

.wa-mt-volver {
    margin: 0 0 12px;
}

.wa-mt-nota {
    margin: 16px 0;
    color: var(--wa-mt-suave);
    font-size: 0.9em;
}

.wa-mis-tickets .screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 600px) {
    .wa-mt-entrada {
        flex-direction: column;
        align-items: stretch;
    }

    .wa-mt-elegir .button {
        flex: 1 1 100%;
    }
}
