/* ============================================================
   PsyPoints — Estilos del frontend (Mi Cuenta + Store + Checkout)
   Rediseñado para integrarse con el área Mi Cuenta de WooCommerce
   ============================================================ */

/* ── Variables de marca ── */
:root {
	--psy-primary:    #FFB2EF;
	--psy-secondary:  #73DEF1;
	--psy-text:       #1A1A1A;
	--psy-text-light: #666666;
	--psy-bg:         #FDFDFD;
	--psy-border:     #E8E8E8;
	--psy-border-inner: #F0F0F0;
	--psy-radius:     10px;
	--psy-shadow:     0 2px 8px rgba(0,0,0,.06);
	--psy-shadow-hover: 0 6px 24px rgba(0,0,0,.09);
}

/* ── Contenedor principal ── */
.psy-mypoints {
	font-family: inherit;
	color: var(--psy-text);
	max-width: 860px;
}

/* ══════════════════════════════════════════════════════
   HERO: saldo + tier
   ══════════════════════════════════════════════════════ */
.psy-mypoints-hero {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 24px;
	background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
	border-radius: 8px;
	border: 1px solid rgba(255,178,239,.18);
	padding: 28px 32px;
	margin-bottom: 20px;
	color: #fff;
	box-shadow: 0 4px 20px rgba(0,0,0,.12);
}

.psy-balance-label {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 1.5px;
	color: rgba(255,255,255,.5);
	margin-bottom: 6px;
}
.psy-balance-value {
	font-size: 52px;
	font-weight: 800;
	color: var(--psy-primary);
	line-height: 1;
	letter-spacing: -1px;
}
.psy-balance-unit {
	font-size: 13px;
	color: rgba(255,255,255,.55);
	margin-top: 4px;
	text-transform: uppercase;
	letter-spacing: 1px;
}

.psy-pending-notice {
	margin-top: 16px;
	padding: 10px 14px;
	background: rgba(255,255,255,.07);
	border-radius: 6px;
	font-size: 13px;
	color: rgba(255,255,255,.8);
	border-left: 2px solid rgba(255,178,239,.4);
}
.psy-pending-tooltip {
	display: block;
	font-size: 11px;
	color: rgba(255,255,255,.45);
	margin-top: 3px;
}

/* Tier block */
.psy-mypoints-tier-block {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: flex-end;
	gap: 10px;
}
.psy-tier-badge-large {
	display: inline-block;
	padding: 6px 18px;
	border-radius: 24px;
	font-size: 15px;
	font-weight: 700;
	color: #fff;
	text-shadow: 0 1px 3px rgba(0,0,0,.3);
	letter-spacing: 0.5px;
}
.psy-tier-multiplier {
	font-size: 30px;
	font-weight: 800;
	color: var(--psy-secondary);
	text-align: right;
	line-height: 1;
}
.psy-tier-multiplier span {
	display: block;
	font-size: 11px;
	font-weight: 400;
	color: rgba(255,255,255,.45);
	text-transform: uppercase;
	letter-spacing: 1px;
	margin-top: 3px;
}
.psy-tier-preserved {
	font-size: 12px;
	color: rgba(255,255,255,.6);
	text-align: right;
	padding: 5px 10px;
	background: rgba(255,255,255,.06);
	border-radius: 6px;
}

/* ══════════════════════════════════════════════════════
   SECCIÓN DE PROGRESO
   ══════════════════════════════════════════════════════ */
.psy-progress-section {
	background: #fff;
	border: 1px solid var(--psy-border);
	border-radius: var(--psy-radius);
	padding: 24px 28px;
	margin-bottom: 16px;
	box-shadow: var(--psy-shadow);
}

.psy-progress-header {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 16px;
	font-size: 13px;
	color: var(--psy-text-light);
}
.psy-progress-next-label strong { color: var(--psy-text); }
.psy-progress-max { color: var(--psy-primary); font-weight: 700; }

.psy-progress-bar-wrap {
	display: flex;
	align-items: center;
	gap: 12px;
}
.psy-progress-bar {
	flex: 1;
	height: 10px;
	background: #f0f0f0;
	border-radius: 5px;
	overflow: hidden;
}
.psy-progress-fill {
	height: 100%;
	border-radius: 5px;
	transition: width .6s cubic-bezier(.4,0,.2,1);
}
.psy-progress-percent {
	font-size: 12px;
	color: var(--psy-text-light);
	min-width: 36px;
	text-align: right;
}

