/* ============================================================
   MAIN CSS - Job Orchestrator Design System
   ============================================================

   This file contains:
   1. Design Tokens import
   2. CSS Reset
   3. Base Styles
   4. Splash Screen

   Design tokens are defined in ./tokens/ directory.
   Components are defined in ./components.css
   Layout styles are in ./layout.css
   Utility classes are in ./utilities.css

   ============================================================ */

/* Import Design Tokens */
@import url('./tokens.css');


/* ========================================
   CSS RESET
   ======================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    height: 100%;
    touch-action: manipulation;
    -ms-touch-action: manipulation;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg-page);
    color: var(--color-text-primary);
    line-height: var(--line-height-normal);
    font-size: var(--font-size-base);
    height: 100%;
    margin: 0;
    padding: 0;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    position: fixed;
    width: 100%;
    overflow: hidden;
}

/* iOS Capacitor: Full viewport */
html, body {
    height: 100%;
    height: 100dvh;
}

/* Prevent text selection (except inputs) */
* {
    -webkit-user-select: none;
    user-select: none;
}

input, textarea, [contenteditable="true"] {
    -webkit-user-select: text;
    user-select: text;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

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


/* ========================================
   SPLASH SCREEN
   ======================================== */

.splash-screen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

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

.splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.splash-logo {
    position: relative;
    margin-bottom: 1.5rem;
}

.logo-icon {
    font-size: 5rem;
    animation: splash-bounce 2s ease-in-out infinite;
}

.logo-glow {
    position: absolute;
    inset: -20px;
    background: radial-gradient(circle, rgba(0, 122, 255, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    animation: splash-glow 2s ease-in-out infinite;
}

@keyframes splash-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

@keyframes splash-glow {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

.splash-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.splash-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 2rem;
}

.splash-loader {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.loader-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #007AFF, #00C7BE, #5856D6);
    border-radius: 2px;
    transition: width 0.3s ease-out, background 0.3s ease;
}

.loader-bar:not([style*="width"]) {
    animation: splash-pulse 1.5s ease-in-out infinite;
}

@keyframes splash-pulse {
    0%, 100% { width: 5%; opacity: 0.8; }
    50% { width: 25%; opacity: 1; }
}

.splash-footer {
    position: absolute;
    bottom: 2rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Grid pattern background for splash */
.splash-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
}

/* Decorative circles for splash */
.splash-screen::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border: 1px solid rgba(0, 122, 255, 0.1);
    border-radius: 50%;
    top: -100px;
    right: -100px;
    animation: splash-circle 6s ease-in-out infinite;
}

@keyframes splash-circle {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.1); opacity: 0.5; }
}


/* ========================================
   GLOBAL ANIMATIONS
   ======================================== */

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}
