/* =========================================================
   TrapTitan — design system
   ========================================================= */
:root {
    /* Brand palette */
    --tt-primary: #1e3a5f;
    --tt-primary-dark: #0f2a47;
    --tt-primary-light: #2d5a8e;
    --tt-accent: #2563eb;
    --tt-accent-light: #3b82f6;
    --tt-gold: #f59e0b;
    --tt-gold-soft: #fef3c7;

    /* Surface / neutrals */
    --tt-surface: #f5f7fb;
    --tt-surface-alt: #eef2f7;
    --tt-elevated: #ffffff;
    --tt-border: #e2e8f0;
    --tt-border-strong: #cbd5e1;

    /* Text */
    --tt-text: #0f172a;
    --tt-text-muted: #475569;
    --tt-text-subtle: #94a3b8;

    /* Status */
    --tt-success: #16a34a;
    --tt-warning: #d97706;
    --tt-danger: #dc2626;
    --tt-info: #0ea5e9;

    /* Geometry */
    --tt-radius-sm: 0.5rem;
    --tt-radius: 0.75rem;
    --tt-radius-lg: 1rem;
    --tt-radius-xl: 1.5rem;

    /* Shadows */
    --tt-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
    --tt-shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.06);
    --tt-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
    --tt-shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);

    /* Gradients */
    --tt-gradient-brand: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    --tt-gradient-brand-dark: linear-gradient(180deg, #0f2a47 0%, #1e3a5f 100%);
    --tt-gradient-surface: linear-gradient(180deg, #f8fafc 0%, #e8eef7 100%);

    /* Typography */
    --tt-font-sans: 'Figtree', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

    /* Bootstrap overrides */
    --bs-font-sans-serif: var(--tt-font-sans);
    --bs-body-font-family: var(--tt-font-sans);
    --bs-body-bg: var(--tt-surface);
    --bs-body-color: var(--tt-text);
    --bs-secondary-color: var(--tt-text-muted);
    --bs-border-color: var(--tt-border);
    --bs-primary: var(--tt-accent);
    --bs-primary-rgb: 37, 99, 235;
}

html,
body {
    font-family: var(--tt-font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: var(--tt-surface);
    color: var(--tt-text);
    line-height: 1.55;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--tt-text);
    letter-spacing: -0.01em;
}

h1, .h1 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

a {
    color: var(--tt-accent);
}

a:hover {
    color: var(--tt-primary);
}

code {
    background: var(--tt-surface-alt);
    padding: 0.15rem 0.4rem;
    border-radius: 0.3rem;
    color: var(--tt-primary);
    font-size: 0.875em;
}

.text-secondary {
    color: var(--tt-text-muted) !important;
}

/* Buttons — slightly tighter and modern */
.btn {
    font-weight: 500;
    border-radius: var(--tt-radius-sm);
}

.btn-primary {
    --bs-btn-bg: var(--tt-accent);
    --bs-btn-border-color: var(--tt-accent);
    --bs-btn-hover-bg: #1d4fd4;
    --bs-btn-hover-border-color: #1d4fd4;
    --bs-btn-active-bg: #1842b8;
    --bs-btn-active-border-color: #1842b8;
}

.btn-outline-primary {
    --bs-btn-color: var(--tt-accent);
    --bs-btn-border-color: var(--tt-accent);
    --bs-btn-hover-bg: var(--tt-accent);
    --bs-btn-hover-border-color: var(--tt-accent);
}

.btn-lg {
    border-radius: var(--tt-radius);
}

/* Cards */
.card {
    border: 1px solid var(--tt-border);
    border-radius: var(--tt-radius);
    box-shadow: var(--tt-shadow-xs);
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--tt-border);
    font-weight: 600;
}

/* Form controls */
.form-control,
.form-select {
    border-radius: var(--tt-radius-sm);
    border-color: var(--tt-border);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--tt-accent);
    box-shadow: 0 0 0 0.18rem rgba(37, 99, 235, 0.18);
}

.form-label {
    font-weight: 500;
    color: var(--tt-text);
    margin-bottom: 0.35rem;
}

/* Tables / HxGrid */
.table {
    --bs-table-bg: var(--tt-elevated);
    border-collapse: separate;
    border-spacing: 0;
}

.table > thead th {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--tt-text-muted);
    background: var(--tt-surface);
    border-bottom: 1px solid var(--tt-border);
    padding: 0.85rem 0.75rem;
}

.table > tbody > tr > td {
    padding: 0.85rem 0.75rem;
    border-bottom: 1px solid var(--tt-border);
    vertical-align: middle;
}

