/* =============================================
   ATLON FIT LITE — Base Styles
   ============================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
    height: 100%;
    overscroll-behavior: none;
    background: var(--surface);
}

body {
    font-family: var(--font);
    background: var(--surface);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
    height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior: none;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

#app {
    width: 100%;
    height: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    background: var(--surface);
}

/* ---- Scrollable page container ---- */
.page {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
    background: var(--bg);
}

.page-with-header {
    padding-top: calc(var(--header-height) + var(--safe-top));
}

/* ---- Splash Screen ---- */
.splash-screen {
    position: fixed;
    inset: 0;
    background: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

.splash-logo {
    width: 140px;
    height: 140px;
    object-fit: contain;
    border-radius: 24px;
    animation: pulse-scale 2s ease-in-out infinite;
}

.splash-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ---- Typography ---- */
h1,
h2,
h3,
h4 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 {
    font-size: var(--font-2xl);
}

h2 {
    font-size: var(--font-xl);
}

h3 {
    font-size: var(--font-lg);
}

h4 {
    font-size: var(--font-base);
}

p {
    color: var(--text-secondary);
    font-size: var(--font-base);
}

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

/* ---- Utilities ---- */
.text-center {
    text-align: center;
}

.text-sm {
    font-size: var(--font-sm);
}

.text-xs {
    font-size: var(--font-xs);
}

.text-muted {
    color: var(--text-muted);
}

.text-primary-color {
    color: var(--primary);
}

.text-danger {
    color: var(--danger);
}

.text-success {
    color: var(--success);
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.gap-1 {
    gap: 8px;
}

.gap-2 {
    gap: 16px;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.flex-1 {
    flex: 1;
}

.w-full {
    width: 100%;
}

.hidden {
    display: none !important;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* ---- Selection ---- */
::selection {
    background: var(--primary);
    color: white;
}

/* ---- Focus ---- */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

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

/* ---- Allow text selection in form fields ---- */
input,
textarea,
select,
[contenteditable] {
    -webkit-user-select: text;
    user-select: text;
    touch-action: auto;
}

/* ---- Native PWA behaviors ---- */
.page {
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}

/* ---- PWA Standalone overrides are in components.css (loaded later in cascade) ---- */