/* ============================================
   BASE STYLES
   Variables, Reset, Typography, Global Styles
   ============================================ */

/* ============================================
   CSS Variables
   ============================================ */

:root {
    /* Colors */
    --bg: #F5F5F7;
    --ink: #1D1D1F;
    --muted: #86868B;
    --card: #FFFFFF;
    --stroke: #D2D2D7;
    --shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
    --cta: #1D1D1F;
    --cta-ink: #FFFFFF;

    /* Radius */
    --radius-lg: 20px;
    --radius-md: 16px;
    --radius-sm: 12px;

    /* Spacing */
    --space-xs: 8px;
    --space-sm: 12px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;

    /* Safe areas */
    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
    --safe-left: env(safe-area-inset-left);
    --safe-right: env(safe-area-inset-right);
}

/* ============================================
   Reset & Base Styles
   ============================================ */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Hide scrollbar */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

html::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
    overflow-x: hidden;
    overscroll-behavior-y: none; /* Disable pull-to-refresh */
    -webkit-overflow-scrolling: touch;
    /* Native app feel - disable text selection and long-press */
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    /* Disable double-tap zoom */
    touch-action: manipulation;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Re-enable text selection for form inputs */
input,
textarea,
select {
    -webkit-user-select: auto;
    -moz-user-select: auto;
    user-select: auto;
    -webkit-touch-callout: default;
}

/* ============================================
   App Layout
   ============================================ */

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: var(--safe-top);
    overscroll-behavior-y: none;
    -webkit-overflow-scrolling: touch;
}

.app-content {
    flex: 1;
    padding-bottom: calc(84px + var(--safe-bottom));
    transition: opacity 0.15s ease;
    overscroll-behavior-y: none;
}

/* ============================================
   Typography Utilities
   ============================================ */

.subtle {
    color: var(--muted);
    font-size: 17px;
    margin: 0;
}

/* ============================================
   Confirmation Modal
   ============================================ */

.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: var(--space-lg);
    opacity: 1;
}

.confirm-dialog {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    max-width: 340px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transform: scale(1);
}

.confirm-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: var(--space-sm);
}

.confirm-message {
    font-size: 15px;
    color: var(--muted);
    line-height: 1.5;
    margin-bottom: var(--space-lg);
}

.confirm-actions {
    display: flex;
    gap: var(--space-sm);
}

.confirm-btn {
    flex: 1;
    min-height: 48px;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.confirm-btn-cancel {
    background: var(--bg);
    color: var(--ink);
    border: 1px solid var(--stroke);
}

.confirm-btn-cancel:active {
    opacity: 0.6;
}

.confirm-btn-confirm {
    background: #dc3545;
    color: white;
}

.confirm-btn-confirm:active {
    background: #c82333;
    transform: scale(0.98);
}

/* ============================================
   Dark Mode Support
   ============================================ */

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #000000;
        --ink: #FFFFFF;
        --muted: #86868B;
        --card: #1C1C1E;
        --stroke: #38383A;
        --cta: #F5F5F7;
        --cta-ink: #1D1D1F;
    }
}