/* Birthday Wish Platform — frontend.css v2 */

/* ── Reset / Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
.bwp-wish-card,
.bwp-modal,
.bwp-rankboard-wrap,
.bwp-maker-wrap,
.bwp-standalone-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Cards grid ───────────────────────────────────────────────────────────── */
.bwp-carousel-wrap { width: 100%; }
.bwp-cards-grid {
    display: grid;
    gap: 16px;
    width: 100%;
}
.bwp-cols-3 { grid-template-columns: repeat(3, 1fr); }
.bwp-cols-2 { grid-template-columns: repeat(2, 1fr); }
.bwp-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
    .bwp-cols-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .bwp-cols-3,
    .bwp-cols-4 { grid-template-columns: repeat(2, 1fr); }
    .bwp-cards-grid { gap: 12px; }
}
@media (max-width: 480px) {
    .bwp-cols-3,
    .bwp-cols-4,
    .bwp-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .bwp-cards-grid { gap: 10px; }
}
@media (max-width: 340px) {
    .bwp-cols-3,
    .bwp-cols-4,
    .bwp-cols-2 { grid-template-columns: 1fr; }
}

/* ── Individual card ──────────────────────────────────────────────────────── */
.bwp-wish-card {
    background: #fff;
    border: 1px solid #ebebeb;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
.bwp-wish-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(0,0,0,.10);
}
.bwp-wish-card:active { transform: scale(0.98); }

/* ── SQUARE image — 1:1 enforced ─────────────────────────────────────────── */
.bwp-card-img {
    width: 100%;
    padding-bottom: 100%; /* 1:1 square */
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
.bwp-card-img img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top; /* favor face for portrait photos */
    display: block;
}
.bwp-card-img-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(transparent, rgba(0,0,0,.35));
    pointer-events: none;
    z-index: 1;
}
.bwp-card-initials {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(28px, 6vw, 40px);
    font-weight: 700;
    letter-spacing: -1px;
}

