/* Theme-specific CSS for Design Lab */
/* Special effects, animations, and theme-specific layout adjustments */

/* Custom InstaCalc hand-drawn font */
@font-face {
    font-family: InstaCalc;
    src: url("/img/ui/InstaCalc_v2.otf?v=112622") format("opentype");
}

#design-lab-container,
#design-lab-container * {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

:root {
    --radius-control: 0.625rem;
    --radius-base: 0.75rem;
    --radius-card: 1rem;
    --radius-surface: 1.25rem;
    --radius-sidebar: 1.5rem;
    --dropdown-surface: color-mix(in srgb, var(--bg, #f8fafc) 80%, var(--bg-alt, #ffffff) 20%);
    --dropdown-border-color: color-mix(in srgb, var(--soft-border-color, rgba(15, 23, 42, 0.16)) 80%, transparent);
    --dropdown-shadow: 0 18px 35px rgba(15, 23, 42, 0.18);

    /* Layout dimensions */
    --mobile-bottom-nav-height: 60px;
    --desktop-sticky-offset: 80px;
    --sidebar-width: 460px;
    --sidebar-panel-height: 80vh;

    /* Animation durations */
    --toolbar-close-duration: 1000ms;
    --duration-fast: 150ms;        /* Quick fades, hover states */
    --duration-normal: 200ms;      /* Standard UI interactions */
    --duration-medium: 300ms;      /* Background/color changes */
    --duration-slow: 500ms;        /* Panel/section animations */

    /* Base variables that map to theme variables */
    --panel: var(--bg);
    --border: var(--soft-border-color);
    --secondary-bg-color: var(--panel);

    /* Card style variables - can be overridden dynamically */
    --sidebar-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    --sidebar-card-bg: var(--bg);
    --sidebar-card-border: var(--soft-border-color);

    --calc-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 8px 16px -4px rgba(0, 0, 0, 0.06);
    --calc-card-bg: var(--bg);
    --calc-card-border: var(--soft-border-color);
}

body.single-layout .single-layout-card {
    position: relative;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-surface, 1.25rem);
    background: color-mix(in srgb, var(--calc-card-bg, var(--bg)) 96%, transparent);
    border: 1px solid color-mix(in srgb, var(--calc-card-border, rgba(15, 23, 42, 0.12)) 80%, transparent);
    box-shadow: var(--calc-card-shadow, 0 25px 50px -12px rgba(0, 0, 0, 0.25));
    padding: clamp(1.25rem, 2vw, 2.25rem);
    gap: 1.5rem;
}

body.single-layout .single-layout-card>[data-calc-wrapper] {
    background: transparent;
    border: none;
    box-shadow: none;
}

body.single-layout .single-logo img {
    width: 3rem;
    height: 3rem;
    filter: var(--theme-logo-filter, drop-shadow(0 8px 16px rgba(0, 0, 0, 0.25)));
}

body.single-layout .single-logo span {
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 0.05em;
    color: var(--theme-text, var(--text, #fff));
}

/* InstaCalc logo - uses theme logo filter */
.ic-logo {
    filter: var(--theme-logo-filter, brightness(0) saturate(100%) invert(62%) sepia(52%) saturate(1893%) hue-rotate(193deg) brightness(101%) contrast(97%));
}

.theme-rounded-xs {
    border-radius: var(--radius-control);
}

.theme-rounded-sm {
    border-radius: var(--radius-base);
}

.theme-rounded-lg {
    border-radius: var(--radius-card);
}

.theme-rounded-xl {
    border-radius: var(--radius-surface);
}

.theme-rounded-sidebar {
    border-radius: var(--radius-sidebar);
}

.theme-rounded-sidebar-left {
    border-top-left-radius: var(--radius-sidebar);
    border-bottom-left-radius: var(--radius-sidebar);
}

.theme-rounded-sidebar-right {
    border-top-right-radius: var(--radius-sidebar);
    border-bottom-right-radius: var(--radius-sidebar);
}

[data-theme-rounded-controls="true"] :where(button, input, select, textarea) {
    border-radius: var(--radius-control);
}

[data-theme-rounded-utilities="true"] :where(.rounded, .rounded-sm, .rounded-md) {
    border-radius: var(--radius-base);
}

[data-theme-rounded-utilities="true"] :where(.rounded-lg, .rounded-xl, .rounded-2xl, .rounded-3xl) {
    border-radius: var(--radius-card);
}

/* Removed generic element styling - use Tailwind classes instead */

header .logo {
    transform: scale(var(--theme-logo-scale, 1));
}

[data-theme-header-centered="true"] header {
    justify-content: center !important;
    text-align: center;
}

[data-theme-logo-centered="true"] header .logo {
    margin-left: auto;
    margin-right: auto;
}

[data-theme-elevated-controls="true"] :where(button, input, select) {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-theme-elevated-controls="true"] button:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

[data-theme-borderless-panels="true"] aside button,
[data-theme-borderless-panels="true"] main>div>div>div {
    border: none;
}

[data-theme-main-inner-constrained="true"] main>div>div {
    max-width: var(--theme-main-inner-max-width, 56rem);
    margin-left: auto;
    margin-right: auto;
}

[data-theme-aside-buttons-tight="true"] aside button {
    padding: var(--theme-aside-button-padding, inherit);
    font-size: var(--theme-aside-button-font-size, inherit);
}

[data-theme-typography-h2="true"] h2 {
    font-size: var(--theme-h2-font-size);
    font-weight: var(--theme-h2-font-weight);
    margin-bottom: var(--theme-h2-margin-bottom);
}

/* Responsive variants */
@media (min-width: 768px) {

    .md\:theme-rounded-xs {
        border-radius: var(--radius-control);
    }

    .md\:theme-rounded-sm {
        border-radius: var(--radius-base);
    }

    .md\:theme-rounded-lg {
        border-radius: var(--radius-card);
    }

    .md\:theme-rounded-xl {
        border-radius: var(--radius-surface);
    }

    .md\:theme-rounded-sidebar {
        border-radius: var(--radius-sidebar);
    }

    .md\:theme-rounded-sidebar-left {
        border-top-left-radius: var(--radius-sidebar);
        border-bottom-left-radius: var(--radius-sidebar);
    }

    .md\:theme-rounded-sidebar-right {
        border-top-right-radius: var(--radius-sidebar);
        border-bottom-right-radius: var(--radius-sidebar);
    }
}

/* === TERMINAL THEME === */
.theme-terminal {
    position: relative;
}

.theme-terminal::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg, rgba(0, 255, 0, 0.03) 0px, transparent 1px, transparent 2px, rgba(0, 255, 0, 0.03) 3px);
    pointer-events: none;
    z-index: -1;
    animation: scanline 8s linear infinite;
}

@keyframes scanline {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(10px);
    }
}

