/* ============================================================
   Channels FUNraiser — Stylesheet v3.1.0
   Mobile-first, large tiles, game-board feel
   ============================================================ */

/* ---------------------------------------------------------------
   Variables
--------------------------------------------------------------- */
:root {
    --cfr-primary:   #FF6B6B;
    --cfr-secondary: #FFC300;
    --cfr-dark:      #0a0a0a;
    --cfr-white:     #fff;
    --cfr-radius:    12px;
    --cfr-shadow:    0 4px 20px rgba(0,0,0,0.18);
    --cfr-font:      'Segoe UI', Arial, sans-serif;
}

/* ---------------------------------------------------------------
   Board page — full dark background
--------------------------------------------------------------- */
body.cfr-fullscreen,
body.cfr-fullscreen-body {
    margin: 0;
    padding: 0;
    background: #0a0a0a;
    font-family: var(--cfr-font);
}

/* ---------------------------------------------------------------
   Board wrap
--------------------------------------------------------------- */
.cfr-board-wrap {
    font-family: var(--cfr-font);
    width: 100%;
    max-width: 100%;
    padding: 10px 6px 30px;
    box-sizing: border-box;
    background: #0a0a0a;
    min-height: 100vh;
}

/* ---------------------------------------------------------------
   Board header
--------------------------------------------------------------- */
.cfr-board-header {
    text-align: center;
    padding: 10px 8px 6px;
    margin-bottom: 8px;
}

.cfr-board-title {
    font-size: clamp(1.1rem, 5vw, 1.8rem);
    font-weight: 800;
    color: #fff;
    margin: 0 0 8px;
    line-height: 1.2;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.cfr-board-meta {
    max-width: 500px;
    margin: 0 auto;
}

.cfr-progress-wrap { margin: 6px 0; }

.cfr-progress-bar {
    background: #333;
    border-radius: 20px;
    height: 10px;
    overflow: hidden;
}

.cfr-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2ECC71, #1ABC9C);
    border-radius: 20px;
    transition: width 1s ease;
}

.cfr-progress-text {
    font-size: 0.85rem;
    color: #aaa;
    margin-top: 4px;
}

.cfr-progress-text strong { color: #2ECC71; }

/* ---------------------------------------------------------------
   Legend
--------------------------------------------------------------- */
.cfr-legend {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.cfr-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    color: #aaa;
}

.cfr-legend-item::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 4px;
}

.cfr-legend-available::before { background: var(--cfr-primary); }
.cfr-legend-reserved::before  { background: #444; }
.cfr-legend-claimed::before   { background: #111; border: 1px solid #555; }

/* ---------------------------------------------------------------
   THE BOARD GRID
   Mobile: 4 columns  |  Tablet: 6  |  Desktop: 8
   Tiles are SQUARE and as large as possible
--------------------------------------------------------------- */
.cfr-board-grid {
    display: grid;
    gap: 6px;
    padding: 4px;
    /* 4 columns on mobile — tiles will be roughly 22vw each */
    grid-template-columns: repeat(4, 1fr);
    width: 100%;
    box-sizing: border-box;
}

@media (min-width: 540px) {
    .cfr-board-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 7px;
    }
}

@media (min-width: 900px) {
    .cfr-board-grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 8px;
        max-width: 1100px;
        margin: 0 auto;
    }
}

/* ---------------------------------------------------------------
   Individual Square
   aspect-ratio: 1 makes them perfectly square
   min-height ensures they're never tiny
--------------------------------------------------------------- */
.cfr-square {
    border-radius: 10px;
    aspect-ratio: 1 / 1;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4px;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    cursor: default;
    /* Smooth color transitions */
    transition: background-color 0.3s ease, transform 0.12s ease, box-shadow 0.12s ease;
    box-shadow: 0 3px 10px rgba(0,0,0,0.35);
}

/* Available — clickable, pops on hover/tap */
.cfr-sq-available {
    cursor: pointer;
}

.cfr-sq-available:hover,
.cfr-sq-available:active {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0,0,0,0.5);
    z-index: 2;
}

