:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --header-bg: #0b1120;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --border-light: #475569;
    --accent: #0284c7;
    --accent-hover: #0369a1;
    --accent-light: #38bdf8;
    --success: #10b981;
    --youtube-red: #ef4444;
    --stl-color: #0284c7;
    --code-bg: #020617;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--accent-light);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: #7dd3fc;
    text-decoration: underline;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Header & Navigation */
.site-header {
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.brand {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: #ffffff;
    text-decoration: none;
    letter-spacing: -0.5px;
}

.brand-title span {
    color: var(--accent-light);
}

.brand-tagline {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.site-nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.site-nav a {
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.site-nav a:hover, .site-nav a.active {
    background-color: rgba(2, 132, 199, 0.15);
    color: var(--accent-light);
    text-decoration: none;
}

/* Breadcrumbs */
.breadcrumb {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 20px 0 10px 0;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--text-muted);
}

.breadcrumb a:hover {
    color: var(--accent-light);
}

.breadcrumb-separator {
    color: var(--border-light);
}

/* Main Layout: Article + Sidebar */
.main-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin: 25px auto 40px auto;
    flex-grow: 1;
}

@media (min-width: 900px) {
    .main-layout {
        grid-template-columns: 2.8fr 1.2fr;
    }
}

/* Content Area & Cards */
.content-area {
    min-width: 0;
}

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    margin-bottom: 30px;
}

.card-header {
    margin-bottom: 20px;
}

.card-header h1, .card-header h2 {
    font-size: 1.85rem;
    color: #ffffff;
    margin-bottom: 12px;
    line-height: 1.3;
}

.badges-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.badge {
    background-color: rgba(2, 132, 199, 0.2);
    color: var(--accent-light);
    border: 1px solid rgba(2, 132, 199, 0.4);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-green {
    background-color: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.4);
}

/* 3D STL Preview Container */
.stl-preview-container {
    position: relative;
    width: 100%;
    height: 380px;
    background-color: #020617;
    border-radius: 10px;
    overflow: hidden;
    margin: 20px 0;
    border: 1px solid var(--border);
}

.stl-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.stl-hint {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(15, 23, 42, 0.85);
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 6px;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    z-index: 10;
}

.stl-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #020617;
    color: var(--text-muted);
    font-size: 0.95rem;
    z-index: 5;
    transition: opacity 0.3s ease;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(2, 132, 199, 0.2);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Action Buttons */
.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 25px 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s, background-color 0.2s, box-shadow 0.2s;
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
    text-decoration: none;
}

.btn-stl {
    background-color: var(--accent);
    color: #ffffff;
}
.btn-stl:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}

.btn-marketplace {
    background-color: #2563eb;
    color: #ffffff;
}
.btn-marketplace:hover {
    background-color: #1d4ed8;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.btn-youtube {
    background-color: #dc2626;
    color: #ffffff;
}
.btn-youtube:hover {
    background-color: #b91c1c;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.4);
}

/* Responsive YouTube Video */
.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 10px;
    margin: 25px 0;
    background-color: #000;
    border: 1px solid var(--border);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Documentation Content Elements */
.doc-section {
    margin: 30px 0;
}

.doc-section h2, .doc-section h3, .doc-section h4 {
    color: #ffffff;
    margin: 25px 0 12px 0;
    font-weight: 700;
}

.doc-section h2 {
    font-size: 1.45rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.doc-section h3 {
    font-size: 1.2rem;
    color: var(--accent-light);
}

.doc-section p {
    color: #cbd5e1;
    margin-bottom: 16px;
    font-size: 1rem;
    line-height: 1.7;
}

.doc-section ul, .doc-section ol {
    margin: 15px 0 20px 25px;
    color: #cbd5e1;
}

.doc-section li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.doc-section strong {
    color: #ffffff;
}

/* Tables for Pinout and Specs */
.tech-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background-color: rgba(2, 6, 23, 0.5);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.tech-table th, .tech-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.tech-table th {
    background-color: rgba(15, 23, 42, 0.9);
    color: #ffffff;
    font-weight: 600;
}

.tech-table tr:last-child td {
    border-bottom: none;
}

.tech-table tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Code Snippets */
.code-box {
    background-color: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin: 20px 0;
    overflow: hidden;
}

.code-header {
    background-color: #0b1120;
    padding: 8px 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
}

.code-box pre {
    padding: 16px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.5;
    color: #e2e8f0;
}

/* AdSense Slot Wrapper */
.adsense-slot {
    margin: 25px 0;
    padding: 15px;
    background-color: rgba(2, 6, 23, 0.4);
    border: 1px dashed var(--border);
    border-radius: 8px;
    text-align: center;
    min-height: 100px;
}

.ad-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 8px;
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.widget {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 22px;
}

.widget h3 {
    font-size: 1.15rem;
    color: #ffffff;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.widget p {
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.6;
}

.widget ul {
    list-style: none;
    margin-top: 10px;
}

.widget ul li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

.widget ul li:last-child {
    border-bottom: none;
}

.widget ul li a {
    color: #cbd5e1;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.widget ul li a:hover {
    color: var(--accent-light);
    text-decoration: none;
}

/* Catalog Grid (for index.html) */
.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin: 30px 0;
}

