/* ============================================
   CATAPULT - Main Application Styles
   ============================================ */

@import url('variables.css');
@import url('components.css');
@import url('layout.css');

/* ============================================
   RESET & BASE STYLES
   ============================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    color: var(--color-text-primary);
    background-color: var(--color-bg-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Noise texture background for depth */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(255, 103, 31, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(88, 166, 255, 0.02) 0%, transparent 50%),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: var(--z-base);
    opacity: var(--noise-opacity);
}

#app {
    min-height: 100vh;
    position: relative;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    color: var(--color-text-primary);
    margin-bottom: var(--space-md);
}

h1 {
    font-size: var(--font-size-3xl);
    letter-spacing: -0.02em;
}

h2 {
    font-size: var(--font-size-2xl);
    letter-spacing: -0.01em;
}

h3 {
    font-size: var(--font-size-xl);
}

h4 {
    font-size: var(--font-size-lg);
}

p {
    margin-bottom: var(--space-md);
    color: var(--color-text-secondary);
}

a {
    color: var(--brand-primary);
    text-decoration: none;
    transition: all var(--transition-fast);
}

a:hover {
    color: var(--brand-primary-light);
    text-decoration: underline;
}

a:focus {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

code, pre {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

code {
    background: var(--color-surface-raised);
    color: var(--brand-primary-light);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
}

/* ============================================
   CATAPULT LOADER
   ============================================ */

.catapult-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, var(--color-bg-primary) 0%, var(--color-surface-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loader-content {
    text-align: center;
    animation: fadeInUp 0.6s ease-out;
}

.loader-icon {
    margin-bottom: var(--space-xl);
}

.rocket {
    display: inline-block;
    font-size: 4rem;
    color: var(--brand-primary);
    animation: rocketPulse 2s ease-in-out infinite, rocketFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 0 24px var(--brand-primary-glow));
}

.loader-text {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.loader-text .brand {
    font-family: var(--font-display);
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    letter-spacing: 0.1em;
}

.loader-text .tagline {
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.loader-bar {
    width: 240px;
    height: 3px;
    background: var(--color-surface-raised);
    border-radius: var(--radius-full);
    margin: var(--space-xl) auto 0;
    overflow: hidden;
}

.loader-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-primary-light));
    border-radius: var(--radius-full);
    animation: loadingProgress 2s ease-in-out infinite;
    box-shadow: 0 0 16px var(--brand-primary-glow);
}

@keyframes rocketPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes rocketFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes loadingProgress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   ERROR UI
   ============================================ */

#blazor-error-ui {
    background: linear-gradient(135deg, var(--color-error) 0%, #c92d24 100%);
    color: white;
    padding: var(--space-lg) var(--space-xl);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-modal);
    display: none;
    align-items: center;
    gap: var(--space-md);
    box-shadow: 0 -4px 24px rgba(248, 81, 73, 0.3);
    border-top: 2px solid rgba(255, 255, 255, 0.2);
    animation: slideUp 0.3s ease-out;
}

#blazor-error-ui i {
    font-size: 1.5rem;
    flex-shrink: 0;
}

#blazor-error-ui span {
    flex: 1;
    font-weight: var(--font-weight-medium);
}

#blazor-error-ui .reload {
    background: white;
    color: var(--color-error);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-md);
    font-weight: var(--font-weight-semibold);
    text-decoration: none;
    transition: all var(--transition-fast);
}

#blazor-error-ui .reload:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#blazor-error-ui .dismiss {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

#blazor-error-ui .dismiss:hover {
    background: rgba(255, 255, 255, 0.3);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.blazor-error-boundary {
    background: var(--color-error);
    padding: var(--space-lg);
    color: white;
    border-radius: var(--radius-md);
    margin: var(--space-md);
}

.blazor-error-boundary::after {
    content: "An error occurred while rendering this component.";
}

/* ============================================
   VALIDATION STYLES
   ============================================ */

.valid.modified:not([type=checkbox]) {
    border-color: var(--color-success);
    box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.1);
}

.invalid {
    border-color: var(--color-error);
    box-shadow: 0 0 0 3px rgba(248, 81, 73, 0.1);
}

.validation-message {
    color: var(--color-error);
    font-size: var(--font-size-sm);
    margin-top: var(--space-xs);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.validation-message::before {
    content: '⚠';
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-primary { color: var(--color-text-primary) !important; }
.text-secondary { color: var(--color-text-secondary) !important; }
.text-tertiary { color: var(--color-text-tertiary) !important; }
.text-brand { color: var(--brand-primary) !important; }

.bg-primary { background-color: var(--color-bg-primary) !important; }
.bg-secondary { background-color: var(--color-bg-secondary) !important; }
.bg-tertiary { background-color: var(--color-bg-tertiary) !important; }

.font-display { font-family: var(--font-display) !important; }
.font-mono { font-family: var(--font-mono) !important; }

.fw-normal { font-weight: var(--font-weight-normal) !important; }
.fw-medium { font-weight: var(--font-weight-medium) !important; }
.fw-semibold { font-weight: var(--font-weight-semibold) !important; }
.fw-bold { font-weight: var(--font-weight-bold) !important; }

.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

.animate-slide-up {
    animation: slideUpContent 0.6s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUpContent {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Focus visible for accessibility */
:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--color-surface-hover);
    border-radius: var(--radius-md);
    border: 2px solid var(--color-bg-secondary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--brand-primary);
}

/* Selection styling */
::selection {
    background: var(--brand-primary-glow);
    color: var(--color-text-primary);
}