.theme-terminal .content-wrapper {
    position: relative;
    z-index: 2;
}

.theme-terminal .text-flicker {
    animation: flicker 0.15s infinite alternate;
}

@keyframes flicker {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.95;
    }
}

/* === BRUTALIST THEME === (Variables now in THEME_CONFIG_V2) === */

.theme-brutalist .bg-pattern {
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 50px, #f0f0f0 50px, #f0f0f0 51px),
        repeating-linear-gradient(90deg, transparent, transparent 50px, #f0f0f0 50px, #f0f0f0 51px);
}

.theme-brutalist .card-brutalist {
    border: 4px solid #000000;
    box-shadow: 8px 8px 0 rgba(0, 0, 0, 1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.theme-brutalist .card-brutalist:hover {
    transform: translate(-2px, -2px);
    box-shadow: 12px 12px 0 rgba(0, 0, 0, 1);
}

/* === ART DECO THEME === (Variables now in THEME_CONFIG_V2) === */
.theme-deco {
    position: relative;
}

.theme-deco::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(0deg, transparent 0px, rgba(212, 175, 55, 0.03) 1px, transparent 2px, transparent 20px),
        repeating-linear-gradient(90deg, transparent 0px, rgba(212, 175, 55, 0.03) 1px, transparent 2px, transparent 20px);
    pointer-events: none;
    z-index: -1;
}

.theme-deco .deco-border {
    border-image: linear-gradient(135deg, #d4af37 0%, #ffd700 50%, #d4af37 100%) 1;
    border-width: 2px;
    border-style: solid;
}

.theme-deco h1,
.theme-deco h2,
.theme-deco h3 {
    font-style: italic;
    letter-spacing: 0.05em;
}

/* === CYBERPUNK THEME === (Variables now in THEME_CONFIG_V2) === */
.theme-cyber {
    position: relative;
}

.theme-cyber::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 50%, rgba(255, 0, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 240, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.theme-cyber .cyber-glitch {
    position: relative;
}

.theme-cyber .cyber-glitch:hover::before,
.theme-cyber .cyber-glitch:hover::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.theme-cyber .cyber-glitch:hover::before {
    animation: glitch-1 0.3s infinite;
    color: #ff00ff;
    z-index: -1;
}

.theme-cyber .cyber-glitch:hover::after {
    animation: glitch-2 0.3s infinite;
    color: #00f0ff;
    z-index: -2;
}

@keyframes glitch-1 {

    0%,
    100% {
        transform: translate(0);
    }

    33% {
        transform: translate(-2px, 2px);
    }

    66% {
        transform: translate(2px, -1px);
    }
}

@keyframes glitch-2 {

    0%,
    100% {
        transform: translate(0);
    }

    33% {
        transform: translate(2px, -2px);
    }

    66% {
        transform: translate(-2px, 1px);
    }
}

/* === NORDIC THEME === (Variables now in THEME_CONFIG_V2) === */

.theme-nordic .glass-effect {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.theme-nordic .animate-in {
    animation: fadeSlideIn 0.6s ease-out forwards;
}

/* === RETRO THEME === (Variables now in THEME_CONFIG_V2) === */
.theme-retro {
    position: relative;
}

.theme-retro::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 30% 30%, rgba(255, 182, 193, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 70% 70%, rgba(255, 107, 157, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.theme-retro .crt-effect {
    position: relative;
    animation: crt-flicker 0.2s infinite;
}

@keyframes crt-flicker {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.98;
    }
}

/* === SYNTHWAVE THEME === (Variables now in THEME_CONFIG_V2) === */
.theme-synthwave {
    position: relative;
}

.theme-synthwave::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(0deg, transparent 24%, rgba(255, 0, 255, 0.05) 25%, rgba(255, 0, 255, 0.05) 26%, transparent 27%, transparent 74%, rgba(0, 255, 255, 0.05) 75%, rgba(0, 255, 255, 0.05) 76%, transparent 77%, transparent),
        linear-gradient(90deg, transparent 24%, rgba(255, 0, 255, 0.05) 25%, rgba(255, 0, 255, 0.05) 26%, transparent 27%, transparent 74%, rgba(0, 255, 255, 0.05) 75%, rgba(0, 255, 255, 0.05) 76%, transparent 77%, transparent);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: -1;
}

.theme-synthwave .neon-glow {
    text-shadow: 0 0 10px currentColor, 0 0 20px currentColor;
}

/* === NEWSPAPER THEME === (Variables now in THEME_CONFIG_V2) === */
.theme-newspaper {
    position: relative;
}

.theme-newspaper::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(0deg, transparent, transparent 1px, rgba(0, 0, 0, 0.02) 1px, rgba(0, 0, 0, 0.02) 2px);
    pointer-events: none;
    z-index: -1;
}

.theme-newspaper h1,
.theme-newspaper h2,
.theme-newspaper h3 {
    text-transform: uppercase;
    letter-spacing: -0.02em;
}

/* === CHALKBOARD THEME === (Variables now in THEME_CONFIG_V2) === */
.theme-chalkboard {
    position: relative;
}

.theme-chalkboard::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(ellipse at top left, rgba(255, 255, 255, 0.02), transparent),
        radial-gradient(ellipse at bottom right, rgba(255, 255, 255, 0.02), transparent);
    pointer-events: none;
    z-index: -1;
}

.theme-chalkboard * {
    font-weight: 700 !important;
}

/* === BLUEPRINT THEME === (Variables now in THEME_CONFIG_V2) === */
.theme-blueprint {
    position: relative;
}

.theme-blueprint::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(0deg, transparent 0px, rgba(255, 255, 255, 0.05) 1px, transparent 2px, transparent 10px),
        repeating-linear-gradient(90deg, transparent 0px, rgba(255, 255, 255, 0.05) 1px, transparent 2px, transparent 10px);
    pointer-events: none;
    z-index: -1;
}

.theme-blueprint * {
    letter-spacing: 0.05em;
}

/* === NEON TOKYO THEME === (Variables now in THEME_CONFIG_V2) === */
.theme-neon-tokyo {
    position: relative;
}

.theme-neon-tokyo::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(255, 23, 68, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(0, 229, 255, 0.15) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.theme-neon-tokyo .neon-text {
    text-shadow: 0 0 5px currentColor, 0 0 15px currentColor, 0 0 30px currentColor;
}

/* === GAMEBOY THEME === (Variables now in THEME_CONFIG_V2) === */
.theme-gameboy {
    position: relative;
    image-rendering: pixelated;
}

.theme-gameboy::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(0deg, transparent 0px, rgba(155, 188, 15, 0.03) 1px, transparent 2px, transparent 4px),
        repeating-linear-gradient(90deg, transparent 0px, rgba(155, 188, 15, 0.03) 1px, transparent 2px, transparent 4px);
    pointer-events: none;
    z-index: -1;
}

.theme-gameboy * {
    font-weight: 400 !important;
}

/* === VAPORWAVE THEME === (Variables now in THEME_CONFIG_V2) === */
.theme-vaporwave {
    position: relative;
}

.theme-vaporwave::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(0deg, transparent 0%, rgba(255, 255, 255, 0.05) 50%, transparent 100%);
    background-size: 100% 4px;
    pointer-events: none;
    z-index: -1;
    animation: vaporScroll 20s linear infinite;
}

@keyframes vaporScroll {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 0 100px;
    }
}

