/* app/assets/css/style.css */
:root {
    --bg-night: #1A1A24;
    --primary-accent: #E88D67;
    --secondary-bg: rgba(42, 42, 53, 0.45);
    --glass-border: rgba(255, 255, 255, 0.15);
    --text-primary: #D3D3DD;
    --success-green: #6B8E23;
    --font-family: 'Nunito', sans-serif;
    --border-radius: 24px;
    --glow-shadow: 0 4px 30px rgba(232, 141, 103, 0.25);
    --day-night-duration: 60s;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body, html {
    width: 100%; height: 100%; overflow: hidden;
    background-color: var(--bg-night);
    font-family: var(--font-family); color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    user-select: none; -webkit-user-select: none;
}

.glow-text {
    font-family: 'Pacifico', cursive;
    font-weight: normal;
    letter-spacing: 1px;
}

/* Modul 1: CSS Particles Background */
#particle-bg {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at 50% 0%, #202030 0%, #1A1A24 100%);
    z-index: 0; pointer-events: none;
}

/* Beautiful Dashboard Day Theme */
.dashboard-daytime {
    background: linear-gradient(135deg, #FFB7B2 0%, #E2F0CB 100%) !important;
}

.scenery-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0; pointer-events: none; overflow: hidden;
}

/* Day/Night Sky Animations */
.sky-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0;
}

