/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --green: #006b3f;
    --green-dark: #004d2e;
    --green-light: #00894f;
    --gold: #FFB81C;
    --gold-dark: #d49a00;
    --gold-light: #ffcc4d;
    --red: #c8102e;
    --red-dark: #9b0c23;
    --white: #ffffff;
    --bg-dark: #003322;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #fff;
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;

    /* ── Rugby field green gradient ── */
    background:
        /* Field line stripes (horizontal) */
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 120px,
            rgba(255,255,255,0.03) 120px,
            rgba(255,255,255,0.03) 122px
        ),
        /* Diagonal red accent lines */
        repeating-linear-gradient(
            135deg,
            transparent,
            transparent 80px,
            rgba(200, 16, 46, 0.07) 80px,
            rgba(200, 16, 46, 0.07) 82px
        ),
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 80px,
            rgba(200, 16, 46, 0.05) 80px,
            rgba(200, 16, 46, 0.05) 82px
        ),
        /* Main green gradient */
        linear-gradient(170deg, #004d2e 0%, #006b3f 30%, #003d20 60%, #002a15 100%);
    background-attachment: fixed;
}

/* ── Animated rugby background elements ── */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 0;
    /* Rugby ball pattern using radial gradients */
    background:
        /* Large rugby ball top-right */
        radial-gradient(ellipse 120px 70px at 85% 15%, rgba(255,184,28,0.08) 0%, rgba(255,184,28,0.04) 40%, transparent 70%),
        /* Rugby ball bottom-left */
        radial-gradient(ellipse 100px 60px at 10% 80%, rgba(255,184,28,0.06) 0%, rgba(255,184,28,0.03) 40%, transparent 70%),
        /* Rugby ball mid-left */
        radial-gradient(ellipse 80px 50px at 5% 40%, rgba(255,184,28,0.05) 0%, transparent 60%),
        /* Rugby ball mid-right */
        radial-gradient(ellipse 90px 55px at 92% 55%, rgba(255,184,28,0.05) 0%, transparent 60%),
        /* Goal post glow top */
        radial-gradient(ellipse 300px 80px at 50% 0%, rgba(255,184,28,0.1) 0%, transparent 70%),
        /* Field spotlight effects */
        radial-gradient(ellipse 600px 600px at 20% 20%, rgba(0,107,63,0.3) 0%, transparent 60%),
        radial-gradient(ellipse 600px 600px at 80% 80%, rgba(0,77,46,0.3) 0%, transparent 60%),
        /* Red corner accents */
        radial-gradient(ellipse 200px 200px at 0% 0%, rgba(200,16,46,0.1) 0%, transparent 70%),
        radial-gradient(ellipse 200px 200px at 100% 100%, rgba(200,16,46,0.08) 0%, transparent 70%);
}

body::after {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 0;
    /* SVG rugby ball watermarks */
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='100' viewBox='0 0 160 100'%3E%3Cellipse cx='80' cy='50' rx='55' ry='32' fill='none' stroke='rgba(255,184,28,0.06)' stroke-width='2'/%3E%3Cline x1='80' y1='18' x2='80' y2='82' stroke='rgba(255,184,28,0.04)' stroke-width='1.5'/%3E%3Cpath d='M65 22 Q80 50 65 78' fill='none' stroke='rgba(255,184,28,0.03)' stroke-width='1'/%3E%3Cpath d='M95 22 Q80 50 95 78' fill='none' stroke='rgba(255,184,28,0.03)' stroke-width='1'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='120' viewBox='0 0 80 120'%3E%3Crect x='35' y='60' width='10' height='60' fill='rgba(255,255,255,0.02)'/%3E%3Crect x='10' y='55' width='60' height='8' rx='4' fill='rgba(255,255,255,0.02)'/%3E%3C/svg%3E");
    background-position: 10% 25%, 88% 70%;
    background-size: 320px 200px, 160px 240px;
    background-repeat: no-repeat;
}