/* === HACKER THEME === (Variables now in THEME_CONFIG_V2) === */
.theme-hacker {
    position: relative;
}

.theme-hacker::after {
    content: 'ACCESS GRANTED';
    position: fixed;
    top: 20px;
    right: 20px;
    color: var(--accent);
    font-size: 10px;
    opacity: 0.3;
    font-family: 'Major Mono Display', monospace;
    pointer-events: none;
    z-index: -1;
    animation: blink 2s infinite;
}

@keyframes blink {

    0%,
    49%,
    51%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 0;
    }
}

/* === MIDNIGHT THEME === (Variables now in THEME_CONFIG_V2) === */

/* === SUNSET THEME === (Variables now in THEME_CONFIG_V2) === */
.theme-sunset {
    position: relative;
}

.theme-sunset::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at bottom, rgba(255, 107, 107, 0.2) 0%, transparent 60%);
    pointer-events: none;
    z-index: -1;
}

/* === INDUSTRIAL THEME === (Variables now in THEME_CONFIG_V2) === */
.theme-industrial {
    position: relative;
}

.theme-industrial::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(90deg, transparent 0px, rgba(255, 140, 0, 0.02) 1px, transparent 2px, transparent 100px);
    pointer-events: none;
    z-index: -1;
}

/* === FOREST THEME === (Variables now in THEME_CONFIG_V2) === */

