/* ============================================
   QML Visualization Hub - Styles
   Modern dark theme with glassmorphism
   Based on Neural Network Visualizer design
   ============================================ */

/* CSS Variables */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-panel: rgba(20, 20, 30, 0.8);
    --bg-hover: rgba(255, 255, 255, 0.05);
    --bg-card: rgba(20, 20, 35, 0.9);

    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;

    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;

    --border-color: rgba(255, 255, 255, 0.1);
    --border-radius: 16px;
    --border-radius-sm: 8px;
    --border-radius-lg: 24px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.3);

    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html,
body {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* ============================================
   Landing Page
   ============================================ */

.landing-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px 20px;
    overflow-y: auto;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(6, 182, 212, 0.05) 0%, transparent 60%),
        var(--bg-primary);
}

.landing-content {
    max-width: 1600px;
    width: 100%;
    text-align: center;
}

.hub-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 6px;
}

.hub-icon {
    font-size: 36px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.landing-title {
    font-size: 2.2rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
}

.landing-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================
   Category Cards
   ============================================ */

.category-cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    max-width: 1600px;
    margin: 0 auto;
}

.category-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 14px;
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-normal);
    overflow: hidden;
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.category-card:hover {
    transform: translateY(-6px);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: var(--shadow-glow);
}

.category-card:hover::before {
    opacity: 1;
}

.card-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 60%);
    opacity: 0;
    transition: opacity var(--transition-normal);
    pointer-events: none;
}

.category-card:hover .card-glow {
    opacity: 1;
}

.card-icon {
    font-size: 28px;
    margin-bottom: 8px;
    display: block;
}

.category-card h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.category-card p {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.4;
    flex: 1;
}

.card-features {
    list-style: none;
    margin-bottom: 8px;
}

.card-features li {
    font-size: 0.65rem;
    color: var(--text-muted);
    padding: 2px 0;
    padding-left: 14px;
    position: relative;
}

.card-features li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent-primary);
    font-size: 0.6rem;
}

.card-badge {
    display: inline-block;
    padding: 3px 8px;
    background: rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--accent-primary);
    margin-bottom: 8px;
}

.card-start {
    width: 100%;
    margin-top: auto;
    padding: 6px 12px;
    font-size: 0.75rem;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: var(--font-family);
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

/* ============================================
   Subcategory Page
   ============================================ */

.subcategory-page {
    min-height: 100vh;
    padding: 24px;
    overflow-y: auto;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
        var(--bg-primary);
}

.subcategory-header {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.category-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-icon {
    font-size: 32px;
}

.category-title h2 {
    font-size: 1.8rem;
    font-weight: 600;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subcategory-content {
    max-width: 1200px;
    margin: 0 auto;
}

/* ============================================
   Tool Cards
   ============================================ */

.tool-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.tool-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    cursor: pointer;
    transition: all var(--transition-normal);
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.tool-card:hover {
    transform: translateY(-4px);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.tool-card:hover::before {
    opacity: 1;
}

.tool-card .tool-icon {
    font-size: 36px;
    margin-bottom: 12px;
    display: block;
}

.tool-card h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.tool-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.tool-card .tool-arrow {
    position: absolute;
    bottom: 20px;
    right: 20px;
    font-size: 1.2rem;
    color: var(--accent-primary);
    opacity: 0;
    transform: translateX(-10px);
    transition: all var(--transition-normal);
}

.tool-card:hover .tool-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================
   Tool Groups (for ML categories)
   ============================================ */

.tool-group {
    margin-bottom: 32px;
}

.tool-group-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-group-title::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--accent-gradient);
    border-radius: 2px;
}

.tool-group-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.tool-group-cards .tool-card {
    padding: 20px;
}

.tool-group-cards .tool-card .tool-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.tool-group-cards .tool-card h3 {
    font-size: 1rem;
}

.tool-group-cards .tool-card p {
    font-size: 0.8rem;
}

/* ============================================
   Tool Viewer (iframe)
   ============================================ */

.tool-viewer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.tool-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
}

.tool-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.tool-iframe-container {
    flex: 1;
    position: relative;
    background: var(--bg-secondary);
}

.tool-iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: var(--bg-primary);
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    z-index: 10;
    transition: opacity var(--transition-normal);
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   Utility Classes
   ============================================ */

.hidden {
    display: none !important;
}

/* Page Transitions */
.landing-page,
.subcategory-page,
.tool-viewer {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1400px) {
    .category-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .category-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .landing-title {
        font-size: 2rem;
    }

    .landing-subtitle {
        font-size: 1rem;
    }

    .category-cards {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .category-card {
        padding: 24px;
    }

    .subcategory-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .tool-cards {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}