/* ── Container ── */
.container {
    max-width: 600px;
    margin: 2rem auto;
    padding: 0 1rem;
    position: relative;
    z-index: 1;
}
.container-sm { max-width: 400px; }
.container-wide { max-width: 1100px; }

/* ── Header ── */
.header {
    text-align: center;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 1rem 1.5rem;
    background: linear-gradient(135deg, rgba(0,107,63,0.5) 0%, rgba(0,77,46,0.4) 100%);
    border-radius: 16px;
    border: 2px solid rgba(255,184,28,0.3);
    position: relative;
    overflow: hidden;
}
.header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--red), var(--gold), var(--green-light), var(--gold), var(--red));
}
.header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), var(--red), var(--gold));
}
.header h1 {
    font-size: 2.2rem;
    color: var(--gold);
    text-shadow: 0 2px 8px rgba(0,0,0,0.4), 0 0 30px rgba(255,184,28,0.15);
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.header p {
    color: rgba(255,255,255,0.85);
    font-size: 1.05rem;
}

/* ── School badge accent ── */
.school-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
}
.school-badge .dot {
    width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.school-badge .dot-green { background: var(--green-light); }
.school-badge .dot-gold { background: var(--gold); }
.school-badge .dot-red { background: var(--red); }

/* ── Main Prize Section ── */
.main-prize {
    background: linear-gradient(135deg, rgba(0,0,0,0.4) 0%, rgba(0,50,30,0.5) 100%);
    border: 2px solid var(--gold);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,0.3), 0 0 40px rgba(255,184,28,0.08);
}
.main-prize::before {
    content: '';
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--gold), var(--red), var(--gold), var(--green-light), var(--gold));
    z-index: -1;
    animation: borderGlow 4s linear infinite;
    background-size: 300% 300%;
}
@keyframes borderGlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.main-prize-label {
    display: inline-block;
    background: var(--red);
    color: var(--white);
    padding: 0.3rem 1.2rem;
    border-radius: 20px;
    font-weight: 800;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 10px rgba(200,16,46,0.4);
}
.main-prize h2 {
    color: var(--gold);
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    text-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.main-prize-image {
    width: 100%;
    max-width: 400px;
    border-radius: 12px;
    border: 3px solid rgba(255,184,28,0.4);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.main-prize-image:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 30px rgba(255,184,28,0.2);
}
.main-prize-placeholder {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 16/10;
    margin: 0 auto;
    border-radius: 12px;
    border: 3px dashed rgba(255,184,28,0.3);
    background: rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.4);
    font-size: 0.9rem;
}

/* ── Alerts ── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}
.alert-error   { background: rgba(200,16,46,0.15); color: #ff8a9a; border: 1px solid rgba(200,16,46,0.3); }
.alert-warning { background: rgba(255,184,28,0.15); color: var(--gold-light); border: 1px solid rgba(255,184,28,0.3); }
.alert-success { background: rgba(0,107,63,0.2); color: #5dff9e; border: 1px solid rgba(0,107,63,0.4); }

/* ── Forms ── */
.ticket-form {
    background: linear-gradient(165deg, rgba(0,60,35,0.85) 0%, rgba(0,40,25,0.9) 100%);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,184,28,0.15);
}
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--gold);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-group input,
.form-group select {
    width: 100%;
    padding: 0.7rem 0.85rem;
    border: 1px solid rgba(255,184,28,0.25);
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: rgba(0,0,0,0.3);
    color: #fff;
}
.form-group input::placeholder {
    color: rgba(255,255,255,0.35);
}
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(255,184,28,0.15);
}
.form-group select option {
    background: #003322;
    color: #fff;
}