.table > tbody > tr:last-child > td {
    border-bottom: none;
}

.table-responsive {
    background: var(--tt-elevated);
    border: 1px solid var(--tt-border);
    border-radius: var(--tt-radius);
    overflow: hidden;
}

/* Badges */
.badge {
    font-weight: 500;
    border-radius: 999px;
    padding: 0.35em 0.7em;
    font-size: 0.72rem;
    letter-spacing: 0.02em;
}

/* Alerts */
.alert {
    border: 1px solid transparent;
    border-radius: var(--tt-radius);
    padding: 1rem 1.125rem;
}

/* Offcanvas */
.offcanvas {
    border-left: 1px solid var(--tt-border);
}

.offcanvas-header {
    border-bottom: 1px solid var(--tt-border);
}

.offcanvas-footer {
    border-top: 1px solid var(--tt-border);
}

/* Modal */
.modal-content {
    border: none;
    border-radius: var(--tt-radius-lg);
    box-shadow: var(--tt-shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--tt-border);
}

.modal-footer {
    border-top: 1px solid var(--tt-border);
}

/* =========================================================
   Public layouts (PublicLayout)
   ========================================================= */
.public-layout {
    min-height: 100vh;
    background: var(--tt-gradient-surface);
}

.public-hero {
    background: var(--tt-gradient-brand);
    color: white;
    border-radius: 0 0 var(--tt-radius-xl) var(--tt-radius-xl);
    padding: 2.25rem 1.25rem 2.75rem;
    text-align: center;
    box-shadow: var(--tt-shadow);
    position: relative;
    overflow: hidden;
}

.public-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.18), transparent 50%),
                      radial-gradient(circle at 90% 100%, rgba(245, 158, 11, 0.18), transparent 45%);
    pointer-events: none;
}

.public-hero > * {
    position: relative;
    z-index: 1;
}

.public-hero h1 {
    color: white;
    margin-bottom: 0.35rem;
}

.public-avatar,
.public-avatar-placeholder {
    width: 104px;
    height: 104px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid rgba(255, 255, 255, 0.85);
    margin-bottom: 1rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.public-avatar-placeholder {
    background: rgba(255, 255, 255, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    font-weight: 700;
    color: white;
}

.public-content {
    padding-bottom: 120px;
}

.public-content > .container,
.public-content > .container-fluid {
    max-width: 880px;
}

/* Sticky action bar — fundraiser / auction */
.sticky-checkout-bar,
.sticky-bid-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--tt-border);
    padding: 1rem 1.25rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0));
    box-shadow: 0 -6px 18px rgba(15, 23, 42, 0.08);
    z-index: 1000;
}

/* Landing page */
.landing-hero {
    background: var(--tt-gradient-brand);
    color: white;
    text-align: center;
    padding: 4.5rem 1.25rem 4rem;
    border-radius: 0 0 var(--tt-radius-xl) var(--tt-radius-xl);
    position: relative;
    overflow: hidden;
}

.landing-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 15% 10%, rgba(255, 255, 255, 0.22), transparent 50%),
                      radial-gradient(circle at 85% 90%, rgba(245, 158, 11, 0.18), transparent 50%);
    pointer-events: none;
}

.landing-hero > * {
    position: relative;
    z-index: 1;
}

.landing-hero h1 {
    color: white;
    font-size: clamp(2.25rem, 4vw + 1rem, 3.5rem);
    margin-bottom: 0.75rem;
}

.landing-hero .lead {
    color: rgba(255, 255, 255, 0.85);
    max-width: 580px;
    margin: 0 auto 2rem;
}

.landing-hero .btn {
    min-width: 180px;
}