/* ── NO-IMAGE REQUIRED — force show initials placeholder nicely ─────────── */
.bwp-card-img.bwp-no-photo {
    background: linear-gradient(135deg, #f0effe 0%, #e8e6ff 100%);
}

/* Card body */
.bwp-card-body {
    padding: 10px 12px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.bwp-card-name {
    font-size: clamp(12px, 3.2vw, 14px);
    font-weight: 700;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bwp-card-sub {
    font-size: clamp(10px, 2.8vw, 12px);
    color: #777;
    margin-top: 2px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.bwp-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    gap: 4px;
    flex-wrap: wrap;
}
.bwp-wish-count {
    font-size: 11px;
    color: #aaa;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.bwp-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #E24B4A;
    flex-shrink: 0;
    animation: bwp-pulse-dot 2s ease-in-out infinite;
}
@keyframes bwp-pulse-dot {
    0%,100% { opacity: 1; }
    50%      { opacity: 0.4; }
}
.bwp-card-actions {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-shrink: 0;
}

/* Wish / Unwish button */
.bwp-wish-btn {
    font-size: 11px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1.5px solid #ddd;
    background: transparent;
    color: #444;
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
    min-width: 48px;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.bwp-wish-btn:hover  { background: #f5f4ff; border-color: #a9a3f0; color: #3C3489; }
.bwp-wish-btn:active { transform: scale(0.95); }
.bwp-wish-btn.bwp-wished {
    background: #EEEDFE;
    border-color: #7F77DD;
    color: #3C3489;
}

/* Admin remove */
.bwp-admin-remove {
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 20px;
    border: 1px solid #ddd;
    background: transparent;
    color: #bbb;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.bwp-admin-remove:hover {
    background: #FCEBEB;
    border-color: #E24B4A;
    color: #A32D2D;
}

.bwp-empty { color: #999; font-style: italic; padding: 20px 0; text-align: center; }

/* ── Rankboard ─────────────────────────────────────────────────────────────── */
.bwp-rankboard-wrap { }
.bwp-rankboard-list { display: flex; flex-direction: column; gap: 4px; }

.bwp-rank-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s;
}
.bwp-rank-row:hover { background: #f8f7ff; }
.bwp-rank-row.bwp-pinned { background: #fffbee; }

.bwp-rank-num { font-size: 16px; min-width: 28px; text-align: center; }
.bwp-rank-num.gold   { color: #BA7517; }
.bwp-rank-num.silver { color: #888780; }
.bwp-rank-num.bronze { color: #993C1D; }

/* Rankboard avatar — SQUARE (rounded to circle but 1:1 ratio enforced) */
.bwp-rank-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    position: relative;
}
.bwp-rank-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center top;
}

.bwp-rank-info { flex: 1; min-width: 0; }
.bwp-rank-name {
    font-size: 14px; font-weight: 500; color: #1a1a1a;
    display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bwp-rank-bar-wrap { height: 5px; background: #eee; border-radius: 3px; overflow: hidden; margin-top: 5px; }
.bwp-rank-bar { height: 100%; border-radius: 3px; transition: width 0.5s ease; }

.bwp-rank-right { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; gap: 2px; }
.bwp-rank-count { font-size: 14px; font-weight: 700; color: #1a1a1a; }
.bwp-rank-label { font-size: 10px; color: #aaa; }
.bwp-rank-view  { font-size: 11px; color: #ccc; padding: 3px 8px; border-radius: 20px; border: 1px solid #eee; white-space: nowrap; }
.bwp-rank-row:hover .bwp-rank-view { color: #534AB7; border-color: #7F77DD; }

/* ── Modal overlay ─────────────────────────────────────────────────────────── */
.bwp-modal-bg {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
    padding: 12px;
    -webkit-overflow-scrolling: touch;
}
.bwp-modal-bg.bwp-open {
    opacity: 1;
    pointer-events: all;
}
.bwp-modal {
    background: #fff;
    border-radius: 24px;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.93) translateY(20px);
    transition: transform 0.25s;
    position: relative;
    box-shadow: 0 24px 64px rgba(0,0,0,.28);
    -webkit-overflow-scrolling: touch;
}
.bwp-modal-bg.bwp-open .bwp-modal { transform: scale(1) translateY(0); }

/* Modal close */
.bwp-modal-close {
    position: absolute;
    top: 12px; right: 12px;
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,.32);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
    touch-action: manipulation;
}
.bwp-modal-close:hover { background: rgba(0,0,0,.5); }

/* Modal hero with SQUARE image */
.bwp-bday-hero {
    position: relative;
    /* 16:9 on desktop, but on mobile hero is taller to show image well */
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
@media (max-width: 480px) {
    .bwp-bday-hero { aspect-ratio: 1 / 1; max-height: 260px; }
}
.bwp-hero-bg { position: absolute; inset: 0; }
.bwp-particles, .bwp-rings { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

.bwp-avatar-wrap {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    text-align: center;
}
/* Modal avatar — forced square then circle clipped */
.bwp-avatar {
    width: 88px; height: 88px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,.92);
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; font-weight: 700;
    background: rgba(255,255,255,.2);
    color: #fff;
    flex-shrink: 0;
}
.bwp-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center top;
}
.bwp-modal-name { font-size: 18px; font-weight: 800; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.35); }
.bwp-modal-sub  { font-size: 12px; color: rgba(255,255,255,.82); }

/* Modal body */
.bwp-modal-body { padding: 18px 20px 24px; }
.bwp-modal-msg {
    font-size: 14px; color: #555; text-align: center;
    line-height: 1.65; margin-bottom: 16px;
}
.bwp-modal-actions {
    display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}
.bwp-btn-wish {
    font-size: 13px; font-weight: 700;
    padding: 11px 24px;
    border-radius: 24px;
    border: none;
    background: #534AB7;
    color: #fff;
    cursor: pointer;
    transition: background 0.18s, transform 0.1s;
    touch-action: manipulation;
}
.bwp-btn-wish:hover   { background: #3C3489; }
.bwp-btn-wish:active  { transform: scale(0.97); }
.bwp-btn-wish.bwp-wished { background: #3C3489; }

.bwp-btn-wa {
    font-size: 13px; font-weight: 700;
    padding: 11px 24px;
    border-radius: 24px;
    border: none;
    background: #25D366;
    color: #fff;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex; align-items: center; gap: 6px;
    transition: background 0.18s;
    touch-action: manipulation;
}
.bwp-btn-wa:hover { background: #128C4E; color: #fff; }
.bwp-wish-total {
    text-align: center; font-size: 12px; color: #bbb; margin-top: 12px;
}

/* ── Pulse animation ──────────────────────────────────────────────────────── */
@keyframes bwp-pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.06); }
}
.pulse { animation: bwp-pulse 2.2s ease-in-out infinite; }

/* ── Particle / confetti animation ───────────────────────────────────────── */
@keyframes bwp-float-up {
    0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(-140px) rotate(400deg); opacity: 0; }
}
.bwp-particle {
    position: absolute;
    border-radius: 3px;
    pointer-events: none;
    animation: bwp-float-up 1.4s ease-out forwards;
}

/* Ring pulse */
@keyframes bwp-ring {
    0%   { transform: scale(0.5); opacity: 0.7; }
    100% { transform: scale(2.4); opacity: 0; }
}
.bwp-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.38);
    pointer-events: none;
    animation: bwp-ring 2.4s ease-out infinite;
}

/* ── Standalone animated birthday page ────────────────────────────────────── */
.bwp-standalone-page { margin: 0; padding: 0; background: #f0f0f8; min-height: 100vh; }
.bwp-standalone-wrap {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: #fff;
    box-shadow: 0 0 60px rgba(0,0,0,.08);
}

.bwp-standalone-hero {
    position: relative;
    /* 1:1 square for the hero image area */
    aspect-ratio: 1 / 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
}
.bwp-standalone-hero-img {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center top;
}
.bwp-standalone-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 40%, rgba(0,0,0,.72) 100%);
}
.bwp-standalone-avatar-wrap {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 20px 24px;
    width: 100%;
}
.bwp-standalone-name {
    font-size: clamp(22px, 7vw, 28px);
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0,0,0,.4);
    margin: 0;
    line-height: 1.2;
}
.bwp-standalone-sub {
    font-size: 13px;
    color: rgba(255,255,255,.8);
    margin-top: 4px;
}

/* No-photo fallback for standalone */
.bwp-standalone-hero.bwp-no-photo {
    aspect-ratio: 4 / 3;
    align-items: center;
}
.bwp-standalone-initials {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(48px, 16vw, 80px);
    font-weight: 900;
    color: rgba(255,255,255,.5);
}

.bwp-standalone-body { padding: 24px 20px 48px; }
.bwp-standalone-msg {
    font-size: 16px; color: #444; line-height: 1.7; text-align: center;
    border-left: 3px solid #7F77DD;
    padding: 14px 18px;
    background: #f8f7ff;
    border-radius: 0 14px 14px 0;
    margin: 0 0 24px;
    font-style: italic;
}
.bwp-standalone-stats { text-align: center; margin-bottom: 28px; }
.bwp-standalone-count { font-size: 48px; font-weight: 900; color: #534AB7; display: block; line-height: 1; }
.bwp-standalone-count-label { font-size: 13px; color: #bbb; margin-top: 4px; display: block; }

.bwp-standalone-actions { display: flex; flex-direction: column; gap: 10px; }
.bwp-btn-wish-standalone {
    font-size: 15px; font-weight: 700;
    padding: 16px;
    border-radius: 16px;
    border: none;
    background: #534AB7;
    color: #fff;
    cursor: pointer;
    width: 100%;
    transition: background 0.18s, transform 0.1s;
    touch-action: manipulation;
}
.bwp-btn-wish-standalone:active { transform: scale(0.98); }
.bwp-btn-wish-standalone.bwp-wished { background: #3C3489; }

.bwp-standalone-actions .bwp-btn-wa {
    font-size: 15px; font-weight: 700;
    padding: 15px;
    border-radius: 16px;
    text-align: center;
    width: 100%;
    display: flex; align-items: center; justify-content: center;
    gap: 8px;
    text-decoration: none;
}
.bwp-btn-back {
    font-size: 14px; font-weight: 500;
    padding: 14px;
    border-radius: 16px;
    text-align: center;
    width: 100%;
    display: block;
    text-decoration: none;
    border: 1.5px solid #ddd;
    color: #777;
    background: transparent;
    transition: border-color 0.15s;
}
.bwp-btn-back:hover { border-color: #aaa; color: #444; }

.bwp-standalone-date-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,.18);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,.3);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 8px;
}

/* ── Form — date picker enforced range ────────────────────────────────────── */
.bwp-date-hint {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

/* ── Photo upload square preview ──────────────────────────────────────────── */
.bwp-photo-upload {
    border: 2px dashed #ddd;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: #fafafa;
    aspect-ratio: 1 / 1;   /* ← square upload box */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 260px;
    position: relative;
}
.bwp-photo-upload:hover { border-color: #7F77DD; background: #f5f4ff; }
.bwp-upload-placeholder { display: flex; flex-direction: column; align-items: center; gap: 6px; color: #aaa; font-size: 13px; text-align: center; padding: 16px; }
.bwp-upload-icon { font-size: 32px; }
#bwp-photo-preview {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center top;
    border-radius: 10px;
}

/* Fluent Forms photo field square enforcement */
.ff-el-group input[type="file"] + .ff-upload-preview img,
.fluentform .ff-upload-preview img,
.fluentform img.ff-uploaded-img {
    width: 100% !important;
    aspect-ratio: 1 / 1 !important;
    object-fit: cover !important;
    object-position: center top !important;
    border-radius: 10px !important;
    display: block;
}

/* ── Mobile-first responsive polish ──────────────────────────────────────── */
@media (max-width: 600px) {
    .bwp-modal { border-radius: 20px; }
    .bwp-bday-hero { aspect-ratio: 1 / 1; }
    .bwp-btn-wish,
    .bwp-btn-wa { font-size: 14px; padding: 12px 20px; }
    .bwp-modal-body { padding: 14px 16px 20px; }
    .bwp-standalone-body { padding: 20px 16px 40px; }
    .bwp-rankboard-list .bwp-rank-view { display: none; } /* save space on mobile */
}

/* ── Maker form ───────────────────────────────────────────────────────────── */
.bwp-maker-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 600px) { .bwp-maker-grid { grid-template-columns: 1fr; } }
.bwp-field-full { grid-column: 1 / -1; }
.bwp-field { display: flex; flex-direction: column; gap: 6px; }
.bwp-field label { font-size: 13px; font-weight: 600; color: #333; }
.bwp-field input[type="text"],
.bwp-field input[type="date"],
.bwp-field textarea,
.bwp-field select {
    font-size: 14px;
    padding: 10px 13px;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    background: #fafafa;
    color: #1a1a1a;
    width: 100%;
    transition: border-color 0.18s;
    outline: none;
    -webkit-appearance: none;
}
.bwp-field input:focus,
.bwp-field textarea:focus,
.bwp-field select:focus { border-color: #7F77DD; background: #fff; }

.bwp-radio-group { display: flex; flex-direction: column; gap: 8px; }
.bwp-radio-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #555; cursor: pointer; }
.bwp-field-note { font-size: 11px; color: #aaa; margin-top: 3px; }
.bwp-maker-actions { margin-top: 20px; }
.bwp-btn-generate {
    font-size: 14px; font-weight: 700;
    padding: 13px 30px;
    border-radius: 24px;
    border: none;
    background: #534AB7;
    color: #fff;
    cursor: pointer;
    transition: background 0.18s, transform 0.1s;
    touch-action: manipulation;
    width: 100%;
}
.bwp-btn-generate:hover  { background: #3C3489; }
.bwp-btn-generate:active { transform: scale(0.97); }
.bwp-maker-status { margin-top: 14px; padding: 12px 16px; border-radius: 10px; font-size: 13px; }
.bwp-status-success { background: #E1F5EE; color: #0F6E56; }
.bwp-status-error   { background: #FCEBEB; color: #A32D2D; }
.bwp-preview-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.bwp-btn-copy-link {
    font-size: 13px; font-weight: 600;
    padding: 11px 20px;
    border-radius: 24px;
    border: 1.5px solid #7F77DD;
    background: transparent;
    color: #534AB7;
    cursor: pointer;
    flex: 1;
}
.bwp-btn-new {
    font-size: 13px;
    padding: 11px 20px;
    border-radius: 24px;
    border: 1.5px solid #ddd;
    background: transparent;
    color: #777;
    cursor: pointer;
    flex: 1;
}

/* ── Admin ────────────────────────────────────────────────────────────────── */
.bwp-stat-cards { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.bwp-stat-card { padding: 16px 20px; border-radius: 12px; background: #EEEDFE; min-width: 140px; flex: 1; }
.bwp-stat-card.bwp-stat-green  { background: #E1F5EE; }
.bwp-stat-card.bwp-stat-gray   { background: #F5F5F3; }
.bwp-stat-num   { font-size: 30px; font-weight: 800; color: #1a1a1a; }
.bwp-stat-label { font-size: 12px; color: #777; margin-top: 4px; }
