@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700;800&display=swap');

/* Global Reset for Number Inputs */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    appearance: textfield;
    -moz-appearance: textfield;
}

/* Default Theme: Cyber Indigo */
:root, [data-theme='indigo'] {
    --bg-color: #050505;
    --surface: #0a0a0a;
    --surface-light: #151515;
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --secondary: #a855f7;
    --accent: #f43f5e;
    --text-main: #ffffff;
    --text-dim: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.03);
}

/* Midnight Emerald Theme */
[data-theme='emerald'] {
    --bg-color: #022c22;
    --surface: #064e3b;
    --surface-light: #065f46;
    --primary: #34d399;
    --primary-glow: rgba(52, 211, 153, 0.3);
    --secondary: #fbbf24;
    /* Gold */
    --accent: #f59e0b;
    --text-main: #ecfdf5;
    --text-dim: #a7f3d0;
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(0, 0, 0, 0.2);
}

/* Deep Ocean Blue Theme */
[data-theme='ocean'] {
    --bg-color: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --primary: #38bdf8;
    --primary-glow: rgba(56, 189, 248, 0.3);
    --secondary: #2dd4bf;
    --accent: #fb7185;
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.02);
}

/* Crystal Light Theme */
[data-theme='light'] {
    --bg-color: #f8fafc;
    --surface: #ffffff;
    --surface-light: #f1f5f9;
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.1);
    --secondary: #8b5cf6;
    --accent: #f43f5e;
    --text-main: #0f172a;
    --text-dim: #475569;
    --glass-border: rgba(0, 0, 0, 0.05);
    --glass-bg: rgba(255, 255, 255, 0.8);
}

/* Royal Velvet Theme */
[data-theme='royal'] {
    --bg-color: #0c0a15;
    --surface: #1e1b2e;
    --surface-light: #2d2a45;
    --primary: #f59e0b; /* Gold */
    --primary-glow: rgba(245, 158, 11, 0.3);
    --secondary: #9333ea; /* Purple */
    --accent: #f43f5e;
    --text-main: #f3f4f6;
    --text-dim: #9ca3af;
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(147, 51, 234, 0.05);
}

/* Midnight Lava Theme */
[data-theme='lava'] {
    --bg-color: #090909;
    --surface: #121212;
    --surface-light: #181818;
    --primary: #ef4444; /* Lava Red */
    --primary-glow: rgba(239, 68, 68, 0.3);
    --secondary: #f97316; /* Orange */
    --accent: #facc15;
    --text-main: #ffffff;
    --text-dim: #a1a1aa;
    --glass-border: rgba(239, 68, 68, 0.15);
    --glass-bg: rgba(239, 68, 68, 0.02);
}

/* Cyber Neon Theme */
[data-theme='cyber'] {
    --bg-color: #03001c;
    --surface: #0b022d;
    --surface-light: #160a4f;
    --primary: #00f0ff; /* Electric Cyan */
    --primary-glow: rgba(0, 240, 255, 0.4);
    --secondary: #ff00ff; /* Neon Magenta */
    --accent: #7000ff;
    --text-main: #ffffff;
    --text-dim: #b8b1db;
    --glass-border: rgba(0, 240, 255, 0.2);
    --glass-bg: rgba(112, 0, 255, 0.05);
}

html,
body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    direction: rtl;
    overflow-x: hidden;
    transition: background-color 0.5s ease, color 0.5s ease;
}

/* Background Blobs (Dynamic colors) */
body::before {
    content: '';
    position: fixed;
    top: -10%;
    left: -10%;
    width: 40%;
    height: 40%;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
}

body::after {
    content: '';
    position: fixed;
    bottom: -10%;
    right: -10%;
    width: 50%;
    height: 50%;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
    filter: hue-rotate(90deg);
}

h1,
h2,
h3,
h4,
h5 {
    font-weight: 800;
    letter-spacing: -0.025em;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    filter: brightness(1.2);
}

/* Blazor Layout Fixes */
.page {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

.content {
    padding: 2rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Glass Cards */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

/* Buttons */
.btn {
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--primary-glow);
}

/* Blazor Loading Progress */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 30vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: var(--surface-light);
    stroke-width: 0.5rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--primary);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
    filter: drop-shadow(0 0 5px var(--primary));
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: 800;
    font-size: 1.2rem;
    inset: calc(30vh + 3.25rem) 0 auto 0;
    color: var(--text-main);
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "טוען...");
}

/* Error UI */
#blazor-error-ui {
    background: var(--accent);
    color: white;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    display: none;
    padding: 1rem 2rem;
    position: fixed;
    width: auto;
    min-width: 300px;
    border-radius: 12px;
    z-index: 2000;
}

#blazor-error-ui .reload {
    margin-right: 1rem;
    color: white;
    font-weight: bold;
    text-decoration: underline;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
}

/* Navigation Menu */
.sidebar {
    background: var(--surface);
    width: 280px;
    height: 100vh;
    position: sticky;
    top: 0;
    border-left: 1px solid var(--glass-border);
}

/* Mobile Nav */
.mobile-nav {
    position: fixed;
    bottom: 25px;
    left: 20px;
    right: 20px;
    height: 70px;
    background: rgba(15, 15, 15, 0.82);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 40px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 5px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    z-index: 1000;
}

.mobile-nav nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
}

.nav-link-mobile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 2px;
}

.nav-link-mobile .nav-icon {
    font-size: 1.3rem;
}

.nav-link-mobile .nav-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-link-mobile.active {
    color: var(--primary);
}

.nav-link-mobile.active .nav-icon {
    text-shadow: 0 0 20px var(--primary);
}

.has-mobile-nav {
    padding-bottom: 110px !important;
}

@media (min-width: 768px) {
    .mobile-nav { display: none; }
    .has-mobile-nav { padding-bottom: 0 !important; }
    .mobile-top-bar {
        position: sticky;
        top: 0;
    }
}

@media (max-width: 767.98px) {
    .sidebar { display: none; }
    .has-mobile-top-bar {
        padding-top: calc(60px + env(safe-area-inset-top));
    }
    .mobile-top-bar {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        width: 100vw;
        height: calc(60px + env(safe-area-inset-top, 0px)) !important;
        padding-top: env(safe-area-inset-top, 0px);
        transform: translate3d(0, 0, 0); /* iOS Hardware Accel Fix */
        -webkit-transform: translate3d(0, 0, 0);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        box-shadow: 0 4px 25px rgba(0, 0, 0, 0.6);
        z-index: 1500;
    }
}

/* Modal Overlay Fixes */
.modal-backdrop {
    backdrop-filter: blur(8px);
    background-color: rgba(0,0,0,0.6) !important;
}

.modal-content {
    border-radius: 24px !important;
    border: 1px solid var(--glass-border) !important;
    background: var(--surface) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7) !important;
}

/* Page Transitions */
.page-transition {
    animation: slideUp 0.4s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}