/* ===== CSS Variables & Reset ===== */
:root {
    /* Colors - Glassmorphism Palette */
    --bg-primary: #0b0f14;
    --bg-secondary: #111820;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --bg-glass: rgba(255, 255, 255, 0.06);

    /* Accent Colors - Teal/Emerald/Warm */
    --accent-teal: #14b8a6;
    --accent-emerald: #10b981;
    --accent-cyan: #06b6d4;
    --accent-blue: #3b82f6;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    --accent-orange: #fb923c;
    --accent-green: #22c55e;
    --accent-red: #ef4444;

    /* Text */
    --text-primary: #f0f4f8;
    --text-secondary: rgba(240, 244, 248, 0.6);
    --text-muted: rgba(240, 244, 248, 0.35);

    /* Borders - Glass */
    --border-color: rgba(255, 255, 255, 0.07);
    --border-glass: rgba(255, 255, 255, 0.12);
    --border-glow: rgba(20, 184, 166, 0.4);

    /* Shadows */
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(20, 184, 166, 0.12);
    --shadow-glass: 0 4px 30px rgba(0, 0, 0, 0.3);

    /* Glass */
    --glass-blur: 16px;
    --glass-saturate: 180%;

    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ===== Animated Background ===== */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse 80% 50% at 15% 15%, rgba(20, 184, 166, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 85% 80%, rgba(6, 182, 212, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 50% 30% at 50% 50%, rgba(16, 185, 129, 0.06) 0%, transparent 50%);
    animation: gradientShift 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes gradientShift {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

/* ===== Dashboard Container ===== */
.dashboard {
    position: relative;
    z-index: 1;
    max-width: 910px;
    margin: 0 auto;
    padding: 24px 32px;
    min-height: 100vh;
}

/* ===== Header - Glass ===== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-glass);
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    margin-bottom: 32px;
    box-shadow: var(--shadow-glass);
    animation: slideDown 0.6s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
}

.logo-text {
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-teal), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
    transition: var(--transition-normal);
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.nav-link.active {
    color: var(--accent-teal);
    background: rgba(20, 184, 166, 0.1);
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-lg);
    font-size: 0.85rem;
    font-weight: 500;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-red);
    transition: var(--transition-normal);
}

.status-dot.online {
    background: var(--accent-green);
    box-shadow: 0 0 12px var(--accent-green);
    animation: pulse 2s infinite;
}

.status-dot.offline {
    background: var(--accent-red);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* ===== Hero Section ===== */
.hero {
    text-align: center;
    padding: 40px 0 50px;
    animation: fadeIn 0.8s ease-out 0.2s backwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-title {
    font-size: 3.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 12px;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent-teal), var(--accent-emerald), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% auto;
    animation: gradientText 4s ease-in-out infinite;
}

@keyframes gradientText {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ===== Stats Row ===== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 40px;
    animation: fadeIn 0.8s ease-out 0.3s backwards;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--bg-glass);
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass);
    transition: var(--transition-normal);
}

.stat-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    border-color: rgba(20, 184, 166, 0.25);
}

.stat-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: rgba(20, 184, 166, 0.12);
    color: var(--accent-teal);
}

.stat-icon svg {
    width: 22px;
    height: 22px;
}

.stat-icon.gpu-icon {
    background: rgba(34, 197, 94, 0.12);
    color: var(--accent-green);
}

.stat-icon.vram-icon {
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent-blue);
}

.stat-icon.status-icon {
    background: rgba(244, 63, 94, 0.12);
    color: var(--accent-rose);
}

.stat-icon.workflows-icon {
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-amber);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ===== Tools Section ===== */
.tools-section {
    margin-bottom: 48px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    animation: fadeIn 0.8s ease-out 0.4s backwards;
}

.section-icon {
    font-size: 1.4rem;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    animation: fadeIn 0.8s ease-out 0.5s backwards;
}

/* ===== Tool Cards - Glass ===== */
.tool-card {
    position: relative;
    background: var(--bg-glass);
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-glass);
    transition: var(--transition-normal);
}

.tool-card:hover {
    transform: translateY(-4px);
    border-color: rgba(20, 184, 166, 0.3);
    box-shadow: var(--shadow-glow), var(--shadow-glass);
    background: rgba(255, 255, 255, 0.08);
}

