/* ==========================================================================
   mujun.work — Frutiger-Aero Productivity Dashboard
   Colors: Triadic — #4A90D0, #D08A4A, #4AD08A
   Fonts: Exo 2, Inter, JetBrains Mono
   ========================================================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    line-height: 1.75;
    font-size: clamp(0.9rem, 1.5vw, 1rem);
    color: #4A5A6A;
    background: linear-gradient(160deg, #F0F4F8 0%, #E0E8F0 100%);
}

h1, h2 {
    font-family: 'Exo 2', sans-serif;
    color: #2A3A50;
}

h1 {
    font-weight: 600;
    letter-spacing: 0.01em;
    font-size: clamp(1.8rem, 4vw, 3rem);
}

h2 {
    font-weight: 500;
    letter-spacing: 0em;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
}

/* --- Geometric Background Shapes --- */
.geo-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.geo-circle {
    position: absolute;
    border-radius: 50%;
    opacity: 0.07;
}

.geo-circle-1 {
    width: 80px;
    height: 80px;
    background: #4A90D0;
    top: 10%;
    left: 20%;
    animation: geoFloat1 34s ease-in-out infinite;
}

.geo-circle-2 {
    width: 50px;
    height: 50px;
    background: #D08A4A;
    top: 30%;
    left: 60%;
    animation: geoFloat2 38s ease-in-out infinite;
}

.geo-circle-3 {
    width: 70px;
    height: 70px;
    background: #4AD08A;
    top: 60%;
    left: 35%;
    animation: geoFloat3 32s ease-in-out infinite;
}

.geo-circle-4 {
    width: 40px;
    height: 40px;
    background: #4A90D0;
    top: 80%;
    left: 75%;
    animation: geoFloat1 40s ease-in-out infinite reverse;
}

.geo-circle-5 {
    width: 60px;
    height: 60px;
    background: #D08A4A;
    top: 15%;
    left: 80%;
    animation: geoFloat2 36s ease-in-out infinite;
}

.geo-circle-6 {
    width: 30px;
    height: 30px;
    background: #4AD08A;
    top: 50%;
    left: 10%;
    animation: geoFloat3 42s ease-in-out infinite reverse;
}

.geo-circle-7 {
    width: 55px;
    height: 55px;
    background: #8AB0D0;
    top: 75%;
    left: 45%;
    animation: geoFloat1 30s ease-in-out infinite;
}

.geo-circle-8 {
    width: 25px;
    height: 25px;
    background: #4A90D0;
    top: 40%;
    left: 90%;
    animation: geoFloat2 35s ease-in-out infinite reverse;
}

@keyframes geoFloat1 {
    0%, 100% { transform: translateY(0) translateX(0); }
    33% { transform: translateY(-30px) translateX(15px); }
    66% { transform: translateY(20px) translateX(-10px); }
}

@keyframes geoFloat2 {
    0%, 100% { transform: translateY(0) translateX(0); }
    33% { transform: translateY(25px) translateX(-20px); }
    66% { transform: translateY(-35px) translateX(10px); }
}

@keyframes geoFloat3 {
    0%, 100% { transform: translateY(0) translateX(0); }
    33% { transform: translateY(-20px) translateX(-15px); }
    66% { transform: translateY(30px) translateX(20px); }
}

/* --- Dashboard Grid --- */
.dashboard {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 64px 1fr;
    grid-template-rows: 56px 1fr;
    grid-template-areas:
        "topbar topbar"
        "rail main";
    height: 100vh;
    overflow: hidden;
}

/* --- Top Bar — Glossy Horizon --- */
.topbar {
    grid-area: topbar;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    background: linear-gradient(180deg, rgba(255,255,255,0.9) 0%, rgba(240,245,250,0.8) 100%);
    border-bottom: 1px solid rgba(0,0,0,0.08);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
    z-index: 10;
}

.topbar-domain {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    color: #2A3A50;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: #6A8A8A;
    letter-spacing: 0.05em;
    margin-left: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot-blue {
    background: #4A90D0;
    animation: dotPulse 3s ease-in-out infinite;
}

.status-dot-orange {
    background: #D08A4A;
    animation: dotPulse 3s ease-in-out infinite 1s;
}

.status-dot-green {
    background: #4AD08A;
    animation: dotPulse 3s ease-in-out infinite 2s;
}

@keyframes dotPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* --- Navigation Rail — Aero Dock --- */
.rail {
    grid-area: rail;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding-top: 20px;
    background: linear-gradient(180deg, rgba(240,244,248,0.6) 0%, rgba(224,232,240,0.4) 100%);
    border-right: 1px solid rgba(0,0,0,0.06);
    z-index: 5;
}

.rail-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0.2) 100%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    color: #4A5A6A;
    cursor: pointer;
    transition: all 0.3s ease;
}

.rail-icon:hover {
    background: linear-gradient(180deg, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0.4) 100%);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.rail-icon.active {
    color: #4A90D0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 0 12px rgba(74,144,208,0.3);
    border-color: rgba(74,144,208,0.3);
}

/* --- Main Widget Grid --- */
.main-grid {
    grid-area: main;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 20px;
    padding: 20px;
    overflow-y: auto;
}