/* === LUXURY THEME === (Variables now in THEME_CONFIG_V2) === */
.theme-luxury {
    position: relative;
}

.theme-luxury::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(212, 175, 55, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(212, 175, 55, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* === PASTEL THEME === (Variables now in THEME_CONFIG_V2) === */

/* === GRUNGE THEME === (Variables now in THEME_CONFIG_V2) === */
.theme-grunge {
    position: relative;
}

.theme-grunge::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200"><filter id="noise"><feTurbulence baseFrequency="0.9" /></filter><rect width="200" height="200" filter="url(%23noise)" opacity="0.05"/></svg>');
    pointer-events: none;
    z-index: -1;
}

/* === NEON NOIR THEME === (Variables now in THEME_CONFIG_V2) === */
.theme-neon-noir {
    position: relative;
}

.theme-neon-noir::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(255, 0, 110, 0.15) 0%, transparent 40%),
        radial-gradient(ellipse at 70% 60%, rgba(0, 255, 255, 0.1) 0%, transparent 40%);
    pointer-events: none;
    z-index: -1;
}

/* === AMBER TERMINAL THEME === (Variables now in THEME_CONFIG_V2) === */
.theme-amber {
    position: relative;
}

.theme-amber::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg, transparent 0px, rgba(255, 176, 0, 0.03) 1px, transparent 2px, transparent 3px);
    pointer-events: none;
    z-index: -1;
    animation: scanline 8s linear infinite;
}

/* === COSMIC THEME === (Variables now in THEME_CONFIG_V2) === */
.theme-cosmic {
    position: relative;
}

.theme-cosmic::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(2px 2px at 20% 30%, white, transparent),
        radial-gradient(2px 2px at 60% 70%, white, transparent),
        radial-gradient(1px 1px at 50% 50%, white, transparent),
        radial-gradient(1px 1px at 80% 10%, white, transparent),
        radial-gradient(2px 2px at 90% 60%, white, transparent),
        radial-gradient(1px 1px at 33% 50%, white, transparent),
        radial-gradient(1px 1px at 66% 90%, white, transparent);
    background-size: 200% 200%;
    opacity: 0.5;
    pointer-events: none;
    z-index: -1;
}

/* === CUTE THEME === (Variables now in THEME_CONFIG_V2) === */
.theme-cute {
    position: relative;
}