/* Claimed — black, no hover effect */
.cfr-sq-claimed {
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

/* ---------------------------------------------------------------
   Amount label — big, bold, readable
--------------------------------------------------------------- */
.cfr-sq-amount {
    font-weight: 900;
    /* Scales from 0.75rem on tiny screens to 1.1rem on desktop */
    font-size: clamp(0.75rem, 3.5vw, 1.1rem);
    line-height: 1.1;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    letter-spacing: -0.02em;
}

.cfr-sq-amount-claimed {
    font-size: clamp(0.6rem, 2.5vw, 0.8rem);
    opacity: 0.85;
}

/* ---------------------------------------------------------------
   TAP label — small hint under the amount
--------------------------------------------------------------- */
.cfr-sq-tap {
    font-size: clamp(0.5rem, 2vw, 0.65rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    opacity: 0.85;
    margin-top: 2px;
    text-transform: uppercase;
}

/* LOCKED state styling */
.cfr-sq-locked-amt {
    color: #000 !important;
    font-size: clamp(0.8rem, 3.5vw, 1.1rem);
}

.cfr-sq-locked-lbl {
    color: #000 !important;
    font-size: clamp(0.5rem, 2vw, 0.65rem);
}

/* ---------------------------------------------------------------
   Reserved square labels
--------------------------------------------------------------- */
.cfr-sq-hold {
    font-size: clamp(0.45rem, 1.8vw, 0.6rem);
    font-weight: 700;
    letter-spacing: 0.1em;
    opacity: 0.7;
    margin-top: 1px;
}

.cfr-sq-countdown {
    font-size: clamp(0.5rem, 2vw, 0.7rem);
    opacity: 0.8;
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------
   Claimed square — donor photo + name
--------------------------------------------------------------- */
.cfr-sq-donor-img {
    /* Photo fills most of the tile */
    width: 55%;
    aspect-ratio: 1;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.3);
    margin-bottom: 3px;
    flex-shrink: 0;
}

.cfr-sq-donor-name {
    font-size: clamp(0.45rem, 1.8vw, 0.65rem);
    font-weight: 700;
    word-break: break-word;
    line-height: 1.1;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cfr-sq-globe {
    font-size: clamp(0.55rem, 2vw, 0.75rem);
    text-decoration: none;
    display: block;
    margin-top: 1px;
    line-height: 1;
}

/* ---------------------------------------------------------------
   Loading / Error inside grid
--------------------------------------------------------------- */
.cfr-loading-board {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.cfr-loading-board p {
    margin-top: 12px;
    font-size: 1rem;
}

.cfr-error-msg {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: #ff6b6b;
    font-size: 1rem;
}

/* ---------------------------------------------------------------
   Spinner icon (shared)
--------------------------------------------------------------- */
.cfr-spinner-icon {
    width: 52px;
    height: 52px;
    border: 5px solid #333;
    border-top-color: var(--cfr-primary);
    border-radius: 50%;
    animation: cfr-spin 0.85s linear infinite;
    margin: 0 auto;
}

@keyframes cfr-spin {
    to { transform: rotate(360deg); }
}

/* ---------------------------------------------------------------
   Popup Overlay
--------------------------------------------------------------- */
.cfr-popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.cfr-popup {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: var(--cfr-radius);
    box-shadow: 0 8px 40px rgba(0,0,0,0.7);
    width: 100%;
    max-width: 420px;
    padding: 28px 22px;
    position: relative;
    font-family: var(--cfr-font);
    color: #fff;
    animation: cfr-popup-in .2s ease;
}

@keyframes cfr-popup-in {
    from { opacity: 0; transform: scale(.92) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.cfr-popup-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: #888;
    line-height: 1;
}

.cfr-popup-close:hover { color: #fff; }

.cfr-popup h3 {
    margin: 0 0 4px;
    font-size: 1.2rem;
    color: #fff;
}

.cfr-popup-amount {
    font-size: 1.3rem;
    font-weight: 900;
    color: #FFD700;
    margin-bottom: 18px;
    display: block;
}

.cfr-popup-field {
    margin-bottom: 14px;
}

.cfr-popup-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 0.88rem;
    color: #ccc;
}

.cfr-popup-field input[type="text"],
.cfr-popup-field input[type="url"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #444;
    border-radius: 8px;
    font-size: 0.95rem;
    box-sizing: border-box;
    background: #2a2a2a;
    color: #fff;
    transition: border-color .2s;
    font-family: var(--cfr-font);
}

.cfr-popup-field input:focus {
    outline: none;
    border-color: var(--cfr-primary);
}

.cfr-popup-field input::placeholder { color: #666; }

/* Photo upload */
.cfr-upload-btn {
    display: inline-block;
    padding: 9px 16px;
    background: #2a2a2a;
    border: 1px dashed #555;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.88rem;
    color: #ccc;
    transition: background .2s, border-color .2s;
    font-family: var(--cfr-font);
}

.cfr-upload-btn:hover {
    background: #333;
    border-color: var(--cfr-primary);
}

.cfr-donor-photo-preview {
    margin-top: 10px;
    text-align: center;
    display: none;
}

.cfr-donor-photo-preview img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--cfr-primary);
}

.cfr-popup-error {
    background: rgba(255,100,100,0.15);
    border: 1px solid #ff6b6b;
    color: #ff9999;
    padding: 9px 12px;
    border-radius: 7px;
    margin-bottom: 12px;
    font-size: 0.88rem;
    display: none;
}

.cfr-checkout-btn {
    display: block;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--cfr-primary), #FF8E53);
    color: #fff;
    border: none;
    border-radius: 9px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: opacity .2s, transform .1s;
    font-family: var(--cfr-font);
    letter-spacing: 0.02em;
}

.cfr-checkout-btn:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

.cfr-checkout-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.cfr-popup-note {
    font-size: 0.78rem;
    color: #666;
    text-align: center;
    margin-top: 10px;
}

/* ---------------------------------------------------------------
   Registration Form
--------------------------------------------------------------- */
#cfr-form-wrap {
    max-width: 660px;
    margin: 24px auto;
    font-family: var(--cfr-font);
    padding: 0 12px;
}

.cfr-ai-badge {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cfr-ai-icon { font-size: 1.4rem; flex-shrink: 0; }

#cfr-registration-form {
    background: #fff;
    border-radius: var(--cfr-radius);
    box-shadow: var(--cfr-shadow);
    padding: 28px 24px;
}

.cfr-field {
    margin-bottom: 18px;
}

.cfr-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
    font-size: 0.92rem;
}

.cfr-required { color: var(--cfr-primary); }

.cfr-field input[type="text"],
.cfr-field input[type="number"],
.cfr-field input[type="url"],
.cfr-field input[type="email"],
.cfr-field textarea {
    width: 100%;
    padding: 10px 13px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: var(--cfr-font);
    transition: border-color .2s;
    box-sizing: border-box;
}

.cfr-field input:focus,
.cfr-field textarea:focus {
    outline: none;
    border-color: var(--cfr-primary);
}

.cfr-field textarea { resize: vertical; min-height: 100px; }

.cfr-field small,
.cfr-hint {
    display: block;
    color: #999;
    font-size: 0.8rem;
    margin-top: 3px;
}

/* Upload group */
.cfr-upload-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cfr-upload-divider {
    text-align: center;
    color: #bbb;
    font-size: 0.82rem;
}

.cfr-image-preview {
    position: relative;
    margin-top: 8px;
    display: none;
}

.cfr-image-preview img {
    max-width: 100%;
    max-height: 180px;
    border-radius: 8px;
    display: block;
}

.cfr-remove-image {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0,0,0,.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 26px;
    text-align: center;
}

.cfr-ai-note {
    background: #f3f0ff;
    border: 1px solid #d0c4f7;
    color: #5a3e9b;
    border-radius: 8px;
    padding: 9px 13px;
    font-size: 0.85rem;
    margin-bottom: 14px;
}

.cfr-submit-btn {
    display: block;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--cfr-primary), #FF8E53);
    color: #fff;
    border: none;
    border-radius: 9px;
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    transition: opacity .2s, transform .1s;
    font-family: var(--cfr-font);
}

