@import url('./design-tokens.css');
@import url('./animations.css');

/* ============================================================================
   GLOBAL RESET & BASE
   ============================================================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* For Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* For Chrome, Edge, Safari */
::-webkit-scrollbar {
    width: var(--scrollbar-width);
    height: var(--scrollbar-width);
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
    border: 1px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* Base HTML elements */
body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: none; /* Critical for iPad: stops browser bounce & multi-touch interference with the 3D scene */
    font-family: var(--font-primary, 'Montserrat', sans-serif);
    color: var(--text-primary, #ffffff);
    background: #07090e; /* Solid backup */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Theme variants: Integration with window-themes.css classes */
body.global-theme-default,
body:not([class*="global-theme-"]),
body[data-theme="metal"] {
    --bg-0: var(--bg-darker, #0a0f1e);
    --bg-1: var(--bg-dark, #0f172a);
    --glass-brd: var(--glass-border, rgba(255,255,255,0.1));
    --txt: var(--text-primary, #f8fafc);
    --acc: var(--color-primary-light, #38bdf8);
    --acc-2: var(--color-purple, #a855f7);
}

body.global-theme-dark,
body[data-theme="dark"] {
    --bg-0: #0b0d12;
    --bg-1: #0a0c10;
    --glass-brd: rgba(255,255,255,0.12);
    --txt: #ebeff4;
    --acc: var(--color-primary-light, #38bdf8);
    --acc-2: var(--color-purple-light, #c084fc);
}

body.global-theme-neon,
body[data-theme="neon"] {
    --bg-0: #0a0a14;
    --bg-1: #0d0d1a;
    --glass-brd: rgba(255,255,255,0.15);
    --txt: #f0f0ff;
    --acc: #00e5ff;
    --acc-2: #ff6ad5;
}

body.global-theme-solar,
body[data-theme="solar"] {
    --bg-0: #1a1410;
    --bg-1: #1f1812;
    --glass-brd: rgba(255,255,255,0.16);
    --txt: #fff8f0;
    --acc: #ffcc66;
    --acc-2: #ff8c42;
}

/* Subtle animated background */
body::before {
    content: ""; position: fixed; inset: 0; z-index: -10;
    background: radial-gradient(1200px 800px at 20% 10%, rgba(124, 58, 237, 0.25), transparent 55%),
                radial-gradient(900px 600px at 80% 80%, rgba(56, 189, 248, 0.18), transparent 55%),
                linear-gradient(180deg, var(--bg-0), var(--bg-1));
    animation: bg-pan 24s linear infinite both;
}
@keyframes bg-pan { 0%{transform: translateX(0)} 50%{transform: translateX(-2%)} 100%{transform: translateX(0)} }

/* Theme-specific background animations */
body[data-theme="dark"]::before {
    background: radial-gradient(1200px 800px at 20% 10%, rgba(0, 189, 214, 0.28), transparent 55%),
                radial-gradient(900px 600px at 80% 80%, rgba(167, 139, 250, 0.22), transparent 55%),
                linear-gradient(180deg, var(--bg-0), var(--bg-1));
}
body[data-theme="neon"]::before {
    background: radial-gradient(1200px 800px at 80% 20%, rgba(0, 229, 255, 0.28), transparent 55%),
                radial-gradient(900px 600px at 15% 80%, rgba(255, 106, 213, 0.22), transparent 55%),
                linear-gradient(180deg, var(--bg-0), var(--bg-1));
}
body[data-theme="solar"]::before {
    background: radial-gradient(1200px 800px at 20% 15%, rgba(255, 204, 102, 0.28), transparent 55%),
                radial-gradient(900px 600px at 85% 80%, rgba(255, 140, 66, 0.22), transparent 55%),
                linear-gradient(180deg, var(--bg-0), var(--bg-1));
}

/* Optional grain overlay if available */
body::after {
    content: ""; position: fixed; inset: 0; z-index: -9; pointer-events: none;
    background-image: 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.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: .05; background-size: 250px 250px; mix-blend-mode: overlay;
}

/* Loading Indicator */
#loading-indicator {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: var(--z-dropdown);
}

/* Spinner CSS */
.spinner {
    border: 4px solid var(--glass-bg-strong);
    border-top: 4px solid var(--color-primary);
    border-radius: var(--radius-full);
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

/* Tooltip */
#tooltip {
    position: absolute;
    display: none;
    left: 20px; /* Weiter links für besseren Platz */
    top: 70px;  /* Unter der Topbar */
    background: rgba(10, 10, 15, 0.9); /* Noch dunkler für maximalen Kontrast */
    backdrop-filter: blur(var(--glass-blur-md)) saturate(150%);
    color: #ffffff;
    padding: 0;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 215, 0, 0.3); /* Goldener Rand passend zur Corona */
    font-family: var(--font-sans, sans-serif);
    font-size: 14px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(255, 215, 0, 0.1);
    z-index: var(--z-max);
    width: 320px;
    max-width: 90vw;
    word-wrap: break-word;
    white-space: normal;
    pointer-events: none;
    overflow: hidden;
    animation: tooltipFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.tooltip-header {
    background: var(--glass-bg-light);
    padding: 15px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
}

.tooltip-icon {
    width: 40px;
    height: 40px;
    margin-right: 12px;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.5));
}

.tooltip-title-container {
    flex: 1;
}

.tooltip-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #ffd700; /* Goldener Titel für Lesbarkeit */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.tooltip-subtitle {
    font-size: 11px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-top: 2px;
}

.tooltip-body {
    padding: 15px;
}

.tooltip-description {
    margin: 0 0 15px 0;
    line-height: 1.5;
    color: #e0e0e0;
    font-size: 13px;
}

.tooltip-stats {
    display: flex;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tooltip-stat {
    font-size: 11px;
    color: #888;
}

.tooltip-stat strong {
    display: block;
    color: #fff;
    font-size: 13px;
    margin-top: 2px;
}

/* ===== GENERAL FORM ELEMENTS ===== */

/* General form styling for consistent rounded corners */
input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="search"],
textarea,
select {
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.2);
    background: var(--glass-bg-light);
    color: var(--txt);
    padding: 8px 12px;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--acc);
    background: var(--glass-bg-light);
    box-shadow: 0 0 0 3px rgba(121, 211, 255, 0.1);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2379d3ff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* Utility: visually hide elements but keep for accessibility */
.visually-hidden {
    position: absolute !important;
    height: 1px; width: 1px;
    overflow: hidden; clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

/* Ensure consistent focus styles for form controls */
input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--glass-bg-light);
    box-shadow: 0 0 0 4px rgba(var(--color-primary-rgb), 0.2);
}

/* Base buttons - reset to be less intrusive */
button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    transition: all var(--transition-fast);
}

/* 🎨 IMPROVED FOCUS VISIBILITY */
button:focus,
.clickable:focus,
[role="button"]:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

button:focus:not(:focus-visible),
.clickable:focus:not(:focus-visible) {
    outline: none;
}

button:focus-visible,
.clickable:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(var(--color-primary-rgb), 0.3);
}

/* Generic hover for standard buttons - usually you'd use a class like .btn */
/* but for now we keep it minimal to avoid rectangles on icons */
button:not(.voice-icon-btn):not(.action-btn):not(.unified-ctrl-btn):hover {
    filter: brightness(1.2);
}

button:active {
    transform: scale(0.98);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}