.theme-cute::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(122, 178, 221, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(144, 200, 239, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* More padding on row input fields for cute theme */
[data-theme="theme-cute"] calc row input {
    padding: 4px 12px !important;
}

/* === UNIFIED WINDOW MODE (can be applied to any theme) === */
.unified-window {
    padding: 2rem !important;
}


.unified-window .content-wrapper {
    background: var(--bg-alt);
    border-radius: var(--radius-surface, 24px);
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.1),
        0 4px 8px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.unified-window aside {
    opacity: 0.95;
}

.unified-window header {
    opacity: 0.95;
}

/* === SECTION BORDERS CONTROL === */
/* Subtle borders (default) - low opacity - Removed, use Tailwind classes */

/* When borders are set to visible, make them more prominent */
.border-opacity-100 {
    border-opacity: 1 !important;
}

/* === MAIN CONTENT STYLING === */
/* Removed - use Tailwind classes instead */

/* === CALC STYLE VARIANTS === */

/* Base calc holder - ensure it uses pure background color for visual hierarchy */
#calc-holder {
    background: var(--bg);
}

/* Built-in calc mode - merges calc into background, no visual separation */
.calc-built-in main {
    border-radius: 0;
    box-shadow: none !important;
    margin: 0 !important;
    background: transparent !important;
}

.calc-built-in #calc-holder {
    box-shadow: none !important;
}

/* === CALC TOOLBAR POSITION VARIANTS === */

/* Inline (default) - naturally positioned below calc */
.calc-toolbar-inline #calc-toolbar-holder {
    position: relative;
}

/* Bottom Bar - fixed to viewport bottom like mobile nav */
.calc-toolbar-bottom-bar #calc-toolbar-holder {
    position: fixed;
    bottom: 0;
    left: 320px;
    right: 0;
    z-index: 40;
    background: var(--bg-alt);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.75rem 1rem;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.calc-toolbar-bottom-bar main {
    padding-bottom: 5rem !important;
    /* Space for fixed bottom bar */
}

/* Top Bar - fixed to viewport top like menu bar */
.calc-toolbar-top-bar #calc-toolbar-holder {
    position: fixed;
    top: 0;
    left: 320px;
    right: 0;
    z-index: 40;
    background: var(--bg-alt);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.75rem 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.calc-toolbar-top-bar main {
    padding-top: 5rem !important;
    /* Space for fixed top bar */
}

/* Sidebar Left */
.calc-toolbar-sidebar-left #calc-toolbar-holder {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 40;
    background: var(--bg-alt);
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1rem 0.75rem;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Sidebar Right */
.calc-toolbar-sidebar-right #calc-toolbar-holder {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 40;
    background: var(--bg-alt);
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1rem 0.75rem;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Make toolbar buttons stack vertically in sidebar modes */
.calc-toolbar-sidebar-left #calc-toolbar-holder>div,
.calc-toolbar-sidebar-right #calc-toolbar-holder>div {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.calc-toolbar-sidebar-left #calc-toolbar-holder button,
.calc-toolbar-sidebar-right #calc-toolbar-holder button {
    writing-mode: horizontal-tb;
    min-width: 2.5rem;
}

[x-cloak] {
    display: none !important;
}

/* Note: Common utilities moved to tailwind.config.js for responsive variant support:
   - bg-default, bg-secondary
   - text-color-default, text-color-calc, text-color-active, text-color-muted
   - border-color-soft
   - hover-bg-button, hover-text-color-active
*/

/* Remaining legacy utilities (not commonly used) */
.bg-accent {
    background-color: var(--accent);
}

.text-bg {
    color: var(--bg);
}

.text-color-highlight {
    color: var(--highlight-text-color);
}

/* Shared dropdown surface + item layout */
.hs-dropdown-menu {
    background: var(--dropdown-surface);
    border: 1px solid var(--dropdown-border-color);
    border-radius: var(--radius-base);
    box-shadow: var(--dropdown-shadow);
    padding: 0.5rem;
    z-index: 500;
}

.hs-dropdown-menu :where(a, button) {
    display: grid;
    grid-template-columns: 1.25rem auto;
    align-items: center;
    gap: 0.65rem;
}

.hs-dropdown-menu :where(a.flex, button.flex) {
    gap: 0.75rem;
    align-items: center;
}

.hs-dropdown-menu :where(a.flex svg, button.flex svg) {
    width: 1.15rem;
    height: 1.15rem;
    flex: 0 0 1.15rem;
}

.hs-dropdown-menu :where(a svg, button svg) {
    width: 1.15rem;
    height: 1.15rem;
}

