/**
 * FundIQ - Mobile-First Stylesheet
 * Simon Kenton High School
 * Colors: Royal Blue (#2563eb), Black (#111827), White (#ffffff)
 */

/* =====================================================
   CSS VARIABLES
   ===================================================== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #60a5fa;
    --secondary: #111827;
    --accent: #ffffff;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

/* =====================================================
   RESET & BASE STYLES
   ===================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--gray-900);
    background-color: var(--gray-50);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* =====================================================
   LAYOUT CONTAINERS
   ===================================================== */
.container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .container { max-width: 640px; }
}

@media (min-width: 768px) {
    .container { max-width: 768px; padding: 0 1.5rem; }
}

@media (min-width: 1024px) {
    .container { max-width: 1024px; }
}

@media (min-width: 1280px) {
    .container { max-width: 1200px; }
}

@media (min-width: 1536px) {
    .container { max-width: 1400px; }
}

/* Admin pages get wider containers */
.admin-main .container {
    max-width: 100%;
    padding: 0 1.5rem;
}

@media (min-width: 1024px) {
    .admin-main .container { max-width: 1200px; }
}

@media (min-width: 1280px) {
    .admin-main .container { max-width: 1400px; }
}

@media (min-width: 1536px) {
    .admin-main .container { max-width: 1600px; }
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: 1.5rem 0;
}

/* =====================================================
   HEADER
   ===================================================== */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--accent);
    padding: 1.25rem 0;
    box-shadow: var(--shadow-md);
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
}

.header-logo {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.header-school {
    font-size: 0.875rem;
    opacity: 0.9;
    font-weight: 500;
}

.header-sport {
    font-size: 1.125rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.header-logo-img {
    width: 54px;
    height: 54px;
    object-fit: contain;
}

@media (min-width: 640px) {
    .header-logo-img {
        width: 62px;
        height: 62px;
    }
}

/* =====================================================
   CARDS
   ===================================================== */
.card {
    background: var(--accent);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    background: var(--gray-50);
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    background: var(--gray-50);
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--gray-200);
}

/* =====================================================
   FORMS
   ===================================================== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--gray-900);
    background-color: var(--accent);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    -webkit-appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.form-input::placeholder {
    color: var(--gray-400);
}

.form-input.is-invalid {
    border-color: var(--danger);
}

.form-error {
    font-size: 0.8125rem;
    color: var(--danger);
    margin-top: 0.375rem;
}

.form-hint {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: 0.375rem;
}

.form-row {
    display: grid;
    gap: 1rem;
}

@media (min-width: 640px) {
    .form-row-2 { grid-template-columns: repeat(2, 1fr); }
    .form-row-3 { grid-template-columns: repeat(3, 1fr); }
}

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    -webkit-appearance: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-dark);
    text-decoration: none;
}

.btn-secondary {
    background-color: var(--gray-600);
    color: var(--accent);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--gray-700);
}

.btn-outline {
    background-color: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover:not(:disabled) {
    background-color: var(--primary);
    color: var(--accent);
}

.btn-success {
    background-color: var(--success);
    color: var(--accent);
}

.btn-danger {
    background-color: var(--danger);
    color: var(--accent);
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* =====================================================
   SPONSORSHIP TIER CARDS
   ===================================================== */
.tier-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 640px) {
    .tier-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) {
    .tier-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.tier-card {
    background: var(--accent);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.tier-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.tier-card.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.05) 0%, rgba(59, 130, 246, 0.05) 100%);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.2);
}

.tier-card.selected::after {
    content: '✓';
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    width: 1.5rem;
    height: 1.5rem;
    background: var(--primary);
    color: var(--accent);
    border-radius: 50%;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tier-emoji {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.tier-amount {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}

.tier-name {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
    line-height: 1.2;
}

/* =====================================================
   TOTAL DISPLAY
   ===================================================== */
.total-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--secondary);
    color: var(--accent);
    padding: 1rem;
    box-shadow: 0 -4px 6px -1px rgba(0,0,0,0.1);
    z-index: 100;
}

.total-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 768px;
    margin: 0 auto;
}

.total-amount {
    font-size: 1.5rem;
    font-weight: 700;
}

.total-label {
    font-size: 0.875rem;
    opacity: 0.8;
}

/* Add padding to body when total bar is present */
body.has-total-bar {
    padding-bottom: 5rem;
}

/* =====================================================
   STUDENT SEARCH/SELECT
   ===================================================== */
.student-search {
    position: relative;
}