.cfr-submit-btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* Form error */
.cfr-error {
    background: #fff0f0;
    border: 1px solid #ffcdd2;
    color: #c62828;
    padding: 11px 14px;
    border-radius: 8px;
    margin-top: 14px;
    font-size: 0.92rem;
    display: none;
}

/* ---------------------------------------------------------------
   Spinner (form)
--------------------------------------------------------------- */
.cfr-spinner {
    display: none;
    text-align: center;
    padding: 44px 20px;
    font-family: var(--cfr-font);
}

.cfr-spinner-title {
    font-size: 1.3rem;
    color: #222;
    margin: 14px 0 5px;
}

.cfr-spinner-sub {
    color: #777;
    margin: 0 0 24px;
    font-size: 0.9rem;
}

.cfr-spinner-steps {
    max-width: 320px;
    margin: 0 auto;
    text-align: left;
}

.cfr-step {
    padding: 7px 0;
    color: #bbb;
    font-size: 0.9rem;
    transition: color .4s;
}

.cfr-step-active { color: #333; }

/* ---------------------------------------------------------------
   Success (form)
--------------------------------------------------------------- */
.cfr-success {
    display: none;
    text-align: center;
    padding: 36px 20px;
    font-family: var(--cfr-font);
    background: #fff;
    border-radius: var(--cfr-radius);
    box-shadow: var(--cfr-shadow);
    max-width: 580px;
    margin: 24px auto;
}

.cfr-success-icon { font-size: 3rem; margin-bottom: 10px; }

.cfr-success h2 {
    font-size: 1.7rem;
    color: #2ECC71;
    margin: 0 0 10px;
}

.cfr-board-link-btn {
    display: inline-block;
    padding: 13px 30px;
    background: var(--cfr-primary);
    color: #fff;
    border-radius: 9px;
    text-decoration: none;
    font-weight: 800;
    font-size: 1rem;
    transition: opacity .2s;
}

.cfr-board-link-btn:hover { opacity: 0.88; }

.cfr-start-another a {
    color: var(--cfr-primary);
    font-size: 0.88rem;
}

/* ---------------------------------------------------------------
   Fundraiser List
--------------------------------------------------------------- */
.cfr-list-wrap {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
    font-family: var(--cfr-font);
    margin: 20px 0;
}

.cfr-list-card {
    background: #fff;
    border-radius: var(--cfr-radius);
    box-shadow: var(--cfr-shadow);
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}

.cfr-list-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 28px rgba(0,0,0,0.18);
}

.cfr-list-thumb img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.cfr-list-body { padding: 14px; }

.cfr-list-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 8px;
}

.cfr-list-title a { color: #111; text-decoration: none; }
.cfr-list-title a:hover { color: var(--cfr-primary); }

.cfr-list-progress { margin-bottom: 10px; }

.cfr-list-raised {
    font-size: 0.8rem;
    color: #777;
    display: block;
    margin-top: 3px;
}

.cfr-list-btn {
    display: inline-block;
    padding: 8px 16px;
    background: var(--cfr-primary);
    color: #fff;
    border-radius: 7px;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 700;
    transition: opacity .2s;
}

.cfr-list-btn:hover { opacity: 0.88; }

.cfr-no-fundraisers {
    text-align: center;
    color: #888;
    padding: 40px;
    font-size: 1rem;
}

/* ---------------------------------------------------------------
   Responsive tweaks
--------------------------------------------------------------- */
@media (max-width: 400px) {
    .cfr-square { min-height: 60px; border-radius: 8px; }
    .cfr-board-grid { gap: 5px; }
    #cfr-registration-form { padding: 20px 14px; }
    .cfr-popup { padding: 22px 16px; }
}