.hs-dropdown-menu select {
    width: 100%;
    border-radius: var(--radius-control);
    border: 1px solid var(--dropdown-border-color);
    background: var(--dropdown-surface);
    color: var(--text);
    padding: 0.45rem 0.75rem;
}

.menu-surface {
    background: var(--dropdown-surface);
    border: 1px solid var(--dropdown-border-color);
    border-radius: var(--radius-base);
    box-shadow: var(--dropdown-shadow);
    color: var(--text);
    padding: 0.5rem;
    backdrop-filter: blur(12px);
}

.menu-item {
    display: grid;
    grid-template-columns: 1.25rem auto;
    align-items: center;
    gap: 0.65rem;
    border-radius: var(--radius-control);
    padding: 0.45rem 0.75rem;
    font-size: 0.9rem;
    line-height: 1.3rem;
    color: var(--text);
    transition: background 150ms ease, color 150ms ease;
}

.menu-item svg {
    width: 1.05rem;
    height: 1.05rem;
    flex: 0 0 1.05rem;
}

.menu-item:hover,
.menu-item:focus-visible {
    background: color-mix(in srgb, var(--theme-accent, var(--accent-primary, #3b82f6)) 14%, transparent);
    color: var(--text);
}

.menu-item:active {
    background: color-mix(in srgb, var(--theme-accent, var(--accent-primary, #3b82f6)) 22%, transparent);
}

.menu-label {
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--text) 70%, transparent);
    margin-bottom: 0.35rem;
    display: block;
}

.menu-surface select {
    width: 100%;
    border-radius: var(--radius-control);
    border: 1px solid var(--dropdown-border-color);
    background: var(--dropdown-surface);
    color: var(--text);
    padding: 0.45rem 0.75rem;
    font-size: 0.9rem;
}

@media (prefers-color-scheme: dark) {
    .dark\:bg-gray-800 {
        background-color: var(--secondary-bg-color) !important;
    }

    .dark\:border-gray-700 {
        border-color: color-mix(in srgb, var(--border-color) 50%, transparent) !important;
    }

    .dark\:divide-gray-700>*+* {
        border-color: color-mix(in srgb, var(--border-color) 50%, transparent) !important;
    }
}

.ct-chart {
    position: relative;
    width: 100%;
}

.gallery-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gallery-item-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gallery-item-title {
    font-weight: 600;
}

.gallery-item-blurb {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.gallery-item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.gallery-item-action {
    color: var(--accent);
    font-weight: 500;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.25rem;
}

.theme-preset {
    width: 100%;
    border-radius: var(--radius-base);
    padding: 0.5rem 0.75rem;
    text-align: left;
    border: 1px solid color-mix(in srgb, var(--soft-border-color) 60%, transparent);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    transition: border-color 150ms ease-out, background-color 150ms ease-out, transform 150ms ease-out;
}

.theme-preset--inactive:hover,
.theme-preset--inactive:focus-visible {
    border-color: color-mix(in srgb, var(--accent) 40%, transparent);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    transform: translateY(-1px);
    outline: none;
}

.theme-preset--active {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}


.theme-swatch {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 0.45rem;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--text-dim) 24%, transparent);
}

.theme-swatch--empty {
    background: transparent;
    border: 1px dashed color-mix(in srgb, var(--soft-border-color) 70%, transparent);
    box-shadow: none;
}

.theme-role {
    border: 1px solid color-mix(in srgb, var(--soft-border-color) 40%, transparent);
    border-radius: var(--radius-base);
    background: color-mix(in srgb, var(--bg) 96%, transparent);
    padding: 0.55rem 0.75rem;
}

.palette-chip {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 9999px;
    border: 1px solid color-mix(in srgb, var(--soft-border-color) 70%, transparent);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: transform 150ms ease-out, box-shadow 150ms ease-out, border-color 150ms ease-out;
}

.palette-chip:hover,
.palette-chip:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
    outline: none;
}

.palette-chip--active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent), 0 4px 10px rgba(0, 0, 0, 0.2);
    transform: scale(1.05);
}

.text-theme {
    color: var(--text);
}

.text-theme-dim {
    color: var(--text-dim);
}

.bg-theme-bg {
    background-color: var(--bg);
}

.bg-theme-bg-alt {
    background-color: var(--bg-alt);
}

.bg-accent {
    background-color: var(--accent);
}

.text-bg {
    color: var(--bg);
}

.border-accent {
    border-color: var(--accent);
}

.bg-theme-header-bg {
    background: var(--theme-header-bg, var(--bg-alt));
}