.landing-feature {
    background: var(--tt-elevated);
    border: 1px solid var(--tt-border);
    border-radius: var(--tt-radius-lg);
    padding: 1.75rem 1.5rem;
    height: 100%;
    box-shadow: var(--tt-shadow-xs);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.landing-feature:hover {
    transform: translateY(-2px);
    box-shadow: var(--tt-shadow);
}

.landing-feature__icon {
    width: 48px;
    height: 48px;
    border-radius: var(--tt-radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(37, 99, 235, 0.1);
    color: var(--tt-accent);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.landing-feature h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.landing-feature p {
    color: var(--tt-text-muted);
    margin-bottom: 0;
}

/* =========================================================
   Admin shell
   ========================================================= */
.admin-tab-nav {
    background: var(--tt-elevated);
    border: 1px solid var(--tt-border);
    border-radius: var(--tt-radius);
    padding: 0.35rem;
    box-shadow: var(--tt-shadow-xs);
}

.admin-tab-nav .nav-link {
    padding: 0.45rem 0.9rem;
    color: var(--tt-text-muted);
    font-weight: 500;
    border-radius: var(--tt-radius-sm);
}

.admin-tab-nav .nav-link:hover {
    color: var(--tt-primary);
    background: var(--tt-surface);
}

.admin-tab-nav .nav-link.active {
    background: var(--tt-accent);
    color: white;
    box-shadow: var(--tt-shadow-xs);
}

.admin-page-header {
    margin-bottom: 1.5rem;
}

.admin-page-header h1 {
    margin: 0;
    font-size: clamp(1.5rem, 1.5vw + 1rem, 2rem);
}

.admin-page-header .lead {
    color: var(--tt-text-muted);
    margin-top: 0.25rem;
    margin-bottom: 0;
}

.admin-card-actions {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.admin-stat-card {
    border: 1px solid var(--tt-border);
    border-radius: var(--tt-radius);
    background: var(--tt-elevated);
    box-shadow: var(--tt-shadow-xs);
    position: relative;
    overflow: hidden;
}

.admin-stat-card::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--tt-accent);
}

.admin-stat-card--success::before { background: var(--tt-success); }
.admin-stat-card--info::before { background: var(--tt-info); }
.admin-stat-card--gold::before { background: var(--tt-gold); }
.admin-stat-card--danger::before { background: var(--tt-danger); }

.admin-stat-card .card-body,
.admin-stat-card > .card > .card-body {
    padding: 1rem 1.25rem;
}

.admin-stat-card h6 {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--tt-text-muted);
    margin-bottom: 0.35rem;
}

.admin-stat-card .fs-3,
.admin-stat-card .fs-4 {
    font-weight: 700;
    color: var(--tt-text);
    margin-bottom: 0;
    line-height: 1.2;
}

.student-photo-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    flex-shrink: 0;
    border-radius: var(--tt-radius);
    border: 1px solid var(--tt-border);
}

.offcanvas-form-body {
    padding: 0.25rem 0;
}

.offcanvas-form-body > * + * {
    margin-top: 1rem;
}

.offcanvas-form-body .row {
    margin-top: 1rem;
}

.offcanvas-form-body .row > * {
    margin-top: 0;
}

/* =========================================================
   Shared components
   ========================================================= */
.raffle-item-card {
    border: 1px solid var(--tt-border);
    border-radius: var(--tt-radius);
    background: var(--tt-elevated);
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.raffle-item-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--tt-shadow);
}

.raffle-item-card .card-body {
    padding: 0;
}

.raffle-item-card__image,
.raffle-item-card__image-placeholder {
    aspect-ratio: 16 / 9;
    width: 100%;
    object-fit: cover;
    display: block;
    border-bottom: 1px solid var(--tt-border);
}

.raffle-item-card__image-placeholder {
    background: var(--tt-surface-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tt-text-subtle);
    font-size: 0.875rem;
}

.raffle-item-card__body {
    padding: 1.1rem 1.25rem 1.25rem;
}

.raffle-item-card__title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 0.4rem;
    color: var(--tt-text);
}

.raffle-item-card__desc {
    font-size: 0.9rem;
    color: var(--tt-text-muted);
    margin-bottom: 0.6rem;
}

.raffle-item-card__value {
    font-weight: 600;
    color: var(--tt-accent);
    margin-bottom: 0;
}

.quantity-picker {
    padding: 0.5rem 0;
}

.quantity-picker .btn {
    min-width: 52px;
    min-height: 52px;
    font-size: 1.4rem;
    font-weight: 600;
    border-radius: var(--tt-radius);
}

.quantity-picker__count {
    min-width: 3.5rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--tt-text);
}

.share-card-preview {
    max-width: 320px;
    margin-top: 1rem;
    border-radius: var(--tt-radius-lg);
    box-shadow: var(--tt-shadow);
    overflow: hidden;
}

.share-card-preview img {
    display: block;
    width: 100%;
}

.raffle-image-cropper {
    display: block;
    max-height: 320px;
    width: 100%;
    border-radius: var(--tt-radius-sm);
    overflow: hidden;
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
        linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
        linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
    background-size: 18px 18px;
    background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}

.raffle-image-cropper .cropper-modal {
    opacity: 0;
}

.raffle-image-preview {
    max-height: 200px;
    object-fit: cover;
    width: 100%;
    border-radius: var(--tt-radius-sm);
    border: 1px solid var(--tt-border);
}

