:root {
    --primary: #00d2ff;
    --secondary: #3a7bd5;
    --bg-dark: #050a15;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f0f2f5;
    --text-dim: #94a3b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    line-height: 1.6;
}

/* 高端動態粒子背景 */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: #050a15;
}

.bg-glow {
    display: none;
    /* 取代舊的背景 */
}


.bg-glow::after {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(0, 210, 255, 0.15) 0%, transparent 70%);
    filter: blur(80px);
    animation: float 15s infinite alternate;
}

@keyframes float {
    from {
        transform: translate(0, 0);
    }

    to {
        transform: translate(-100px, 50px);
    }
}

/* 頂部導航 */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 8%;
    background: rgba(5, 10, 21, 0.8);
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
    text-decoration: none;
}

/* Hero 區塊 */
.hero {
    height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 10%;
}

h1 {
    font-size: clamp(3rem, 8vw, 5rem);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    letter-spacing: -2px;
}

h1 span {
    display: block;
    background: linear-gradient(90deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-dim);
    max-width: 600px;
    margin-bottom: 2.5rem;
}

/* 高端按鈕 */
.cta-btn {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: #fff;
    color: #000;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 210, 255, 0.2);
}

.cta-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(0, 210, 255, 0.4);
}

/* 卡片區塊 */
.features {
    padding: 4rem 8% 8rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    padding: 2.5rem;
    border-radius: 24px;
    backdrop-filter: blur(10px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    text-decoration: none;
    display: block;
    color: inherit;
}

.card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--primary);
    transform: translateY(-10px);
}

.card h3 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.card p {
    color: var(--text-dim);
}

/* 產品詳情頁樣式 */
.container {
    max-width: 1400px;
    /* Base width */
    margin: 0 auto;
    padding: 20px;
    z-index: 1;
    position: relative;
}

/* Specific override for full-width dashboard */
body.dashboard-page .container {
    max-width: 100%;
    margin: 0;
    padding: 20px 40px;
    /* Add some side padding */
}

.product-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.product-image {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    aspect-ratio: 1/1;
    border-radius: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 6rem;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
}

.product-image::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(0, 210, 255, 0.1));
}

.spec-list {
    margin-top: 2.5rem;
    list-style: none;
}

.spec-list li {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
    position: relative;
}

.spec-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

/* 儀表板專用樣式 */
.dashboard-grid {
    display: grid;
    /* 10 columns for high-density factory view */
    grid-template-columns: repeat(10, 1fr);
    gap: 12px;
    padding: 10px;
    width: 100%;
    /* Ensure it fits nicely on 1080p without excessive scrolling */
    max-width: 100%;
    margin: 0;
}

/* For smaller screens, fallback to fewer columns */
@media (max-width: 1600px) {
    .dashboard-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.machine-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
}

.machine-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 30px rgba(0, 210, 255, 0.2);
}

.machine-img-wrap {
    position: relative;
    width: 100%;
    height: 140px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.machine-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.8) contrast(1.2);
    transition: transform 0.5s ease;
}

.machine-card:hover .machine-img {
    transform: scale(1.1);
    filter: brightness(1);
}

.status-dot-pulse {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 0 10px currentColor;
    animation: machine-pulse 2s infinite;
}

@keyframes machine-pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.5);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 0.8;
    }
}

.health-score-ring {
    width: 45px;
    height: 45px;
    border: 3px solid;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.02);
}

.machine-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-pill {
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
}

.status-healthy {
    background: rgba(52, 211, 153, 0.1);
    color: #34d399;
}

.status-warning {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
}

.status-critical {
    background: rgba(251, 113, 133, 0.1);
    color: #fb7185;
}

/* 地圖模式樣式 */
.factory-map {
    position: relative;
    width: 100%;
    height: 600px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 30px 30px;
    /* 網格線背景 */
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    overflow: hidden;
    margin-top: 2rem;
}

.machine-node {
    position: absolute;
    width: 120px;
    height: 120px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    backdrop-filter: blur(10px);
}

.machine-node:hover {
    border-color: var(--primary);
    z-index: 10;
}