/* === 1984 THEME - Retro Terminal Theme === */
/* Visual effects only - colors are defined in theme.js */

/* Logo with CRT glow */
[data-theme="theme-1984"] .logo,
[data-theme="theme-1984"] .logo-text {
    text-shadow: 0 0 3px var(--text);
}

/* Logo replacement with retro terminal style */
[data-theme="theme-1984"] header a[href="/"] img {
    display: none;
}

[data-theme="theme-1984"] header a[href="/"] .logo-text {
    font-size: 0;
}

[data-theme="theme-1984"] header a[href="/"]::after {
    content: "C:\\> instacalc.exe";
    font-size: 18px;
    display: inline-block;
    text-shadow: 0 0 3px var(--text);
}

[data-theme="theme-1984"] * {
    border-radius: 0 !important;
}

/* Main Calculator Container */
body[data-theme="theme-1984"] div[style*="box-shadow: var(--calc-card-shadow)"] {
    position: relative;
}

/* Global scanline effect on entire page for CRT monitor look */
[data-theme="theme-1984"] body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(transparent 50%, rgba(0, 0, 0, 0.075) 50%);
    background-size: 100% 3px;
    pointer-events: none;
    z-index: 9999;
    animation: scanline 8s linear infinite;
}

/* Scanline effect on calc card */
[data-theme="theme-1984"] div[style*="box-shadow: var(--calc-card-shadow)"]::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 50%, rgba(0, 0, 0, 0.1) 50%);
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 10;
}

/* Scanlines on sidebar panels */
[data-theme="theme-1984"] div[style*="box-shadow: var(--sidebar-card-shadow)"] {
    position: relative;
}

[data-theme="theme-1984"] div[style*="box-shadow: var(--sidebar-card-shadow)"]::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 50%, rgba(0, 0, 0, 0.075) 50%);
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 10;
}

/* CRT glow effect on all text */
[data-theme="theme-1984"] * {
    text-shadow: 0 0 2px color-mix(in srgb, var(--text) 20%, transparent);
}

/* User info */
body[data-theme="theme-1984"] userinfo img {
    filter: grayscale(100%) brightness(150%) contrast(200%);
}

/* Old calc element selector for backwards compatibility */
[data-theme="theme-1984"] calc {
    animation: flicker 0.30s infinite;
}

@keyframes typing {
    from {
        width: 0
    }

    to {
        width: 15ch
    }
}

/* Font Hand (custom handwritten font) styles */
.font-hand calc {
    /* want backup characters for emoji */
    font-family: "InstaCalc", Inter;
}

.font-hand calc c2 {
    font-size: 160%;
}

.font-hand calc c1 {
    font-size: 160%;
}

.font-hand rows row {
    margin-bottom: .5rem;
}

.font-hand calc number {
    font-size: 110%;
}

.font-hand log,
.font-hand parsed {
    font-family: 'Inter';
}

/* ============================================ */
/* MERGED FROM effects.css */
/* ============================================ */

/* CSS Variables are set dynamically by theme.js - no defaults needed here */

/* Theme-light specific overrides for aceternity effects */
body.theme-light {
    --grid-color: rgba(0, 0, 0, 0.02);
    --orb-opacity: 0.3;
}

/* Hide the description editor in CalcToolbar */
calctoolbar>.mb-4 {
    display: none;
}