.sky-night {
    background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
    animation: cycleNight var(--day-night-duration) infinite;
}
.sky-sunrise {
    background: linear-gradient(180deg, #fb923c 0%, #f472b6 50%, #60a5fa 100%);
    animation: cycleSunrise var(--day-night-duration) infinite;
}
.sky-day {
    background: linear-gradient(180deg, #38bdf8 0%, #bfdbfe 100%);
    animation: cycleDay var(--day-night-duration) infinite;
}
.sky-sunset {
    background: linear-gradient(180deg, #4c1d95 0%, #f43f5e 50%, #f59e0b 100%);
    animation: cycleSunset var(--day-night-duration) infinite;
}

/* Keyframes mapped to 0-100% of 60s cycle, 0% = Midnight */
@keyframes cycleNight {
    0%, 15% { opacity: 1; }
    35%, 65% { opacity: 0; }
    85%, 100% { opacity: 1; }
}

@keyframes cycleSunrise {
    0%, 15% { opacity: 0; }
    25% { opacity: 1; }
    35%, 100% { opacity: 0; }
}

@keyframes cycleDay {
    0%, 20% { opacity: 0; }
    35%, 65% { opacity: 1; }
    80%, 100% { opacity: 0; }
}

@keyframes cycleSunset {
    0%, 65% { opacity: 0; }
    75% { opacity: 1; }
    85%, 100% { opacity: 0; }
}

/* Stars */
.stars-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-image: 
        radial-gradient(1px 1px at 20px 30px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(1px 1px at 40px 70px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(1px 1px at 50px 160px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(1px 1px at 90px 40px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(1.5px 1.5px at 130px 80px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 160px 120px, rgba(255,255,255,0.8), rgba(0,0,0,0));
    background-repeat: repeat;
    background-size: 200px 200px;
    animation: cycleNight var(--day-night-duration) infinite, twinkle 4s ease-in-out infinite alternate;
}

@keyframes twinkle {
    0% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(255,255,255,0.5)); }
    100% { transform: scale(1.02); filter: drop-shadow(0 0 5px rgba(255,255,255,1)); }
}

/* Celestial Orbit (Sun & Moon) */
.celestial-orbit {
    position: absolute;
    top: 100%; /* Position center exactly at the bottom edge of screen */
    left: 50%;
    width: 100vw;
    height: 100vw;
    margin-top: -50vw; /* Center horizontally and vertically at the bottom edge */
    margin-left: -50vw;
    transform-origin: center center;
    animation: orbitRotation var(--day-night-duration) linear infinite;
}

@keyframes orbitRotation {
    from { transform: rotate(180deg); } /* Midnight: Sun is bottom, Moon is top */
    to { transform: rotate(540deg); }
}

/* Because the orbit rotates, we counter-rotate the sun and moon so they stay upright */
.friendly-sun {
    position: absolute; top: 0; left: 50%; margin-left: -60px;
    width: 120px; height: 120px;
    background: radial-gradient(circle, #FFF9C4 0%, #FFD54F 70%, transparent 100%);
    border-radius: 50%; box-shadow: 0 0 80px #FFD54F, 0 0 150px rgba(255, 213, 79, 0.5);
    animation: sunPulse 8s infinite alternate, counterRotation var(--day-night-duration) linear infinite;
}

.beautiful-moon {
    position: absolute; bottom: 0; left: 50%; margin-left: -50px;
    width: 100px; height: 100px;
    background: radial-gradient(circle at 30% 30%, #ffffff 0%, #d4d4dc 60%, #a3a3b1 100%);
    border-radius: 50%; 
    box-shadow: 0 0 60px rgba(255, 255, 255, 0.4), inset -10px -10px 20px rgba(0,0,0,0.2);
    animation: counterRotation var(--day-night-duration) linear infinite;
}

@keyframes counterRotation {
    from { transform: rotate(-180deg); }
    to { transform: rotate(-540deg); }
}

@keyframes sunPulse {
    0% { transform: scale(1) rotate(0deg); opacity: 0.9; }
    100% { transform: scale(1.1) rotate(0deg); opacity: 1; box-shadow: 0 0 100px #FFD54F, 0 0 200px rgba(255, 213, 79, 0.6); }
}

.cloud-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none;
    animation: cycleShade var(--day-night-duration) infinite;
}

.cloud {
    position: absolute; width: 100px; height: 40px;
    background: white; border-radius: 50px; opacity: 0.6;
}
.cloud::before, .cloud::after {
    content: ''; position: absolute; background: white; border-radius: 50%;
}
.cloud::before { width: 50px; height: 50px; top: -25px; left: 15px; }
.cloud::after { width: 30px; height: 30px; top: -15px; left: 60px; }

.cloud-1 { top: 15%; animation: floatCloud 60s linear infinite; }
.cloud-2 { top: 25%; transform: scale(0.7); opacity: 0.4; animation: floatCloud 80s linear infinite -20s; }
.cloud-3 { top: 10%; transform: scale(1.2); opacity: 0.8; animation: floatCloud 100s linear infinite -50s; }

@keyframes floatCloud {
    0% { left: -150px; }
    100% { left: 110vw; }
}

.grass-hill {
    position: absolute; bottom: -10%; width: 150%; height: 40%;
    border-radius: 50% 50% 0 0;
    animation: cycleShade var(--day-night-duration) infinite;
}

@keyframes cycleShade {
    0%, 15% { filter: brightness(0.4) sepia(0.5) hue-rotate(-20deg); } /* Night */
    25% { filter: brightness(0.8) sepia(0.4) hue-rotate(-10deg) saturate(1.2); } /* Sunrise */
    35%, 65% { filter: brightness(1) sepia(0) hue-rotate(0deg) saturate(1); } /* Day */
    75% { filter: brightness(0.7) sepia(0.6) hue-rotate(-15deg) saturate(1.4); } /* Sunset */
    85%, 100% { filter: brightness(0.4) sepia(0.5) hue-rotate(-20deg); } /* Night */
}
.grass-back { left: -20%; background: #9CCC65; z-index: 1; transform: rotate(-5deg); }
.grass-front { left: 5%; bottom: -15%; height: 35%; background: #8BC34A; z-index: 2; transform: rotate(2deg); }

#dashboard-avatar-container {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%; z-index: 3; pointer-events: none;
}
@media (max-width: 768px) {
    #dashboard-avatar-container {
        /* Full screen on mobile too */
    }
}

.dashboard-ui-content {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10; pointer-events: none;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    padding: 20px;
}
.view-panel.active .dashboard-ui-content > * { pointer-events: auto; }

#particle-bg::after {
    content: '';
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-image: radial-gradient(rgba(232, 141, 103, 0.1) 2px, transparent 2px);
    background-size: 100px 100px;
    animation: drift 60s linear infinite;
    opacity: 0.5;
}

@keyframes drift {
    from { background-position: 0 0; }
    to { background-position: 1000px 1000px; }
}

/* 3D Canvas Layer */
#webgl-container {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 1; transition: opacity 1s ease;
}

@keyframes fadeOut {
    to { opacity: 0; pointer-events: none; }
}

/* Modul 3: Bubbles */
#bubble-container {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 20; overflow: hidden;
}

.bubble-rise {
    position: absolute;
    transform: translate(-50%, -100%); /* Center over head */
    background: white; border-radius: 20px; padding: 10px 15px;
    font-size: 1.2rem; box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    animation: bubbleRise 3s ease-out forwards;
    color: black;
    white-space: nowrap;
    max-width: 250px;
    text-overflow: ellipsis;
    overflow: hidden;
}

.avatar-tag {
    position: absolute;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.4);
    color: rgba(255, 255, 255, 0.8);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    pointer-events: none;
    white-space: nowrap;
    border: 1px solid rgba(255,255,255,0.1);
}

.bubble-rise::after {
    content: ''; position: absolute; bottom: -5px; left: 50%; transform: translateX(-50%);
    border-width: 5px 5px 0; border-style: solid; border-color: white transparent transparent transparent;
}

@keyframes bubbleRise {
    0% { transform: translate(-50%, -100%) scale(0); opacity: 0; }
    10% { transform: translate(-50%, -150%) scale(1.2); opacity: 1; }
    20% { transform: translate(-50%, -150%) scale(1); opacity: 1; }
    80% { transform: translate(-50%, -300%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -350%) scale(0.8); opacity: 0; }
}

/* Modul 4: Radial Menu */
#radial-menu {
    position: absolute; z-index: 50;
    width: 200px; height: 200px;
    transform: translate(-50%, -50%);
    pointer-events: none; /* Container is transparent to clicks */
    transition: opacity 0.3s;
}
#radial-menu.hidden {
    opacity: 0;
    pointer-events: none;
}