/* =========================================================
   Silent auction — public
   ========================================================= */
.auction-browse .public-content {
    padding-bottom: 2rem;
}

.auction-item-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.auction-item-card {
    display: block;
    background: var(--tt-elevated);
    border: 1px solid var(--tt-border);
    border-radius: var(--tt-radius);
    overflow: hidden;
    box-shadow: var(--tt-shadow-xs);
    color: inherit;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.auction-item-card:hover,
.auction-item-card:focus-visible {
    transform: translateY(-2px);
    box-shadow: var(--tt-shadow);
    color: inherit;
    text-decoration: none;
}

.auction-item-card:active {
    transform: scale(0.99);
}

.auction-item-card-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
}

.auction-item-card-placeholder {
    aspect-ratio: 4 / 3;
    background: var(--tt-surface-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--tt-text-subtle);
}

.auction-item-card-body {
    padding: 1rem 1.125rem 1.25rem;
}

.auction-item-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
    color: var(--tt-text);
}

.auction-item-card-donor {
    font-size: 0.825rem;
    color: var(--tt-text-muted);
    margin: 0 0 0.6rem;
}

.auction-item-card-bid {
    font-size: 0.95rem;
    color: var(--tt-text);
}

.auction-item-card-bid strong {
    color: var(--tt-accent);
}

.auction-detail .public-content {
    padding-bottom: 110px;
}

.auction-gallery {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    background: #0f172a;
}

.auction-gallery::-webkit-scrollbar {
    height: 6px;
}

.auction-gallery::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 3px;
}

.auction-gallery-image {
    flex: 0 0 100%;
    width: 100%;
    max-height: 360px;
    object-fit: cover;
    scroll-snap-align: start;
}

.auction-bid-card {
    background: var(--tt-elevated);
    border: 1px solid var(--tt-border);
    border-radius: var(--tt-radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--tt-shadow-xs);
}

.auction-bid-card__label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--tt-text-muted);
    margin-bottom: 0.25rem;
}

.auction-bid-card__amount {
    font-size: 2rem;
    font-weight: 700;
    color: var(--tt-accent);
    line-height: 1.1;
}

.auction-bid-card__min {
    font-size: 0.85rem;
    color: var(--tt-text-muted);
    margin-top: 0.5rem;
}

/* =========================================================
   Silent auction — admin
   ========================================================= */
.auction-admin-thumb {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: var(--tt-radius-sm);
    border: 1px solid var(--tt-border);
}

.auction-admin-thumb-wrapper {
    position: relative;
}

.auction-admin-thumb-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 50%;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.auction-admin-card {
    border: 1px solid var(--tt-border);
    border-radius: var(--tt-radius);
    background: var(--tt-elevated);
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.auction-admin-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--tt-shadow);
}

.auction-admin-card__image,
.auction-admin-card__placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    border-bottom: 1px solid var(--tt-border);
}

.auction-admin-card__placeholder {
    background: var(--tt-surface-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tt-text-subtle);
    font-size: 0.875rem;
}

.auction-admin-card__body {
    padding: 1rem 1.125rem 1.125rem;
}

.auction-qr-display {
    max-width: 720px;
    margin: 0 auto;
}

.auction-qr-frame {
    background: white;
    padding: 1.75rem;
    border-radius: var(--tt-radius-lg);
    box-shadow: var(--tt-shadow);
    max-width: 440px;
}

.auction-qr-image {
    width: 100%;
    height: auto;
    display: block;
}

/* =========================================================
   Misc utilities
   ========================================================= */
.tt-empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    border: 1px dashed var(--tt-border-strong);
    border-radius: var(--tt-radius-lg);
    background: var(--tt-elevated);
    color: var(--tt-text-muted);
}

.tt-empty-state__icon {
    font-size: 2.5rem;
    color: var(--tt-text-subtle);
    margin-bottom: 0.75rem;
    display: block;
}

.tt-empty-state h3 {
    color: var(--tt-text);
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
}

.tt-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
}

/* =========================================================
   Responsive tweaks
   ========================================================= */
@media (min-width: 576px) {
    .public-hero {
        padding: 3rem 2rem 3.25rem;
    }

    .sticky-checkout-bar,
    .sticky-bid-bar {
        padding: 1rem 1.5rem;
    }

    .auction-item-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .auction-gallery-image {
        max-height: 420px;
    }
}

@media (min-width: 992px) {
    .auction-item-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .auction-qr-frame {
        max-width: 500px;
    }

    .auction-qr-image {
        min-width: 380px;
    }
}