/* Essential animations */
@keyframes gridMove {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(50px, 50px);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -30px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Background image support (for Omarchy themes) */
body {
    background-image: var(--bg-image, none);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

/* Animated background grid */
.grid-bg {
    background-image:
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
}

/* Gradient orbs */
.orb {
    filter: blur(80px);
    opacity: var(--orb-opacity);
    animation: float 15s ease-in-out infinite;
}

.orb-1 {
    width: 500px;
    height: 500px;
    top: -10%;
    left: -10%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
}

.orb-2 {
    width: 400px;
    height: 400px;
    top: 40%;
    right: -5%;
    background: linear-gradient(135deg, var(--accent-tertiary), var(--accent-secondary));
    animation-delay: 5s;
}

.orb-3 {
    width: 350px;
    height: 350px;
    bottom: -10%;
    left: 30%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    animation-delay: 2s;
}

/* Sidebar visibility (Alpine-controlled) */
.sidebar.collapsed {
    opacity: 0;
    pointer-events: none;
}

.sidebar.collapsed:hover,
.sidebar.collapsed.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Custom scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* ============================================ */
/* MERGED FROM inline styles in index.html */
/* ============================================ */

/* Alpine.js cloak utility */
/* (Note: This was already defined earlier in the file at line 937, keeping for reference) */

/* Calcy AI icon theme-aware color overlay */
.calcy-icon-overlay {
    mix-blend-mode: multiply;
    opacity: 0.7;
}

body.theme-light .calcy-icon-overlay {
    mix-blend-mode: darken;
    opacity: 0.15;
}

/* ============================================ */
/* ALPINE.JS TRANSITION UTILITIES */
/* ============================================ */

/* Panel slide transitions - used by sidebar panels */
.panel-slide-enter {
    @apply transition-all duration-300 ease-out;
}

.panel-slide-enter-start {
    @apply translate-x-8 opacity-0;
}

.panel-slide-enter-end {
    @apply translate-x-0 opacity-100;
}

.panel-slide-leave {
    @apply absolute inset-0 transition-all duration-200 ease-in;
}

.panel-slide-leave-start {
    @apply translate-x-0 opacity-100;
}

.panel-slide-leave-end {
    @apply -translate-x-8 opacity-0;
}

/* Icon spin transitions - used by toggle buttons */
.icon-spin-enter {
    @apply transition-all duration-200 ease-out;
}

.icon-spin-enter-start {
    @apply scale-75 rotate-90 opacity-0;
}

.icon-spin-enter-end {
    @apply scale-100 rotate-0 opacity-100;
}

.icon-spin-leave {
    @apply transition-all duration-150 ease-in;
}

.icon-spin-leave-start {
    @apply scale-100 rotate-0 opacity-100;
}

.icon-spin-leave-end {
    @apply scale-75 -rotate-90 opacity-0;
}

/* Icon spin transitions (reverse direction) */
.icon-spin-reverse-enter {
    @apply transition-all duration-200 ease-out;
}

.icon-spin-reverse-enter-start {
    @apply scale-75 -rotate-90 opacity-0;
}

.icon-spin-reverse-enter-end {
    @apply scale-100 rotate-0 opacity-100;
}

.icon-spin-reverse-leave {
    @apply transition-all duration-150 ease-in;
}

.icon-spin-reverse-leave-start {
    @apply scale-100 rotate-0 opacity-100;
}

.icon-spin-reverse-leave-end {
    @apply scale-75 rotate-90 opacity-0;
}

/* Expand/collapse transitions - used by floating nav */
.expand-collapse-enter {
    transition: all var(--toolbar-close-duration) ease-out;
}

.expand-collapse-enter-start {
    @apply opacity-0 max-w-0;
}

.expand-collapse-enter-end {
    @apply max-w-xs opacity-100;
}

.expand-collapse-leave {
    transition: all var(--toolbar-close-duration) ease-in;
}

.expand-collapse-leave-start {
    @apply max-w-xs opacity-100;
}

.expand-collapse-leave-end {
    @apply opacity-0 max-w-0;
}

/* ============================================ */
/* BOX SHADOW UTILITIES */
/* ============================================ */
/* Note: These utilities are now defined in tailwind.config.js */
/* This ensures responsive variants (lg:, md:, etc.) work correctly */

/* ============================================ */
/* HEADER CARD STYLING */
/* ============================================ */
/* Note: This utility is now defined in tailwind.config.js */

/* ============================================ */
/* COLOR-MIX UTILITIES */
/* ============================================ */

/* Accent color-mix intensity levels (light → medium → heavy → strong) */
:root {
    --accent-mix-light: color-mix(in srgb, var(--accent-primary) 6%, transparent);
    --accent-mix-medium: color-mix(in srgb, var(--accent-primary) 12%, transparent);
    --accent-mix-heavy: color-mix(in srgb, var(--accent-primary) 18%, transparent);
    --accent-mix-strong: color-mix(in srgb, var(--accent-primary) 40%, transparent);

    /* Common bg-secondary color-mix percentages */
    --bg-secondary-mix-40: color-mix(in srgb, var(--bg-secondary) 40%, transparent);

    /* Common calc-card-bg color-mix percentages */
    --calc-card-bg-mix-90: color-mix(in srgb, var(--calc-card-bg) 90%, rgba(15, 20, 40, 0.85));
    --calc-card-bg-mix-92: color-mix(in srgb, var(--calc-card-bg) 92%, rgba(10, 10, 20, 0.75));
}

/* General style for selected calculator rows - highlight only the input/textarea */
row.selected .rowInput,
row.selected .rowTextarea {
    box-shadow: 0 0 0 2px var(--theme-accent, var(--accent-primary, #3b82f6));
    border-radius: var(--radius-base);
}