.radial-item {
    position: absolute;
    width: 40px; height: 40px;
    background: var(--secondary-bg);
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    font-size: 1.2rem; cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
    pointer-events: auto; /* Buttons are clickable */
    transition: transform 0.2s, background 0.2s;
    border: 2px solid rgba(255,255,255,0.1);
}

.radial-item:hover { transform: scale(1.1); background: var(--primary-accent); }

/* Circle Positions (Radius: 80px) */
.radial-item.top { top: 0; left: 80px; }
.radial-item.top-right { top: 23px; left: 137px; }
.radial-item.right { top: 80px; left: 160px; }
.radial-item.bottom-right { top: 137px; left: 137px; }
.radial-item.bottom { top: 160px; left: 80px; }
.radial-item.bottom-left { top: 137px; left: 23px; }
.radial-item.left { top: 80px; left: 0; }
.radial-item.top-left { top: 23px; left: 23px; }

.radial-text-input {
    position: absolute;
    top: 210px; left: 50%;
    transform: translateX(-50%);
    display: flex; gap: 5px;
    pointer-events: auto;
    width: max-content;
}

#radial-custom-text {
    background: rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    outline: none;
    font-size: 0.9rem;
    width: 130px;
    text-align: center;
}

#radial-text-submit {
    background: var(--primary-accent);
    border: none;
    border-radius: 15px;
    color: white;
    padding: 5px 10px;
    cursor: pointer;
    font-weight: bold;
}

#radial-menu.in-cooldown .radial-item {
    filter: grayscale(100%);
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    background: var(--secondary-bg);
}

#radial-menu.in-cooldown #radial-custom-text,
#radial-menu.in-cooldown #radial-text-submit {
    opacity: 0.5;
    cursor: not-allowed;
}

.fade-hidden { opacity: 0; pointer-events: none; }

/* UI Layer */
#ui-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10; pointer-events: none;
}

.view-panel {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    transition: opacity 0.5s ease; padding: 20px;
    pointer-events: none;
}
.view-panel.active > * { pointer-events: auto; }
.view-panel.hidden { opacity: 0; pointer-events: none !important; }

/* Dashboard Specific Layout */
#dashboard-screen { justify-content: space-between; }

.top-bar {
    width: 100%; display: flex; justify-content: space-between; align-items: center;
    padding: 10px 20px;
}

.profile-avatar {
    width: 50px; height: 50px; border-radius: 50%;
    background: var(--secondary-bg); display: flex; justify-content: center; align-items: center;
    box-shadow: var(--glow-shadow); cursor: pointer; transition: transform 0.2s;
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
}
.profile-avatar:active { transform: scale(0.9); }

.settings-gear { font-size: 1.5rem; cursor: pointer; opacity: 0.7; }

/* Living Cards */
.portals-container {
    display: flex; flex-direction: row; justify-content: center; gap: 40px; width: 100%; max-width: 800px;
}

.living-card {
    background: var(--secondary-bg); border-radius: var(--border-radius);
    padding: 40px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 30px;
    width: 240px; height: 260px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    cursor: pointer; transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s, background 0.3s;
    /* Simulate breathing */
    animation: breathe 4s infinite alternate ease-in-out;
}

.living-card:nth-child(2) { animation-delay: -1s; }
.living-card:nth-child(3) { animation-delay: -2s; }

.living-card:hover { background: rgba(60, 60, 75, 0.55); }
.living-card:active { transform: scale(0.95); }

@keyframes breathe {
    0% { transform: translateY(0); }
    100% { transform: translateY(-5px); }
}

.card-visual {
    width: 90px; height: 90px; border-radius: 50%;
    display: flex; justify-content: center; align-items: center; font-size: 3.5rem;
    background: rgba(0,0,0,0.3); box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
}

.living-card h3 {
    font-size: 1.4rem;
    text-align: center;
    font-weight: 700;
}

.fire-visual { color: var(--primary-accent); text-shadow: 0 0 10px var(--primary-accent); }