/* --- Glass Widget Panel --- */
.widget {
    background: linear-gradient(135deg, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0.3) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.8);
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    will-change: transform;
    overflow: hidden;
    position: relative;
}

/* --- Widget Header with HUD Elements --- */
.widget-header {
    position: relative;
    padding-bottom: 14px;
    margin-bottom: 16px;
}

.widget-header-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.widget-header-content h2 {
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* HUD Brackets */
.hud-bracket {
    position: absolute;
    width: 14px;
    height: 14px;
}

.hud-bracket-tl {
    top: 0;
    left: -4px;
    border-top: 2px solid #8AB0D0;
    border-left: 2px solid #8AB0D0;
}

.hud-bracket-tr {
    top: 0;
    right: -4px;
    border-top: 2px solid #8AB0D0;
    border-right: 2px solid #8AB0D0;
}

/* HUD Status Dots */
.hud-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.hud-dot-blue {
    background: #4A90D0;
    animation: hudBlink 2.5s ease-in-out infinite;
}

.hud-dot-orange {
    background: #D08A4A;
    animation: hudBlink 2.5s ease-in-out infinite 0.5s;
}

.hud-dot-green {
    background: #4AD08A;
    animation: hudBlink 2.5s ease-in-out infinite 1s;
}

@keyframes hudBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* HUD Underline Animation */
.hud-underline {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 1px;
    width: 100%;
    transform: scaleX(0);
    transform-origin: left;
    animation: hudTrace 1.2s ease-out forwards;
}

.hud-underline-blue {
    background: #4A90D0;
}

.hud-underline-orange {
    background: #D08A4A;
}

.hud-underline-green {
    background: #4AD08A;
}

@keyframes hudTrace {
    0% { transform: scaleX(0); }
    100% { transform: scaleX(1); }
}

/* --- Widget Body --- */
.widget-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.widget-body p {
    color: #4A5A6A;
    margin-bottom: 16px;
    line-height: 1.75;
}

.widget-metric {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.metric-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: #6A8A8A;
    text-transform: uppercase;
}

.metric-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.4rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    color: #2A3A50;
}

/* --- Row-specific triadic colors for HUD brackets --- */
.widget-row1 .hud-bracket-tl,
.widget-row1 .hud-bracket-tr {
    border-color: #4A90D0;
}

.widget-row2 .hud-bracket-tl,
.widget-row2 .hud-bracket-tr {
    border-color: #D08A4A;
}

.widget-row2:last-child .hud-bracket-tl,
.widget-row2:last-child .hud-bracket-tr {
    border-color: #4AD08A;
}

/* --- Void Widget --- */
.widget-void {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.void-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.2rem;
    color: #8AB0D0;
    opacity: 0.6;
    letter-spacing: 0.3em;
}

/* --- Mobile Bottom Tabs --- */
.mobile-tabs {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: linear-gradient(0deg, rgba(255,255,255,0.95) 0%, rgba(240,245,250,0.9) 100%);
    border-top: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
    z-index: 20;
    align-items: center;
    justify-content: space-around;
}

.mobile-tab {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: #4A5A6A;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-tab.active {
    color: #4A90D0;
    background: rgba(74,144,208,0.1);
}

/* --- Staggered Widget Entrance --- */
.widget {
    opacity: 0;
    transform: translateY(20px);
    animation: widgetEnter 0.6s ease-out forwards;
}

.widget:nth-child(1) { animation-delay: 0.1s; }
.widget:nth-child(2) { animation-delay: 0.2s; }
.widget:nth-child(3) { animation-delay: 0.3s; }
.widget:nth-child(4) { animation-delay: 0.4s; }
.widget:nth-child(5) { animation-delay: 0.5s; }
.widget:nth-child(6) { animation-delay: 0.6s; }

@keyframes widgetEnter {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* HUD underline also staggered */
.widget:nth-child(1) .hud-underline { animation-delay: 0.5s; }
.widget:nth-child(2) .hud-underline { animation-delay: 0.6s; }
.widget:nth-child(3) .hud-underline { animation-delay: 0.7s; }
.widget:nth-child(4) .hud-underline { animation-delay: 0.8s; }
.widget:nth-child(5) .hud-underline { animation-delay: 0.9s; }
.widget:nth-child(6) .hud-underline { animation-delay: 1.0s; }

/* Ensure underline starts invisible before its delay */
.hud-underline {
    transform: scaleX(0);
}

/* --- Responsive: Mobile --- */
@media (max-width: 768px) {
    .dashboard {
        grid-template-columns: 1fr;
        grid-template-rows: 56px 1fr;
        grid-template-areas:
            "topbar"
            "main";
    }

    .rail {
        display: none;
    }

    .mobile-tabs {
        display: flex;
    }

    .main-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        gap: 16px;
        padding: 16px;
        padding-bottom: 72px;
        overflow-y: auto;
    }

    .widget-header-content h2 {
        font-size: 1rem;
    }
}

/* --- Scrollbar Styling --- */
.main-grid::-webkit-scrollbar {
    width: 6px;
}

.main-grid::-webkit-scrollbar-track {
    background: transparent;
}

.main-grid::-webkit-scrollbar-thumb {
    background: rgba(74,90,106,0.2);
    border-radius: 3px;
}

.main-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(74,90,106,0.35);
}