/* Escala de tiers */
.psy-tier-scale {
	display: flex;
	justify-content: space-between;
	margin-top: 20px;
	padding-top: 16px;
	border-top: 1px solid var(--psy-border-inner);
}
.psy-tier-step {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 5px;
	flex: 1;
	opacity: .35;
	transition: opacity .2s;
}
.psy-tier-step--done,
.psy-tier-step--current { opacity: 1; }
.psy-tier-step-dot {
	width: 10px; height: 10px;
	border-radius: 50%;
	border: 2px solid #fff;
	box-shadow: 0 0 0 2px rgba(0,0,0,.1);
}
.psy-tier-step--current .psy-tier-step-dot {
	width: 14px; height: 14px;
	box-shadow: 0 0 0 3px rgba(0,0,0,.12);
}
.psy-tier-step-label {
	font-size: 10px;
	text-align: center;
	color: var(--psy-text-light);
	line-height: 1.2;
}
.psy-tier-step--current .psy-tier-step-label { font-weight: 700; color: var(--psy-text); }
.psy-tier-step-pts { font-size: 9px; color: #bbb; }

/* ══════════════════════════════════════════════════════
   INFO STRIP (reset / expiración / botón store)
   ══════════════════════════════════════════════════════ */
.psy-info-strip {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	padding: 14px 18px;
	background: #f8f8f8;
	border: 1px solid var(--psy-border);
	border-radius: var(--psy-radius);
	margin-bottom: 20px;
	font-size: 13px;
	color: var(--psy-text-light);
}
.psy-info-item { display: flex; align-items: center; gap: 6px; }
.psy-info-item--warning { color: #c45a00; }
.psy-info-icon { font-size: 15px; }
.psy-btn-store {
	display: inline-block;
	padding: 7px 18px;
	background: var(--psy-primary);
	color: var(--psy-text) !important;
	border-radius: 20px;
	font-weight: 700;
	font-size: 13px;
	text-decoration: none !important;
	transition: opacity .15s, transform .15s;
}
.psy-btn-store:hover { opacity: .85; transform: translateY(-1px); }

/* ══════════════════════════════════════════════════════
   HISTORIAL DE TRANSACCIONES
   ══════════════════════════════════════════════════════ */
.psy-history-section {
	background: #fff;
	border: 1px solid var(--psy-border);
	border-radius: var(--psy-radius);
	padding: 24px 28px;
	box-shadow: var(--psy-shadow);
}

/* Título de sección — Rajdhani con línea decorativa rosa */
.psy-section-title {
	font-family: 'Rajdhani', sans-serif;
	font-size: 15px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 1.5px;
	color: var(--psy-text);
	margin: 0 0 20px;
	display: inline-block;
	padding-bottom: 8px;
	border-bottom: 2px solid var(--psy-primary);
}

.psy-history-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 14px 0;
	border-bottom: 1px solid var(--psy-border-inner);
	gap: 16px;
}
.psy-history-row:last-child { border-bottom: none; }
.psy-history-row--cancelled { opacity: .5; }
.psy-history-row--pending {
	background: #fffbf0;
	margin: 0 -28px;
	padding: 14px 28px;
}

.psy-history-info {
	display: flex;
	flex-direction: column;
	gap: 3px;
	flex: 1;
}
.psy-history-label {
	font-size: 14px;
	font-weight: 600;
	color: var(--psy-text);
}
.psy-history-label--cancelled { text-decoration: line-through; }
.psy-history-date { font-size: 11px; color: var(--psy-text-light); }

.psy-history-badge {
	display: inline-block;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	padding: 2px 8px;
	border-radius: 4px;
	letter-spacing: .5px;
}
.psy-history-badge--pending   { background: #fff3cd; color: #664d03; }
.psy-history-badge--cancelled { background: #e2e3e5; color: #41464b; }
.psy-history-badge--used      { background: #cfe2ff; color: #084298; }

.psy-history-points {
	font-size: 17px;
	font-weight: 800;
	white-space: nowrap;
}
.psy-pts-unit { font-size: 11px; font-weight: 400; color: var(--psy-text-light); }
.psy-pts--positive { color: #0a5c2a; }
.psy-pts--negative { color: #8b1a1a; }
.psy-pts--cancelled { text-decoration: line-through; color: var(--psy-text-light) !important; }

.psy-empty {
	text-align: center;
	color: var(--psy-text-light);
	padding: 32px 0;
	font-size: 14px;
}

/* Paginación del historial */
.psy-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
	padding-top: 20px;
	border-top: 1px solid var(--psy-border-inner);
	margin-top: 8px;
}
.psy-page-btn {
	background: none;
	border: 1px solid var(--psy-border);
	padding: 6px 14px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 13px;
	transition: border-color .15s, color .15s;
}
.psy-page-btn:hover:not(:disabled) { border-color: var(--psy-primary); color: var(--psy-primary); }
.psy-page-btn:disabled { opacity: .3; cursor: not-allowed; }
.psy-page-info { font-size: 13px; color: var(--psy-text-light); }

/* ══════════════════════════════════════════════════════
   PSYPOINTS STORE (dentro de Mi Cuenta)
   ══════════════════════════════════════════════════════ */
.psy-store { max-width: 860px; }

.psy-store-balance {
	padding: 12px 16px;
	background: #f0faf5;
	border-radius: 8px;
	font-size: 14px;
	margin-bottom: 20px;
	border: 1px solid #d1ead9;
}
.psy-store-guest-notice {
	padding: 12px 16px;
	background: #fff3cd;
	border-radius: 8px;
	font-size: 14px;
	margin-bottom: 20px;
	border: 1px solid #ffe08a;
}
.psy-store-empty {
	text-align: center;
	padding: 48px 0;
	color: var(--psy-text-light);
}
.psy-store-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 20px;
}
.psy-store-card {
	background: #fff;
	border: 1px solid var(--psy-border);
	border-radius: var(--psy-radius);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: box-shadow .2s, transform .2s;
	box-shadow: var(--psy-shadow);
}
.psy-store-card:hover { box-shadow: var(--psy-shadow-hover); transform: translateY(-2px); }
.psy-store-card--oos { opacity: .6; }

.psy-store-card-img {
	position: relative;
	background: #f6f6f6;
	aspect-ratio: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}
.psy-store-img { width: 100%; height: 100%; object-fit: cover; }
.psy-store-img-placeholder { font-size: 48px; }
.psy-store-rotation-badge {
	position: absolute; top: 8px; right: 8px;
	background: var(--psy-primary);
	color: var(--psy-text);
	font-size: 10px; font-weight: 700;
	padding: 3px 8px;
	border-radius: 12px;
}

.psy-store-card-body { padding: 16px; flex: 1; }
.psy-store-card-name { font-size: 15px; font-weight: 700; margin: 0 0 8px; }
.psy-store-card-desc { font-size: 12px; color: var(--psy-text-light); margin: 0 0 12px; line-height: 1.4; }
.psy-store-card-cost {
	font-size: 22px;
	font-weight: 800;
	color: var(--psy-primary);
}
.psy-store-card-cost span { font-size: 12px; font-weight: 400; color: var(--psy-text-light); }
.psy-store-card-stock { font-size: 11px; color: var(--psy-text-light); margin-top: 4px; }
.psy-stock--oos { color: #c0392b; font-weight: 600; }

.psy-store-card-footer { padding: 0 16px 16px; }

/* Botón de canjear — selector .js-psy-redeem no se toca */
.psy-btn-redeem {
	display: block;
	width: 100%;
	padding: 10px;
	background: var(--psy-primary);
	color: var(--psy-text);
	border: none;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	text-align: center;
	text-decoration: none;
	transition: opacity .15s, transform .1s;
}
.psy-btn-redeem:hover:not(:disabled) { opacity: .85; transform: translateY(-1px); }
.psy-btn-redeem--disabled { background: #e0e0e0; color: #888; cursor: not-allowed; transform: none !important; }
.psy-btn-redeem--login { background: var(--psy-secondary); color: var(--psy-text); }

.psy-redeem-feedback {
	margin-top: 16px;
	padding: 12px 16px;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
}
.psy-redeem-feedback.psy-feedback--success { background: #d1e7dd; color: #0a3622; }
.psy-redeem-feedback.psy-feedback--error   { background: #f8d7da; color: #58151c; }

/* ══════════════════════════════════════════════════════
   CHECKOUT / CARRITO
   ══════════════════════════════════════════════════════ */
.psy-checkout-notice { margin-bottom: 16px; }
.psy-checkout-points-row th,
.psy-checkout-points-row td { color: var(--psy-text); }
.psy-checkout-points-row .psy-points-amount { color: var(--psy-primary); font-size: 15px; }
.psy-checkout-points-row .psy-tier-bonus { color: var(--psy-text-light); font-size: 12px; }
.psy-cart-points-row { background: #fffbf0 !important; }
.psy-cart-balance-row a { color: var(--psy-primary) !important; }

/* ══════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════ */
@media (max-width: 640px) {
	.psy-mypoints-hero {
		grid-template-columns: 1fr;
		padding: 20px 22px;
	}
	.psy-mypoints-tier-block { align-items: flex-start; }
	.psy-tier-multiplier   { text-align: left; }
	.psy-tier-preserved    { text-align: left; }
	.psy-balance-value     { font-size: 40px; }
	.psy-tier-scale        { display: none; }
	.psy-progress-header   { flex-direction: column; }
	.psy-store-grid        { grid-template-columns: 1fr 1fr; }
	.psy-info-strip        { flex-direction: column; align-items: flex-start; }
	.psy-progress-section,
	.psy-history-section   { padding: 18px 16px; }
	.psy-history-row--pending { margin: 0 -16px; padding: 14px 16px; }
}
@media (max-width: 400px) {
	.psy-store-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════
   SHORTCODE: [psypoints_balance]
   ══════════════════════════════════════════════════════ */
.psy-balance-inline {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	font-size: 14px;
}
.psy-balance-inline__value {
	font-size: 18px;
	font-weight: 800;
	color: var(--psy-primary);
}
.psy-balance-inline__label { color: var(--psy-text-light); }
.psy-balance-inline__link {
	color: var(--psy-primary);
	font-weight: 600;
	text-decoration: none;
}
.psy-balance-inline__link:hover { text-decoration: underline; }
.psy-balance-inline--guest .psy-balance-inline__login-link {
	color: var(--psy-primary);
	font-weight: 600;
}

/* ══════════════════════════════════════════════════════
   SHORTCODE: [psypoints_tiers_table]
   ══════════════════════════════════════════════════════ */
.psy-tiers-table {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 12px;
}
.psy-tier-card {
	background: #fff;
	border: 2px solid var(--psy-border);
	border-radius: var(--psy-radius);
	padding: 20px 12px;
	text-align: center;
	position: relative;
	transition: box-shadow .2s, border-color .2s;
	box-shadow: var(--psy-shadow);
}
.psy-tier-card--current {
	border-color: var(--tier-color, var(--psy-primary));
	box-shadow: 0 4px 20px rgba(0,0,0,.08);
}
.psy-tier-card__current-badge {
	position: absolute;
	top: -12px; left: 50%;
	transform: translateX(-50%);
	background: var(--tier-color, var(--psy-primary));
	color: #fff;
	font-size: 10px; font-weight: 700;
	padding: 3px 10px;
	border-radius: 12px;
	white-space: nowrap;
}
.psy-tier-card__dot {
	width: 40px; height: 40px;
	border-radius: 50%;
	margin: 0 auto 12px;
}
.psy-tier-card__name {
	font-size: 13px; font-weight: 700;
	color: var(--psy-text);
	margin-bottom: 8px;
}
.psy-tier-card__multiplier {
	font-size: 28px; font-weight: 800;
	color: var(--tier-color, var(--psy-text));
	line-height: 1;
	margin-bottom: 8px;
}
.psy-tier-card__min {
	font-size: 10px;
	color: var(--psy-text-light);
	line-height: 1.3;
}

/* ══════════════════════════════════════════════════════
   STORE STANDALONE (fuera de Mi Cuenta)
   ══════════════════════════════════════════════════════ */
/*
 * El hero (.psy-store-hero) es sibling del wrapper .psy-store--standalone,
 * no un hijo — por eso sus selectores no usan el padre como prefijo.
 */
.psy-store--standalone {
	max-width: 1100px;
	margin: 60px auto;
	padding: 0 24px;
}
.psy-store--standalone > .psy-section-title,
.psy-store--standalone > .psy-store-balance,
.psy-store--standalone > .psy-store-guest-notice {
	display: none;
}

.psy-store-hero {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 16px;
	background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
	border-radius: var(--psy-radius);
	border: 1px solid rgba(255,178,239,.15);
	padding: 28px 32px;
	margin-bottom: 32px;
	color: #fff;
	max-width: 1100px;
	margin-left: auto;
	margin-right: auto;
	box-sizing: border-box;
	box-shadow: 0 4px 20px rgba(0,0,0,.15);
}
.psy-store-hero__title {
	font-family: 'Bangers', cursive;
	font-size: 36px;
	letter-spacing: 2px;
	color: var(--psy-primary);
	line-height: 1;
	margin: 0;
}
.psy-store-hero__balance {
	display: flex;
	align-items: baseline;
	gap: 8px;
}
.psy-store-hero__pts {
	font-size: 40px; font-weight: 800;
	color: var(--psy-primary);
	line-height: 1;
}
.psy-store-hero__pts-label {
	font-size: 14px;
	color: rgba(255,255,255,.55);
}
@media (max-width: 640px) {
	.psy-store--standalone { margin: 32px auto; }
	.psy-store-hero { padding: 20px; margin-bottom: 20px; }
	.psy-store-hero__title { font-size: 28px; }
	.psy-store-hero__pts { font-size: 32px; }
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE: tiers table
   ══════════════════════════════════════════════════════ */
@media (max-width: 860px) {
	.psy-tiers-table { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 540px) {
	.psy-tiers-table { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 320px) {
	.psy-tiers-table { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════
   INTEGRACIÓN CON WOOCOMMERCE MI CUENTA
   ══════════════════════════════════════════════════════ */

/* Tipografía coherente con la marca */
.woocommerce-account .psy-mypoints .psy-section-title {
	font-family: 'Rajdhani', sans-serif;
	font-weight: 700;
}
.woocommerce-account .psy-mypoints .psy-store-card-name,
.woocommerce-account .psy-mypoints .psy-history-label,
.woocommerce-account .psy-mypoints .psy-step-title {
	font-family: 'Quattrocento Sans', serif;
}

/* El h2 que WooCommerce puede inyectar antes del contenido del tab */
.woocommerce-account .woocommerce-MyAccount-content > h2:first-child {
	font-size: 16px;
	font-weight: 600;
	color: var(--psy-text-light);
	margin-bottom: 20px;
	padding-bottom: 0;
	border-bottom: none;
}

/* Botones WC genéricos dentro del tab */
.woocommerce-account .psy-mypoints .button,
.woocommerce-account .psy-mypoints input[type="submit"] {
	background: var(--psy-primary) !important;
	color: var(--psy-text) !important;
	border: none !important;
	border-radius: 8px !important;
	font-weight: 700 !important;
	box-shadow: none !important;
	transition: opacity .15s !important;
}
.woocommerce-account .psy-mypoints .button:hover,
.woocommerce-account .psy-mypoints input[type="submit"]:hover {
	opacity: .85 !important;
	background: var(--psy-primary) !important;
	color: var(--psy-text) !important;
}

/* Inputs dentro del tab */
.woocommerce-account .psy-mypoints input[type="text"],
.woocommerce-account .psy-mypoints input[type="number"],
.woocommerce-account .psy-mypoints select {
	border-radius: 6px !important;
	border-color: var(--psy-border) !important;
}
.woocommerce-account .psy-mypoints input:focus,
.woocommerce-account .psy-mypoints select:focus {
	border-color: var(--psy-primary) !important;
	outline: none !important;
	box-shadow: 0 0 0 3px rgba(255,178,239,.2) !important;
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE MI CUENTA
   ══════════════════════════════════════════════════════ */
@media (max-width: 640px) {
	.woocommerce-account .psy-mypoints { max-width: 100%; }
	.woocommerce-account .psy-mypoints-hero {
		padding: 20px;
		border-radius: 8px;
	}
	.woocommerce-account .psy-mypoints .psy-progress-section,
	.woocommerce-account .psy-mypoints .psy-history-section {
		padding: 16px;
	}
}