/* ── Quantity Controls ── */
.qty-control {
    display: flex;
    align-items: center;
    gap: 0;
}
.qty-control input {
    width: 70px;
    text-align: center;
    border-radius: 0;
    border-left: none;
    border-right: none;
    -moz-appearance: textfield;
}
.qty-control input::-webkit-outer-spin-button,
.qty-control input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.qty-btn {
    width: 48px;
    height: 48px;
    border: 1px solid rgba(255,184,28,0.25);
    background: rgba(255,184,28,0.1);
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--gold);
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.qty-btn:first-child { border-radius: 10px 0 0 10px; }
.qty-btn:last-child { border-radius: 0 10px 10px 0; }
.qty-btn:hover { background: rgba(255,184,28,0.2); }
.qty-btn:active { background: rgba(255,184,28,0.3); }

/* ── Price Display ── */
.price-display {
    background: linear-gradient(135deg, rgba(255,184,28,0.12) 0%, rgba(200,16,46,0.08) 100%);
    padding: 0.85rem 1rem;
    border-radius: 10px;
    margin-bottom: 1.25rem;
    color: var(--gold-light);
    border: 1px solid rgba(255,184,28,0.15);
}
.price-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    padding: 0.15rem 0;
}
.price-total {
    font-size: 1.3rem;
    font-weight: 800;
    border-top: 1px solid rgba(255,184,28,0.2);
    margin-top: 0.3rem;
    padding-top: 0.4rem;
    color: var(--gold);
}

/* ── Buttons ── */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s ease;
    color: #fff;
    background: var(--green-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.btn:hover { background: var(--green); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.btn:active { transform: scale(0.98) translateY(0); }
.btn-primary {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: var(--green-dark);
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    letter-spacing: 1px;
    box-shadow: 0 4px 16px rgba(255,184,28,0.3);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%); box-shadow: 0 6px 20px rgba(255,184,28,0.4); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: var(--red-dark); }
.btn-sm {
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
}

/* ── Ticket Card (Thank You) ── */
.ticket-card {
    background: linear-gradient(165deg, rgba(0,60,35,0.9) 0%, rgba(0,40,25,0.95) 100%);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.3);
    text-align: center;
    margin-bottom: 1.5rem;
    border-top: 4px solid var(--gold);
    border: 1px solid rgba(255,184,28,0.2);
}
.ticket-card h2 {
    color: var(--gold);
    margin-bottom: 1rem;
}
.ticket-number {
    margin: 1.5rem 0;
}
.ticket-number .label {
    display: block;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.6);
    margin-bottom: 0.25rem;
}
.ticket-number .number {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 3px;
    color: var(--gold);
    font-family: 'Courier New', monospace;
}
.ticket-card p { margin: 0.5rem 0; color: rgba(255,255,255,0.85); }
.ticket-card .note {
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.5);
}

/* ── Multiple Ticket Numbers ── */
.ticket-numbers-list {
    margin: 1.5rem 0;
}
.ticket-numbers-list .label {
    display: block;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.6);
    margin-bottom: 0.5rem;
}
.ticket-number-item {
    display: inline-block;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--gold);
    font-family: 'Courier New', monospace;
    background: rgba(255,184,28,0.1);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    margin: 0.25rem;
    border: 1px solid rgba(255,184,28,0.2);
}

/* ── Setup Page ── */
.setup-instructions h3 {
    margin-top: 1.25rem;
    margin-bottom: 0.3rem;
    color: var(--gold);
}
.setup-instructions p { margin-bottom: 0.5rem; }
.hash-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0,0,0,0.3);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    margin: 0.5rem 0;
    overflow-x: auto;
}
.hash-display code {
    font-size: 0.8rem;
    word-break: break-all;
    flex: 1;
    color: var(--gold-light);
}
.setup-instructions pre {
    background: rgba(0,0,0,0.5);
    color: #ecf0f1;
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    overflow-x: auto;
    margin: 0.5rem 0;
}

/* ── Status badges ── */
.status-paid    { color: #5dff9e; font-weight: 700; }
.status-pending { color: var(--gold); font-weight: 700; }
.status-failed  { color: #ff6b7a; font-weight: 700; }

/* ── Dashboard Stats ── */
.stats-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    flex: 1;
    background: linear-gradient(165deg, rgba(0,60,35,0.8) 0%, rgba(0,40,25,0.85) 100%);
    padding: 1.25rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,184,28,0.12);
}
.stat-number {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--gold);
}
.stat-label {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
    margin-top: 0.25rem;
}