.machine-node.is-dragging {
    opacity: 0.8;
    cursor: grabbing;
    border-color: var(--primary);
    box-shadow: 0 0 30px rgba(0, 210, 255, 0.3);
}

.node-id {
    font-size: 0.7rem;
    color: var(--text-dim);
}

.node-name {
    font-size: 0.8rem;
    font-weight: 700;
    margin: 5px 0;
}

.node-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.param-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.param-label {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.param-value {
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.mini-chart-wrap {
    height: 30px;
    width: 100px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
}

.back-btn {
    color: var(--text-dim);
    text-decoration: none;
    margin-bottom: 2rem;
    display: inline-block;
    font-size: 0.9rem;
}

.back-btn:hover {
    color: #fff;
}

/* 團隊頁面樣式 */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.5rem;
    margin-top: 4rem;
}

.team-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    padding: 3rem 2rem;
    border-radius: 32px;
    text-align: center;
    backdrop-filter: blur(15px);
    transition: all 0.4s ease;
    display: flex;
    flex-direction: column;
}

.team-card:hover {
    transform: translateY(-12px);
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
}

.team-avatar {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 10px 20px rgba(0, 210, 255, 0.2);
}

.team-role {
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 0.5rem;
}

.team-list {
    list-style: none;
    margin-top: 1.5rem;
    padding: 0;
    font-size: 0.85rem;
    color: var(--text-dim);
    text-align: left;
}

.team-list li {
    margin-bottom: 10px;
    padding-left: 1.5rem;
    position: relative;
    line-height: 1.4;
}

.team-list li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

/* AI 聊天組件 */
.ai-chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 2000;
}

.chat-trigger {
    width: 60px;
    height: 60px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 210, 255, 0.4);
    transition: all 0.3s ease;
}

.chat-trigger:hover {
    transform: scale(1.1) rotate(15deg);
}

.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 450px;
    background: rgba(10, 20, 40, 0.9);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.chat-header {
    background: var(--glass);
    padding: 1.25rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-input-area {
    padding: 1rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 8px 12px;
    color: white;
    outline: none;
}

.bubble {
    padding: 10px 14px;
    border-radius: 15px;
    max-width: 85%;
    font-size: 0.9rem;
}

.bubble.ai {
    background: var(--glass);
    align-self: flex-start;
    border: 1px solid var(--glass-border);
}

.bubble.user {
    background: var(--primary);
    color: black;
    align-self: flex-end;
    font-weight: 500;
}

/* Google Gemini 3.0 Pro Premium Styles */
.role-gemini-3 {
    background: linear-gradient(90deg, #4285F4, #9B72CB, #D96570, #4285F4);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 900 !important;
    animation: shine 3s linear infinite;
    text-transform: uppercase;
    letter-spacing: 1px;
}

@keyframes shine {
    to {
        background-position: 200% center;
    }
}

.gemini-pulse {
    border: 1px solid transparent;
    border-image: linear-gradient(90deg, #4285F4, #9B72CB, #D96570) 1;
    box-shadow: 0 0 20px rgba(155, 114, 203, 0.3);
    animation: gemini-glow 2.5s infinite alternate;
}

@keyframes gemini-glow {
    from {
        box-shadow: 0 0 10px rgba(66, 133, 244, 0.2);
        border-color: rgba(66, 133, 244, 0.3);
    }

    to {
        box-shadow: 0 0 30px rgba(217, 101, 112, 0.5);
        border-color: rgba(217, 101, 112, 0.6);
    }
}

.spinner-gemini {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(155, 114, 203, 0.2);
    border-top: 2px solid #9B72CB;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 10px;
}

footer {
    padding: 4rem 8%;
    border-top: 1px solid var(--glass-border);
    text-align: center;
    color: var(--text-dim);
    font-size: 0.8rem;
}

/* Dropdown styling */
.dropdown:hover .dropdown-content {
    display: block !important;
}

.dropdown-content a:hover {
    background-color: var(--glass-border);
    color: var(--primary) !important;
}