/* ========================================
   BASE STYLES & VARIABLES
   ======================================== */

/* CSS Variables for consistency */
:root {
    --header-height: 70px;
    --safe-top: env(safe-area-inset-top, 0);
    --safe-left: env(safe-area-inset-left, 0);
    --safe-right: env(safe-area-inset-right, 0);
    --safe-bottom: env(safe-area-inset-bottom, 0);
    --nav-button-size: 48px;
    --header-padding: 1rem 1.5rem;
    --primary: #14B8A6;
    --primary-hover: #0F766E;
    --primary-light: #99F6E4;
    --primary-dark: #0D9488;
    --secondary: #6B7280;
    --bg-main: #F8FAFC;
    --bg-card: #FFFFFF;
    --bg-section: #F1F5F9;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --info: #3B82F6;
}

/* Native App Styling - Essential PWA behavior */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    box-sizing: border-box;
}

/* Remove all default focus states and browser blue outlines */
*:focus,
*:active,
*:visited,
button:focus,
button:active,
a:focus,
a:active,
input:focus,
textarea:focus,
select:focus,
div:focus,
span:focus,
[tabindex]:focus,
[tabindex]:active {
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
    -webkit-focus-ring-color: transparent !important;
    border-color: inherit;
    box-shadow: none !important;
}

/* Allow buttons and interactive elements to be touchable on mobile */
button, 
input, 
textarea, 
select, 
a, 
[onclick],
[role="button"],
.clickable {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    pointer-events: auto;
    touch-action: manipulation;
}

/* Hide scroll bars globally but keep functionality */
*::-webkit-scrollbar { display: none; }
* {
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}

/* Prevent text overflow globally */
h1, h2, h3, h4, h5, h6 {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

*:not(input):not(textarea) {
    max-width: 100%;
}

/* Smooth scrolling with instant reset capability */
html {
    scroll-behavior: smooth;
}

body {
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0));
}

/* Screen transitions */
.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Line clamp utility */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Success/Error message animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translate(-50%, -100%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.fixed.top-4 {
    animation: slideDown 0.5s ease-out;
}

/* Performance optimizations */
.screen,
.content-card,
.screen-header {
    will-change: transform;
    transform: translateZ(0);
}

.touch-target,
button {
    will-change: transform;
    backface-visibility: hidden;
}

.dashboard-screen.is-hidden,
.modal.is-hidden,
.loading-overlay.is-hidden {
    display: none !important;
}