.tool-card:hover .card-glow {
    opacity: 1;
}

.card-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-teal), var(--accent-cyan), var(--accent-emerald));
    opacity: 0;
    transition: var(--transition-normal);
}

.card-content {
    padding: 28px;
}

.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.tool-icon {
    width: 56px;
    height: 56px;
}

.tool-badge {
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(20, 184, 166, 0.15);
    color: var(--accent-teal);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(20, 184, 166, 0.2);
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: var(--transition-normal);
}

.status-indicator.online {
    background: var(--accent-green);
    box-shadow: 0 0 12px var(--accent-green);
    animation: pulse 2s infinite;
}

.tool-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.tool-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 16px;
    line-height: 1.5;
}

.tool-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.tag {
    padding: 5px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: var(--transition-fast);
}

.tag:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.12);
}

.tool-actions {
    display: flex;
    gap: 12px;
}

/* ===== Buttons - Glass ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-normal);
    text-decoration: none;
}

.btn-icon {
    font-size: 0.9rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-teal), var(--accent-emerald));
    color: white;
    box-shadow: 0 4px 20px rgba(20, 184, 166, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(20, 184, 166, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
    backdrop-filter: blur(8px);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== Card Variants ===== */
.comfyui-card:hover {
    border-color: rgba(34, 197, 94, 0.4);
}

.comfyui-card:hover .card-glow {
    background: linear-gradient(90deg, #22c55e, #06b6d4);
}

.ltx-card:hover {
    border-color: rgba(244, 63, 94, 0.4);
}

.ltx-card:hover .card-glow {
    background: linear-gradient(90deg, #f43f5e, #fb923c);
}

.lipsync-card:hover {
    border-color: rgba(6, 182, 212, 0.4);
}

.lipsync-card:hover .card-glow {
    background: linear-gradient(90deg, #06b6d4, #0ea5e9);
}

.imagegen-card:hover {
    border-color: rgba(59, 130, 246, 0.4);
}

.imagegen-card:hover .card-glow {
    background: linear-gradient(90deg, #3b82f6, #06b6d4);
}

.ambientgen-card:hover {
    border-color: rgba(20, 184, 166, 0.4);
}

.ambientgen-card:hover .card-glow {
    background: linear-gradient(90deg, #14b8a6, #06b6d4);
}

.videocutter-card:hover {
    border-color: rgba(251, 146, 60, 0.4);
}

.videocutter-card:hover .card-glow {
    background: linear-gradient(90deg, #fb923c, #f59e0b);
}

.tts-card:hover {
    border-color: rgba(59, 130, 246, 0.4);
}

.tts-card:hover .card-glow {
    background: linear-gradient(90deg, #3b82f6, #06b6d4);
}

/* ===== Workflows Section ===== */
.workflows-section {
    margin-bottom: 48px;
}

.workflows-scroll {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 8px 0 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(20, 184, 166, 0.3) transparent;
    animation: fadeIn 0.8s ease-out 0.6s backwards;
}

.workflows-scroll::-webkit-scrollbar {
    height: 6px;
}

.workflows-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.workflows-scroll::-webkit-scrollbar-thumb {
    background: rgba(20, 184, 166, 0.3);
    border-radius: 3px;
}

.workflow-card {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-glass);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-normal);
}

.workflow-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-4px) scale(1.02);
    border-color: rgba(20, 184, 166, 0.3);
}

.workflow-preview {
    width: 100px;
    height: 70px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.workflow-emoji {
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.workflow-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
    margin-top: 24px;
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1000;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-glass);
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    animation: toastIn 0.4s ease-out;
    min-width: 280px;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.toast-out {
    animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.toast-icon {
    font-size: 1.2rem;
}

.toast-message {
    flex: 1;
    font-size: 0.9rem;
}

.toast.success {
    border-left: 3px solid var(--accent-green);
}

.toast.error {
    border-left: 3px solid var(--accent-red);
}

.toast.info {
    border-left: 3px solid var(--accent-blue);
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .dashboard {
        padding: 16px;
    }

    .header {
        flex-wrap: wrap;
        gap: 16px;
    }

    .nav {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .tools-grid {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: 2.2rem;
    }
}

@media (max-width: 600px) {
    .stats-row {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .tool-actions {
        flex-direction: column;
    }
}