/* Hero Animation V12 - "The Ecosystem Pulse" */
/* A premium, high-fidelity dashboard visualization with dynamic depth */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --status-green: #10B981;
    --status-red: #EF4444;
    --status-orange: #F59E0B;
    --status-blue: #3B82F6;
    
    --bg-window: rgba(15, 23, 42, 0.95);
    --bg-panel: rgba(30, 41, 59, 0.8);
    --bg-card: rgba(51, 65, 85, 0.4);
    --border: rgba(255, 255, 255, 0.1);
    
    --text-primary: #F8FAFC;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;
    
    --font: 'Inter', system-ui, -apple-system, sans-serif;
}

.living-grid-container {
    position: relative;
    width: 100%;
    height: 750px;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 2000px;
    overflow: visible;
}

/* Ambient Pulse Background */
.mesh-gradient {
    position: absolute;
    width: 140%;
    height: 140%;
    top: -20%;
    left: -20%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(16, 185, 129, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(59, 130, 246, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0) 0%, rgba(5, 31, 61, 1) 100%);
    filter: blur(60px);
    animation: pulse-bg 15s ease-in-out infinite alternate;
    z-index: 0;
}

@keyframes pulse-bg {
    0% { transform: scale(1) translate(0, 0); opacity: 0.8; }
    100% { transform: scale(1.1) translate(2%, 2%); opacity: 1; }
}

/* Floating Data Particles */
.data-particles {
    position: absolute;
    inset: -100px;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--status-green);
    border-radius: 50%;
    filter: blur(1px) drop-shadow(0 0 8px var(--status-green));
    opacity: 0;
    animation: particle-float 8s infinite linear;
}

@keyframes particle-float {
    0% { transform: translate(var(--x1), var(--y1)) scale(0); opacity: 0; }
    20% { opacity: 0.6; }
    80% { opacity: 0.6; }
    100% { transform: translate(var(--x2), var(--y2)) scale(1); opacity: 0; }
}

/* The Dashboard Window - Enhanced 3D */
.dashboard-frame {
    position: relative;
    width: 800px;
    height: 520px;
    transform: rotateX(10deg) rotateY(-8deg) rotateZ(1deg);
    transform-style: preserve-3d;
    z-index: 10;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.dashboard-frame:hover {
    transform: rotateX(5deg) rotateY(-3deg) rotateZ(0deg) scale(1.02);
}

.frame-chrome {
    position: absolute;
    inset: 0;
    background: var(--bg-window);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 
        0 40px 80px -15px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Scanning Effect */
.frame-chrome::before {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(16, 185, 129, 0.03), transparent);
    transform: skewX(-25deg);
    animation: scan-line 8s infinite linear;
    z-index: 5;
    pointer-events: none;
}

@keyframes scan-line {
    0% { left: -150%; }
    40%, 100% { left: 150%; }
}

/* Title Bar */
.frame-titlebar {
    display: flex;
    align-items: center;
    height: 48px;
    padding: 0 20px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border);
}

.traffic-lights {
    display: flex;
    gap: 8px;
}
.traffic-light {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.tl-red { background: #FF5F57; box-shadow: 0 0 5px rgba(255, 95, 87, 0.4); }
.tl-yellow { background: #FEBC2E; box-shadow: 0 0 5px rgba(254, 188, 46, 0.4); }
.tl-green { background: #28C840; box-shadow: 0 0 5px rgba(40, 200, 64, 0.4); }

.frame-title {
    flex: 1;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Layout */
.grid-body {
    display: grid;
    grid-template-columns: 200px 1fr;
    flex: 1;
}

/* Sidebar */
.grid-sidebar {
    background: rgba(0, 0, 0, 0.15);
    border-right: 1px solid var(--border);
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-item.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--status-green);
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.2) inset;
}

/* Main Content */
.grid-main {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0) 0%, rgba(30, 41, 59, 0.5) 100%);
}

/* Stats */
.stats-bar {
    display: flex;
    gap: 16px;
}

.stat-card {
    flex: 1;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: translateX(-100%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    100% { transform: translateX(100%); }
}

.stat-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.stat-value.green { color: var(--status-green); filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.3)); }
.stat-value.orange { color: var(--status-orange); }

/* Employee Grid */
.employee-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.emp-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.3s ease;
}