/* ── Filters ── */
.filters {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.filter-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.filter-form label {
    font-weight: 600;
    white-space: nowrap;
    color: var(--gold);
}
.filter-form select {
    padding: 0.4rem 0.6rem;
    border: 1px solid rgba(255,184,28,0.25);
    border-radius: 6px;
    font-size: 0.9rem;
    background: rgba(0,0,0,0.3);
    color: #fff;
}

/* ── Table ── */
.table-wrap {
    overflow-x: auto;
    background: rgba(0,40,25,0.85);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
    margin-bottom: 2rem;
    border: 1px solid rgba(255,184,28,0.1);
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
thead th {
    background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 100%);
    color: var(--gold);
    padding: 0.75rem 0.5rem;
    text-align: left;
    white-space: nowrap;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}
tbody td {
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.85);
}
tbody tr:hover { background: rgba(255,184,28,0.05); }
.row-winner { background: rgba(255,184,28,0.1) !important; }
.text-center { text-align: center; }

/* ── Draw Section ── */
.draw-section {
    background: linear-gradient(165deg, rgba(0,60,35,0.8) 0%, rgba(0,40,25,0.85) 100%);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
    margin-bottom: 2rem;
    border: 1px solid rgba(255,184,28,0.12);
}
.draw-section h2 {
    margin-bottom: 1rem;
    color: var(--gold);
}
.draw-form {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}
.draw-form select {
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(255,184,28,0.25);
    border-radius: 6px;
    font-size: 0.95rem;
    background: rgba(0,0,0,0.3);
    color: #fff;
}

/* ── Winners ── */
.winners-section h2 {
    color: var(--gold);
    margin-bottom: 1rem;
}
.winners-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}
.winner-card {
    background: linear-gradient(165deg, rgba(0,60,35,0.8) 0%, rgba(0,40,25,0.85) 100%);
    border-left: 4px solid var(--gold);
    padding: 1rem 1.25rem;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
    min-width: 220px;
}
.winner-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--gold);
}
.winner-ticket {
    font-family: 'Courier New', monospace;
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
}
.winner-event {
    color: rgba(255,255,255,0.5);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* ── Rugby decorative elements ── */
.rugby-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: rgba(255,184,28,0.4);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 3px;
}
.rugby-divider::before,
.rugby-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(200,16,46,0.3), rgba(255,184,28,0.3), rgba(200,16,46,0.3), transparent);
}

/* ── Floating rugby ball animation ── */
@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-10px) rotate(5deg); }
    75% { transform: translateY(5px) rotate(-3deg); }
}

/* ── Red accent stripe at top of page ── */
.page-top-stripe {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--green-light), var(--gold), var(--red), var(--gold), var(--green-light));
    z-index: 100;
}

/* ── Footer rugby feel ── */
.footer-bar {
    text-align: center;
    padding: 1.5rem 1rem;
    color: rgba(255,255,255,0.35);
    font-size: 0.8rem;
    margin-top: 2rem;
    border-top: 1px solid rgba(255,184,28,0.1);
}
.footer-bar strong {
    color: var(--gold);
    font-weight: 600;
}

/* ── Mobile responsive ── */
@media (max-width: 600px) {
    .container { margin: 1rem auto; }
    .header h1 { font-size: 1.6rem; }
    .header { padding: 1.5rem 1rem 1rem; }
    .stats-row { flex-direction: column; }
    .filters { flex-direction: column; align-items: flex-start; }
    .draw-form { flex-direction: column; }
    .draw-form select, .draw-form .btn { width: 100%; }
    table { font-size: 0.8rem; }
    thead th, tbody td { padding: 0.5rem 0.35rem; }
    .ticket-number .number { font-size: 1.5rem; }
    .main-prize { padding: 1rem; }
    .main-prize h2 { font-size: 1.2rem; }
}