/* Bottom Tracker */
.bottom-tracker {
    width: 100%; background: var(--secondary-bg);
    border-radius: 30px; padding: 15px;
    display: flex; flex-direction: column; align-items: center;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.3);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    cursor: pointer; pointer-events: auto;
}

.tracker-handle { width: 40px; height: 4px; background: rgba(255,255,255,0.2); border-radius: 2px; margin-top: 10px; }
.garden-preview { display: flex; gap: 10px; font-size: 1.2rem; }

/* Modul 2: Mirror */
.mirror-layout {
    width: 100%; height: 100%; display: flex; flex-direction: column; max-width: 1200px; margin: 0 auto;
}
.mirror-preview {
    flex: 1; background: var(--secondary-bg); border-radius: var(--border-radius);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    margin-bottom: 20px; position: relative; min-height: 40vh;
    overflow: hidden; /* Clips the canvas so it never bleeds out of the box */
}
.mirror-controls { flex: 1; width: 100%; max-width: 400px; margin: 0 auto; }

@media (min-width: 768px) {
    .mirror-layout {
        flex-direction: row; gap: 40px; align-items: center; justify-content: center;
    }
    .mirror-preview {
        flex: 1.5; margin-bottom: 0; height: 70vh;
    }
    .mirror-controls {
        flex: 1; margin: 0; max-width: 450px;
    }
}

.control-group {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;
}
select {
    background: rgba(0,0,0,0.2); color: white; border: none; padding: 10px; border-radius: 10px; outline: none;
}

/* Custom Color Picker */
.custom-color-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    width: 140px;
}
.color-swatch {
    width: 25px; height: 25px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: white; transform: scale(1.15); }

/* Mood Assembler */
.mood-preview-box {
    font-size: 4rem; text-align: center; margin-bottom: 20px;
    filter: drop-shadow(0 0 20px rgba(232, 141, 103, 0.4));
}
.mood-grid {
    display: flex; gap: 10px; justify-content: center;
}
.mood-tile {
    width: 60px; height: 60px; font-size: 2rem;
    background: rgba(0,0,0,0.3); border-radius: 16px;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer; transition: all 0.2s; border: 2px solid transparent;
}
.mood-tile:hover { transform: scale(1.1); background: rgba(0,0,0,0.5); }
.mood-tile.active { border-color: var(--primary-accent); background: rgba(232, 141, 103, 0.2); }

/* Base UI */
.card {
    background-color: var(--secondary-bg); border-radius: var(--border-radius);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    padding: 30px; width: 100%; max-width: 350px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3); display: flex; flex-direction: column; gap: 15px;
}

.glow-text { font-size: 2.5rem; font-weight: 800; color: var(--primary-accent); text-shadow: 0 2px 8px rgba(0,0,0,0.4), var(--glow-shadow); margin-bottom: 5px; text-align:center; }
.subtitle { font-size: 1.1rem; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,0.6); opacity: 0.95; margin-bottom: 30px; text-align:center; font-weight: 600; }

input {
    background-color: rgba(0,0,0,0.2); border: none; border-radius: 12px;
    padding: 15px; color: var(--text-primary); font-family: var(--font-family);
    font-size: 1rem; outline: none; user-select: auto; -webkit-user-select: auto;
}

select {
    background-color: rgba(0,0,0,0.4); 
    border: 1px solid rgba(255,255,255,0.15); 
    color: white;
    padding: 12px 15px;
    border-radius: 12px;
    outline: none;
    font-family: var(--font-family);
    font-size: 1rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg fill='white' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
    background-repeat: no-repeat;
    background-position-x: 95%;
    background-position-y: center;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    width: 60%;
    margin-left: 15px;
}
select:focus { box-shadow: inset 0 0 0 2px var(--primary-accent); border-color: transparent; }
select option {
    background-color: #2b2b2b; /* Dark theme for dropdown items */
    color: #ffffff;
    font-size: 1rem;
    padding: 10px;
}
input:focus { box-shadow: inset 0 0 0 2px var(--primary-accent); }

button {
    font-family: var(--font-family); font-size: 1rem; font-weight: 600;
    padding: 15px; border-radius: 16px; border: none; cursor: pointer;
    transition: transform 0.2s ease; min-height: 44px;
}
button:active { transform: scale(0.95); }
.btn-primary { background-color: var(--primary-accent); color: #fff; box-shadow: var(--glow-shadow); }
.btn-secondary { background-color: transparent; color: var(--text-primary); border: 2px solid rgba(255,255,255,0.1); }
.error-msg { color: #ff6b6b; font-size: 0.9rem; text-align: center; min-height: 20px; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.error-shake {
    animation: shake 0.3s ease-in-out;
    border-color: #ff5555 !important;
}

.input-error {
    border: 1px solid #ff5555 !important;
    background: rgba(255,85,85,0.1) !important;
}