.student-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--accent);
    border: 1px solid var(--gray-300);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 200px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: var(--shadow-lg);
}

.student-result-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
}

.student-result-item:hover {
    background: var(--gray-50);
}

.student-result-item:last-child {
    border-bottom: none;
}

.student-selected {
    background: var(--gray-50);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.student-selected-name {
    font-weight: 600;
}

.student-selected-remove {
    color: var(--danger);
    cursor: pointer;
    font-size: 0.875rem;
}

/* =====================================================
   ORDER SUMMARY
   ===================================================== */
.order-summary {
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.order-summary-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-200);
}

.order-line {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.9375rem;
}

.order-line.total {
    border-top: 2px solid var(--gray-300);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    font-weight: 700;
    font-size: 1.125rem;
}

/* =====================================================
   ALERTS & NOTIFICATIONS
   ===================================================== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9375rem;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background-color: #dbeafe;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

/* =====================================================
   FOOTER
   ===================================================== */
.footer {
    background: var(--secondary);
    color: var(--gray-400);
    padding: 1.5rem 0;
    text-align: center;
    font-size: 0.875rem;
}

.footer-brand {
    color: var(--accent);
    font-weight: 600;
}

.footer-links {
    margin-top: 0.75rem;
}

.footer-links a {
    color: var(--gray-400);
    margin: 0 0.5rem;
}

.footer-links a:hover {
    color: var(--accent);
}

/* =====================================================
   SECTION HEADINGS
   ===================================================== */
.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 1rem;
}

.section-subtitle {
    font-size: 0.9375rem;
    color: var(--gray-600);
    margin-bottom: 1.5rem;
}

/* =====================================================
   LOADING STATES
   ===================================================== */
.loading {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--gray-300);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* =====================================================
   CHECKBOX & RADIO
   ===================================================== */
.form-check {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
}

.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.125rem;
    accent-color: var(--primary);
}

.form-check-label {
    font-size: 0.9375rem;
    color: var(--gray-700);
}

/* =====================================================
   UTILITIES
   ===================================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.hidden { display: none !important; }

/* =====================================================
   CONFIRMATION PAGE
   ===================================================== */
.confirmation-icon {
    width: 5rem;
    height: 5rem;
    background: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2.5rem;
    color: var(--accent);
}

.confirmation-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
}

.confirmation-message {
    text-align: center;
    color: var(--gray-600);
    margin-bottom: 2rem;
}

/* =====================================================
   ADMIN SPECIFIC STYLES
   ===================================================== */
.admin-header {
    background: var(--secondary);
}

.admin-nav {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.75rem 0;
    -webkit-overflow-scrolling: touch;
}

.admin-nav a {
    color: var(--gray-400);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    white-space: nowrap;
    font-size: 0.875rem;
    font-weight: 500;
}

.admin-nav a:hover,
.admin-nav a.active {
    color: var(--accent);
    background: rgba(255,255,255,0.1);
    text-decoration: none;
}

.stat-card {
    background: var(--accent);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.data-table th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    color: var(--gray-600);
}

.data-table tr:hover td {
    background: var(--gray-50);
}

.data-table td:last-child {
    white-space: nowrap;
}

.data-table td:last-child .btn {
    margin-right: 0.25rem;
}

/* Mobile table scroll */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* =====================================================
   STRIPE ELEMENTS
   ===================================================== */
.stripe-element {
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--accent);
}

.stripe-element--focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.stripe-element--invalid {
    border-color: var(--danger);
}

/* =====================================================
   PAYMENT DIVIDER (Apple Pay / Google Pay)
   ===================================================== */
.payment-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.25rem 0;
}

.payment-divider::before,
.payment-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--gray-300);
}

.payment-divider span {
    padding: 0 1rem;
    font-size: 0.875rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* =====================================================
   PROGRESS INDICATOR
   ===================================================== */
.progress-steps {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.progress-step {
    display: flex;
    align-items: center;
}

.progress-step-circle {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
}

.progress-step.active .progress-step-circle {
    background: var(--primary);
    color: var(--accent);
}

.progress-step.completed .progress-step-circle {
    background: var(--success);
    color: var(--accent);
}

.progress-step-line {
    width: 3rem;
    height: 2px;
    background: var(--gray-200);
    margin: 0 0.5rem;
}

.progress-step.completed + .progress-step .progress-step-line {
    background: var(--success);
}

@media (max-width: 400px) {
    .progress-step-line { width: 1.5rem; }
}