.emp-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(51, 65, 85, 0.6);
    transform: translateY(-2px);
}

.emp-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.emp-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #334155, #1e293b);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    border: 1px solid var(--border);
}

.emp-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.emp-role {
    font-size: 11px;
    color: var(--text-muted);
}

.emp-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 100px;
    width: fit-content;
    position: relative;
    z-index: 2;
}

/* Progress Indicators */
.stat-progress, .emp-progress {
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    margin-top: 12px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--status-green), #34D399);
    border-radius: 2px;
    transition: width 1s ease-in-out;
}

.progress-fill.animating {
    width: 0%;
    animation: progress-cycle 4s infinite linear;
    background: linear-gradient(90deg, var(--status-blue), #60A5FA);
}

.stat-progress .progress-fill {
    opacity: 0.6;
}

@keyframes progress-cycle {
    0% { width: 0%; opacity: 0.8; }
    50% { width: 70%; opacity: 1; }
    100% { width: 100%; opacity: 0; }
}

/* Tile Interactivity - Sequential Highlight */
.emp-card {
    animation: card-pulse 12s infinite ease-in-out;
}

.emp-card:nth-child(1) { animation-delay: 0s; }
.emp-card:nth-child(2) { animation-delay: 2s; }
.emp-card:nth-child(3) { animation-delay: 4s; }
.emp-card:nth-child(4) { animation-delay: 6s; }
.emp-card:nth-child(5) { animation-delay: 8s; }
.emp-card:nth-child(6) { animation-delay: 10s; }

@keyframes card-pulse {
    0%, 16.66% { border-color: rgba(16, 185, 129, 0.4); box-shadow: 0 0 20px rgba(16, 185, 129, 0.15); transform: translateY(-3px) scale(1.02); background: rgba(51, 65, 85, 0.6); }
    20%, 100% { border-color: var(--border); box-shadow: none; transform: translateY(0) scale(1); background: var(--bg-card); }
}

/* Data Value Flickers */
.stat-value {
    animation: value-flicker 10s infinite;
}

@keyframes value-flicker {
    0%, 95%, 100% { opacity: 1; filter: none; }
    97% { opacity: 0.9; filter: brightness(1.2); }
    98% { opacity: 1; }
    99% { opacity: 0.95; }
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-compliant { color: var(--status-green); }
.status-compliant .status-dot { background: var(--status-green); box-shadow: 0 0 6px var(--status-green); }

.status-syncing { color: var(--status-blue); }
.status-syncing .status-dot { 
    background: var(--status-blue); 
    box-shadow: 0 0 6px var(--status-blue);
    animation: pulse-sync 1s infinite alternate;
}

@keyframes pulse-sync {
    from { opacity: 0.4; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1.2); }
}

/* Floating Elements (Out of Frame) */
.floating-element {
    position: absolute;
    background: var(--bg-window);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    z-index: 20;
}

.floating-1 {
    top: -40px;
    right: -60px;
    width: 220px;
    transform: translateZ(80px) rotateY(-15deg);
    animation: float-y 6s ease-in-out infinite alternate;
}

.floating-2 {
    bottom: 20px;
    left: -80px;
    width: 180px;
    transform: translateZ(50px) rotateY(15deg);
    animation: float-y 8s ease-in-out infinite alternate-reverse;
}

@keyframes float-y {
    from { transform: translateZ(var(--tz, 50px)) translateY(0) rotateY(var(--ry, 15deg)); }
    to { transform: translateZ(var(--tz, 50px)) translateY(-20px) rotateY(var(--ry, 15deg)); }
}

.alert-badge {
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--status-green);
}

.alert-text b { display: block; font-size: 13px; color: var(--text-primary); }
.alert-text span { font-size: 11px; color: var(--text-muted); }

/* Responsive */
@media (max-width: 1200px) {
    .dashboard-frame { transform: scale(0.8) rotateX(10deg) rotateY(-8deg); }
    .floating-element { display: none; }
}

@media (max-width: 991px) {
    .living-grid-container { height: 500px; }
    .dashboard-frame { transform: scale(0.6) rotateX(5deg) rotateY(-3deg); }
}

@media (max-width: 768px) {
    .dashboard-frame { transform: scale(0.5) rotateX(0) rotateY(0); }
}
