/* --- Variables & Theme --- */
:root {
    --primary-color: #E63946;
    --primary-dark: #C42B37;
    --secondary-color: #F4A261;
    --background-color: #F8FAFC;
    --surface-color: #FFFFFF;
    --text-primary: #0F172A;
    --text-secondary: #64748B;
    --success-color: #10B981;
    --border-color: #E2E8F0;
    --border-visible: 1.5px solid #E2E8F0;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --radius-md: 14px;
    --radius-lg: 18px;
    --font-heading: 'Aptos', 'Segoe UI Variable', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
    --font-body: 'Aptos', 'Segoe UI Variable', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
}

/* --- Reset & Global (Speed & Smoothness) --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.55;
    padding-bottom: 80px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    width: 100%;
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.25;
}

a {
    text-decoration: none;
    color: inherit;
    touch-action: manipulation;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    touch-action: manipulation;
}

ul {
    list-style: none;
}

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

/* --- Utilities --- */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 16px;
    width: 100%;
}

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.95rem;
    transition: transform 0.15s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    text-align: center;
    min-height: 44px; /* Accessible touch target */
}

.btn:active {
    transform: scale(0.97);
}

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

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

.btn-secondary {
    background-color: white;
    color: var(--text-primary);
    border: 1.5px solid #E2E8F0;
}

.btn-secondary:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

.btn-floating {
    position: fixed;
    bottom: 20px;
    right: 20px;
    left: 20px;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(230, 57, 70, 0.35);
    border-radius: 50px;
    padding: 14px 24px;
    font-weight: 800;
    backdrop-filter: blur(8px);
}

@media (min-width: 600px) {
    .btn-floating {
        left: auto;
        width: auto;
        padding: 14px 32px;
    }
}

.card {
    background: var(--surface-color);
    border-radius: var(--radius-md);
    border: var(--border-visible);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    margin-bottom: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.input-group {
    margin-bottom: 18px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text-primary);
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #CBD5E1;
    border-radius: 10px;
    font-family: inherit;
    font-size: 16px; /* 16px prevents iOS zoom on focus */
    background: #FFFFFF;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: 46px;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.14);
}

.text-center { text-align: center; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-muted { color: var(--text-secondary); }
.font-bold { font-weight: 700; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }

/* --- Specific Responsive Utilities --- */
.mobile-only { display: none; }
.desktop-only { display: block; }

@media (max-width: 768px) {
    .mobile-only { display: block; }
    .desktop-only { display: none !important; }
    
    body {
        padding-bottom: calc(75px + env(safe-area-inset-bottom, 0px));
    }

    .container {
        padding: 0 12px;
        width: 100%;
    }

    .btn {
        padding: 12px 18px;
        font-size: 0.92rem;
        min-height: 46px;
    }

    /* Input focus readability on mobile */
    .input-group input,
    .input-group select,
    .input-group textarea {
        font-size: 16px !important;
        padding: 12px 14px;
        border-radius: 12px;
    }

    /* Fixed Bottom Actions on mobile */
    .fixed-bottom-actions {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
        background: rgba(255,255,255,0.96);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
        z-index: 100;
        display: flex;
        gap: 10px;
    }

    .bottom-spacer {
        height: calc(75px + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }

    .btn {
        padding: 11px 16px;
        font-size: 0.88rem;
    }

    .card {
        border-radius: 14px;
        padding: 14px;
    }
}

/* Badge/Counter */
.badge {
    background-color: var(--primary-color);
    color: white;
    font-size: 11px;
    font-weight: 800;
    height: 20px;
    min-width: 20px;
    padding: 0 6px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: -6px;
    right: -6px;
}

/* Navigation Back Link */
.nav-back-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: inherit;
    line-height: 1;
    margin-right: 12px;
}

.nav-back-container span:first-child {
    font-size: 24px !important;
}

.nav-back-text {
    font-size: 0.8rem;
    font-weight: 700;
    margin-top: 2px;
}

/* High Speed Shimmer Loading Effect */
.skeleton {
    background: linear-gradient(90deg, #f0f3f7 25%, #e2e8f0 50%, #f0f3f7 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: 8px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Table Responsive Horizontal Scroll */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
}

/* --- Co-Branding Blinking Animation --- */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}
.blink-orange {
    animation: blink 1.5s infinite ease-in-out;
    color: #ff8c00 !important;
    font-weight: 800;
}