.catalog-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

/* Search Bar */
.search-container {
    max-width: 650px;
    margin: 20px auto 25px auto;
    position: relative;
}

.search-input {
    width: 100%;
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 14px 22px 14px 48px;
    color: #ffffff;
    font-size: 1rem;
    outline: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.search-input:focus {
    border-color: var(--accent-light);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.25);
    background-color: #0b1120;
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
    pointer-events: none;
}

.catalog-card-image {
    width: 100%;
    height: 195px;
    background-color: #020617;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}

.price-pill {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    font-weight: 800;
    font-size: 0.92rem;
    padding: 5px 11px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.35);
    letter-spacing: 0.3px;
    z-index: 5;
}

.catalog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.catalog-card:hover .catalog-card-image img {
    transform: scale(1.05);
}

.catalog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
    border-color: var(--accent);
}

.catalog-card-body {
    padding: 22px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.catalog-card-title {
    font-size: 1.25rem;
    color: #ffffff;
    margin-bottom: 10px;
    line-height: 1.35;
}

.catalog-card-desc {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-bottom: 20px;
    flex-grow: 1;
    line-height: 1.6;
}

.btn-view {
    display: block;
    text-align: center;
    background-color: var(--accent);
    color: #ffffff;
    font-weight: 600;
    padding: 11px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.btn-view:hover {
    background-color: var(--accent-hover);
    text-decoration: none;
}

.card-btn-group {
    display: flex;
    gap: 10px;
    margin-top: auto;
    padding-top: 15px;
    flex-wrap: wrap;
}

.card-btn-group .btn {
    flex: 1 1 calc(50% - 5px);
    min-width: 120px;
    padding: 10px 12px;
    font-size: 0.85rem;
    text-align: center;
    white-space: nowrap;
}

/* Categories Bar */
.categories-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 25px 0;
}

.category-tag {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.88rem;
    transition: all 0.2s ease;
}

.category-tag:hover, .category-tag.active {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    text-decoration: none;
}

/* Hero Intro Block */
.hero-intro {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    margin: 25px 0 35px 0;
    text-align: center;
}

.hero-intro h1, .hero-intro h2 {
    font-size: 1.6rem;
    margin-bottom: 12px;
    color: var(--accent-light);
}

.hero-intro p {
    color: var(--text-muted);
    max-width: 800px;
    margin: 0 auto;
    font-size: 1rem;
    line-height: 1.7;
}

/* Legal & Static Content (About, Contact, Privacy) */
.legal-content {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 35px;
    margin: 30px 0;
}

.legal-content h1 {
    font-size: 2rem;
    color: #ffffff;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.legal-content h2 {
    font-size: 1.35rem;
    color: var(--accent-light);
    margin: 28px 0 12px 0;
}

.legal-content p, .legal-content ul {
    color: #cbd5e1;
    margin-bottom: 16px;
    line-height: 1.7;
}

.legal-content ul {
    margin-left: 25px;
}

/* Contact Form */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 25px;
    max-width: 600px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.form-group input, .form-group textarea {
    background-color: #020617;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.95rem;
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* Site Footer */
.site-footer {
    background-color: var(--header-bg);
    border-top: 1px solid var(--border);
    padding: 35px 0;
    margin-top: auto;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.site-footer p {
    margin-bottom: 8px;
}

.footer-nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.footer-nav a {
    color: var(--text-muted);
}

.footer-nav a:hover {
    color: var(--accent-light);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .site-header {
        padding: 15px 0;
    }
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }
    .site-nav {
        width: 100%;
        justify-content: space-between;
    }
    .card {
        padding: 18px;
    }
    .card-actions {
        flex-direction: column;
    }
    .card-actions .btn {
        width: 100%;
    }
    .stl-preview-container {
        height: 280px;
    }
}
