/* ═══════════════════════════════════════════════════════════════════════
   BİMS ERP — NEVŞEHİR POMZA & BİMS ÜRETİM YÖNETİM SİSTEMİ
   Shared Stylesheet — Premium Industrial Command Center Theme
   ═══════════════════════════════════════════════════════════════════════ */

* { font-family: 'Inter', system-ui, sans-serif; }

html { scroll-behavior: smooth; }

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: #334155; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ═══════════════════════════════════════════════════════════
   BASE — Ambient factory background texture
   ═══════════════════════════════════════════════════════════ */
.factory-bg {
    background-color: #F1F5F9;
    background-image:
        radial-gradient(circle at 12% 8%,  rgba(37,99,235,.05), transparent 42%),
        radial-gradient(circle at 88% 92%, rgba(16,185,129,.045), transparent 45%),
        radial-gradient(circle at 50% 50%, rgba(99,102,241,.03), transparent 60%);
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR — Responsive (fixed, slides in on mobile)
   ═══════════════════════════════════════════════════════════ */
#mainSidebar {
    transform: translateX(-100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(180deg, #0B1224 0%, #0F172A 45%, #0B1224 100%);
}
@media (min-width: 1024px) {
    #mainSidebar { transform: translateX(0) !important; }
}
.main-content { margin-left: 0; }
@media (min-width: 1024px) {
    .main-content { margin-left: 252px; }
}

.sidebar-section-label {
    display: block;
    font-size: 9.5px;
    letter-spacing: 0.12em;
    font-weight: 700;
    color: #45536e;
    text-transform: uppercase;
    padding: 12px 14px 5px;
    user-select: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 9px;
    cursor: pointer;
    transition: background .16s, transform .16s;
    border-left: 2px solid transparent;
    text-decoration: none;
    width: 100%;
    background: none;
    border-top: none;
    border-right: none;
    border-bottom: none;
    text-align: left;
    position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.055); }
.nav-item:hover .nav-label { color: #fff; }
.nav-item:hover .nav-icon  { color: #cbd5e1; }

.nav-active {
    background: linear-gradient(135deg, rgba(37,99,235,0.32) 0%, rgba(16,185,129,0.12) 100%) !important;
    border-left-color: #3b82f6 !important;
    box-shadow: inset 0 0 0 1px rgba(59,130,246,.25);
}
.nav-active .nav-label { color: #ffffff !important; font-weight: 700 !important; }
.nav-active .nav-icon  { color: #60a5fa !important; filter: drop-shadow(0 0 6px rgba(96,165,250,.8)); }

.nav-label { font-size: 13px; font-weight: 500; color: #94a3b8; transition: color .14s; white-space: nowrap; }
.nav-icon  { width: 16px; height: 16px; flex-shrink: 0; color: #4b5b78; transition: color .14s, filter .14s; }

.sub-item {
    display: flex; align-items: center; gap: 10px; padding: 7px 12px;
    border-radius: 8px; cursor: pointer; transition: background .14s;
    text-decoration: none; border-left: 2px solid transparent;
}
.sub-item:hover { background: rgba(255,255,255,0.045); }
.sub-item:hover .sub-label { color: #e2e8f0; }
.sub-item:hover .sub-dot   { background: #60a5fa; }
.sub-item.nav-active {
    background: linear-gradient(135deg, rgba(37,99,235,0.22) 0%, rgba(16,185,129,0.10) 100%) !important;
    border-left-color: #3b82f6 !important;
}
.sub-item.nav-active .sub-label { color: #fff !important; font-weight: 600; }
.sub-item.nav-active .sub-dot { background: #60a5fa !important; box-shadow: 0 0 0 3px rgba(96,165,250,0.22); }
.nav-item.parent-active { background: rgba(255,255,255,0.05); }
.nav-item.parent-active .nav-label { color: #e2e8f0; }
.nav-item.parent-active .nav-icon  { color: #60a5fa; }
.sub-label { font-size: 12.5px; font-weight: 500; color: #64748b; transition: color .14s; }
.sub-dot { width: 5px; height: 5px; border-radius: 50%; background: #334155; flex-shrink: 0; margin-left: 4px; transition: background .14s; }

.dd-body { max-height: 0; overflow: hidden; transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.dd-body.open { max-height: 640px; }
.chevron { transition: transform 0.22s ease; }
.chevron.open { transform: rotate(180deg); }

.topbar-shadow { box-shadow: 0 1px 0 0 #e2e8f0, 0 2px 14px -4px rgba(15,23,42,0.07); }

.ai-drawer { transform: translateX(100%); transition: transform 0.36s cubic-bezier(0.4, 0, 0.2, 1); }
.ai-drawer.open { transform: translateX(0); }
.drawer-shadow { box-shadow: -10px 0 44px -4px rgba(15,23,42,0.16); }

.backdrop { opacity: 0; pointer-events: none; transition: opacity 0.28s ease; }
.backdrop.open { opacity: 1; pointer-events: all; }
.mob-overlay { opacity: 0; pointer-events: none; transition: opacity 0.28s ease; }
.mob-overlay.open { opacity: 1; pointer-events: all; }

/* ═══════════════════════════════════════════════════════════
   CORE ANIMATIONS
   ═══════════════════════════════════════════════════════════ */
@keyframes pulse-dot { 0%,100%{opacity:1;transform:scale(1);} 50%{opacity:.5;transform:scale(.72);} }
.pulse-dot { animation: pulse-dot 1.8s ease-in-out infinite; }

@keyframes bounce-dot { 0%,80%,100%{transform:translateY(0);opacity:.4;} 40%{transform:translateY(-5px);opacity:1;} }
.bounce-1 { animation: bounce-dot 1.2s infinite 0ms; }
.bounce-2 { animation: bounce-dot 1.2s infinite 180ms; }
.bounce-3 { animation: bounce-dot 1.2s infinite 360ms; }

@keyframes livepulse { 0%,100%{opacity:1;} 50%{opacity:.25;} }
.live-pulse { animation: livepulse 1.5s ease-in-out infinite; }

@keyframes fadeUp { from{opacity:0;transform:translateY(10px);} to{opacity:1;transform:translateY(0);} }
.dash-anim { animation: fadeUp .5s cubic-bezier(.16,1,.3,1) both; }

@keyframes glowRing {
    0%,100% { box-shadow: 0 0 0 0 rgba(59,130,246,.35); }
    50%      { box-shadow: 0 0 0 8px rgba(59,130,246,0); }
}
.glow-ring { animation: glowRing 2.2s ease-out infinite; }

@keyframes glowRingEmerald {
    0%,100% { box-shadow: 0 0 0 0 rgba(16,185,129,.4); }
    50%      { box-shadow: 0 0 0 8px rgba(16,185,129,0); }
}
.glow-ring-emerald { animation: glowRingEmerald 2s ease-out infinite; }

@keyframes glowRingRed {
    0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,.45); }
    50%      { box-shadow: 0 0 0 9px rgba(239,68,68,0); }
}
.glow-ring-red { animation: glowRingRed 1.1s ease-out infinite; }

@keyframes shimmer {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}
.shimmer-line {
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.55) 50%, rgba(255,255,255,0) 100%);
    background-size: 400px 100%;
    animation: shimmer 2.6s linear infinite;
}

@keyframes floaty { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-6px);} }
.floaty { animation: floaty 4.5s ease-in-out infinite; }

@keyframes breathe { 0%,100%{ transform:scale(1); opacity:1;} 50%{ transform:scale(1.035); opacity:.92;} }
.breathe { animation: breathe 3.2s ease-in-out infinite; }

@keyframes spinSlow { from{transform:rotate(0deg);} to{transform:rotate(360deg);} }
.spin-slow { animation: spinSlow 6s linear infinite; }
.spin-slow-rev { animation: spinSlow 9s linear infinite reverse; }

@keyframes rise { from{ height:0; } }
.rise-anim { animation: rise 1.1s cubic-bezier(.16,1,.3,1) both; }

@keyframes tickerScroll { from{ transform: translateX(0);} to{ transform: translateX(-50%);} }
.ticker-track { animation: tickerScroll 26s linear infinite; }
.ticker-track:hover { animation-play-state: paused; }

/* ═══════════════════════════════════════════════════════════
   GLASS / PREMIUM CARD SYSTEM
   ═══════════════════════════════════════════════════════════ */
.glass-dark {
    background: linear-gradient(155deg, rgba(15,23,42,.92) 0%, rgba(20,30,55,.88) 100%);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255,255,255,.08);
}
.glass-light {
    background: rgba(255,255,255,.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(226,232,240,.7);
}
.grad-border {
    position: relative;
    border-radius: 20px;
}
.grad-border::before {
    content: '';
    position: absolute; inset: 0; border-radius: inherit; padding: 1px;
    background: linear-gradient(135deg, rgba(59,130,246,.55), rgba(99,102,241,.15), rgba(16,185,129,.4));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    pointer-events: none;
}
.premium-card {
    transition: transform .25s cubic-bezier(.16,1,.3,1), box-shadow .25s, border-color .25s;
}
.premium-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 46px -12px rgba(15,23,42,.16);
}

.noise-overlay {
    position: absolute; inset: 0; opacity: .05; pointer-events: none; mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* speed / tabular numbers */
.speedmono { font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* ═══════════════════════════════════════════════════════════
   KPI SPARK BARS
   ═══════════════════════════════════════════════════════════ */
.spark-bar { transition: height .6s cubic-bezier(.16,1,.3,1); }

/* ═══════════════════════════════════════════════════════════
   MACHINE STATUS LIGHT
   ═══════════════════════════════════════════════════════════ */
.status-light { position: relative; }
.status-light::after {
    content: ''; position: absolute; inset: -4px; border-radius: 50%;
    border: 1px solid currentColor; opacity: .5; animation: statusRing 1.8s ease-out infinite;
}
@keyframes statusRing { 0%{ transform:scale(.6); opacity:.6;} 100%{ transform:scale(1.9); opacity:0;} }

/* ═══════════════════════════════════════════════════════════
   DIGITAL TWIN — CSS 3D ISOMETRIC FACTORY SCENE
   ═══════════════════════════════════════════════════════════ */
.twin-stage {
    perspective: 1900px;
    perspective-origin: 50% 20%;
}
.twin-scene {
    transform-style: preserve-3d;
    transform: rotateX(52deg) rotateZ(-38deg);
    transition: transform .6s ease;
}
.twin-floor {
    background-image:
        linear-gradient(rgba(96,165,250,.16) 1px, transparent 1px),
        linear-gradient(90deg, rgba(96,165,250,.16) 1px, transparent 1px);
    background-size: 40px 40px;
    background-color: #101c36;
    box-shadow: inset 0 0 120px rgba(0,0,0,.55);
}
.twin-block {
    transform-style: preserve-3d;
    position: absolute;
    transition: transform .25s ease, filter .25s ease;
}
.twin-block:hover { filter: brightness(1.18); }
.twin-face {
    position: absolute; inset: 0;
    border: 1px solid rgba(255,255,255,.08);
}
.twin-hotspot {
    position: absolute;
    width: 22px; height: 22px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transform: rotateZ(38deg) rotateX(-52deg);
    z-index: 30;
}
.twin-hotspot .hs-core {
    width: 9px; height: 9px; border-radius: 50%; background: #34D399;
    box-shadow: 0 0 0 4px rgba(52,211,153,.25);
}
.twin-hotspot.warn .hs-core { background: #F59E0B; box-shadow: 0 0 0 4px rgba(245,158,11,.28); }
.twin-hotspot.crit .hs-core { background: #EF4444; box-shadow: 0 0 0 4px rgba(239,68,68,.3); }
.twin-hotspot:hover .hs-core { transform: scale(1.35); }

@keyframes conveyorMove { from{ background-position: 0 0; } to{ background-position: -48px 0; } }
.conveyor-belt {
    background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.55) 0 6px, transparent 6px 24px);
    animation: conveyorMove .9s linear infinite;
}

@keyframes truckDrive { from{ transform: translateX(0);} to{ transform: translateX(220px);} }
.truck-anim { animation: truckDrive 9s linear infinite; }

@keyframes forkliftDrive {
    0%   { transform: translate(0,0) rotate(0deg); }
    25%  { transform: translate(90px,0) rotate(0deg); }
    50%  { transform: translate(90px,60px) rotate(90deg); }
    75%  { transform: translate(0,60px) rotate(180deg); }
    100% { transform: translate(0,0) rotate(180deg); }
}
.forklift-anim { animation: forkliftDrive 12s ease-in-out infinite; }

@keyframes robotArmSwing {
    0%,100% { transform: rotate(-18deg); }
    50%      { transform: rotate(18deg); }
}
.robot-arm { transform-origin: bottom center; animation: robotArmSwing 2.4s ease-in-out infinite; }

@keyframes siloFillPulse { 0%,100%{ opacity:1;} 50%{ opacity:.75;} }
.silo-fill { animation: siloFillPulse 3s ease-in-out infinite; }

/* Twin inline expandable detail (accordion-style, no floating-position math) */
.twin-detail-body { max-height: 0; overflow: hidden; transition: max-height .32s cubic-bezier(.4,0,.2,1); }
.twin-detail-body.open { max-height: 640px; }
.twin-detail-chev { transition: transform .22s ease; }
.twin-detail-chev.open { transform: rotate(180deg); }
.twin-zone-card { transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; cursor: pointer; }
.twin-zone-card:hover { transform: translateY(-2px); }
.twin-flow-arrow { position: relative; overflow: hidden; }

/* ═══════════════════════════════════════════════════════════
   AI PANEL — "ERA AI" Factory Brain
   ═══════════════════════════════════════════════════════════ */
.era-avatar {
    background: conic-gradient(from 180deg, #2563EB, #7C3AED, #10B981, #2563EB);
    animation: spinSlow 5s linear infinite;
}
.era-avatar-core {
    background: radial-gradient(circle at 35% 30%, #1E293B, #0B1224 70%);
}
.era-msg { animation: fadeUp .45s cubic-bezier(.16,1,.3,1) both; }
.era-typing span {
    width: 5px; height: 5px; border-radius: 50%; background: #94a3b8; display: inline-block;
    animation: bounce-dot 1.2s infinite;
}
.era-typing span:nth-child(2){ animation-delay:.18s; }
.era-typing span:nth-child(3){ animation-delay:.36s; }

.insight-card {
    border-left: 3px solid transparent;
    transition: border-color .2s, background .2s, transform .2s;
}
.insight-card:hover { transform: translateX(2px); }

/* ═══════════════════════════════════════════════════════════
   GAUGE (SCADA)
   ═══════════════════════════════════════════════════════════ */
.gauge-ring { transition: stroke-dashoffset 1s cubic-bezier(.16,1,.3,1); }

/* ═══════════════════════════════════════════════════════════
   ALARM TICKER
   ═══════════════════════════════════════════════════════════ */
@keyframes alarmBlinkBg {
    0%,100% { background-color: rgba(239,68,68,.06); }
    50%      { background-color: rgba(239,68,68,.14); }
}
.alarm-row-crit { animation: alarmBlinkBg 1.6s ease-in-out infinite; }

/* Notification slide-in */
@keyframes notifIn { from{ opacity:0; transform: translateY(-8px) scale(.97);} to{ opacity:1; transform: translateY(0) scale(1);} }
.notif-in { animation: notifIn .4s cubic-bezier(.16,1,.3,1) both; }

/* map pin ping */
@keyframes mapPing { 0%{ transform:scale(1); opacity:.7;} 100%{ transform:scale(2.4); opacity:0;} }
.map-ping::after {
    content:''; position:absolute; inset:0; border-radius:50%;
    background: inherit; animation: mapPing 1.8s ease-out infinite;
}

/* Counter roll */
.counter-roll { transition: all .4s cubic-bezier(.16,1,.3,1); }
