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

:root {
    --primary-color: #2563EB;
    /* Modern Royal Blue */
    --primary-dark: #1E40AF;
    --accent-color: #F59E0B;
    /* Subtle Amber/Gold */
    --text-color: #334155;
    /* Slate 700 */
    --text-light: #64748B;
    /* Slate 500 */
    --light-grey: #F8FAFC;
    /* Slate 50 */
    --white: #ffffff;
    --arduino-teal: #0891B2;
    /* Cyan 600 - fresher than old teal */
    --toc-header-bg: #E0F2FE;
    /* Light Blue 100 */
    --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --card-radius: 12px;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--light-grey);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: var(--primary-color);
}

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

/* Navigation */
.navbar {
    background-color: var(--white);
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(8px);
    background-color: rgba(255, 255, 255, 0.95);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo img {
    height: 40px;
    width: auto;
}

.brand-container {
    display: flex;
    align-items: center;
}

.menu-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
}

.nav-links a {
    margin-left: 20px;
    color: #555;
    font-weight: 500;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary-color);
}

.btn-nav {
    padding: 8px 15px;
    background-color: var(--primary-color);
    color: white !important;
    border-radius: 4px;
}

/* --- V4: PROJECT DETAILS LAYOUT --- */
.project-header {
    background: white;
    padding: 40px 0;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
}

.project-header h1 {
    margin: 0 0 10px;
    font-size: 2.5rem;
}

.subtitle {
    font-size: 1.2rem;
    color: #555;
    margin-bottom: 15px;
    max-width: 800px;
}

.header-meta {
    color: #888;
    font-size: 0.9rem;
}

.sep {
    margin: 0 5px;
}

.page-layout {
    display: flex;
    gap: 40px;
}

.main-column {
    flex: 2;
    /* Takes up 2/3 space */
}

.sidebar-column {
    flex: 1;
    /* Takes up 1/3 space */
    position: sticky;
    top: 90px;
    height: fit-content;
}

/* Sections */
.section {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.section h2 {
    margin-top: 0;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.main-image {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Tags */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid #ddd;
}

.tag.technology {
    background: #E3F2FD;
    color: #1565C0;
    border-color: #BBDEFB;
}

.tag.tool {
    background: #F3E5F5;
    color: #7B1FA2;
    border-color: #E1BEE7;
}

/* Download Buttons */
.download-btn {
    display: inline-block;
    padding: 12px 24px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: var(--text-color);
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.download-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.code-btn {
    border-color: var(--arduino-teal);
    color: var(--arduino-teal);
    background: #F0FDFA;
}

/* --- SIDEBAR WIDGETS --- */
.sidebar-widget {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

/* Profile Widget */
.profile-widget {
    padding: 20px;
    text-align: center;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    text-align: left;
}

.avatar-circle {
    width: 50px;
    height: 50px;
    background: var(--arduino-teal);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.profile-info h4 {
    margin: 0;
    color: #333;
}

.profile-info p {
    margin: 0;
    color: #666;
    font-size: 0.85rem;
}

.follow-btn {
    width: 100%;
    padding: 8px;
    border: 2px solid var(--arduino-teal);
    background: white;
    color: var(--arduino-teal);
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: 0.2s;
}

.follow-btn:hover {
    background: var(--arduino-teal);
    color: white;
}

/* TOC Widget */
.toc-header {
    background: var(--toc-header-bg);
    padding: 12px 20px;
    font-weight: bold;
    color: #333;
    border-bottom: 1px solid #b2dfdb;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    border-bottom: 1px solid #f0f0f0;
}

.toc-list li:last-child {
    border-bottom: none;
}

.toc-list a {
    display: block;
    padding: 12px 20px;
    color: #444;
    font-size: 0.95rem;
}

.toc-list a:hover {
    background: #f9f9f9;
    color: var(--arduino-teal);
}


/* --- V3: UTILS (KEEPING previous styles for Browse/New) --- */
.category-bar-wrapper {
    background: white;
    border-bottom: 1px solid #ddd;
    padding: 20px 0;
}

.category-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow-x: auto;
    gap: 20px;
    padding-bottom: 5px;
}

.category-bar::-webkit-scrollbar {
    height: 6px;
}

.category-bar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.cat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    min-width: 100px;
    cursor: pointer;
    transition: 0.2s;
}

.cat-item:hover,
.cat-item.active {
    color: var(--arduino-teal);
}

.cat-icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
    display: block;
}

.filter-bar {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    margin-bottom: 30px;
}

.search-container {
    flex-grow: 2;
    min-width: 300px;
}

.search-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.filter-group {
    flex-grow: 1;
    min-width: 150px;
}

.filter-select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

/* --- CARD GRID (Reused) --- */
.featured-grid,
.browse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    padding-bottom: 40px;
}

.hub-card {
    background: white;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    cursor: pointer;
}

/* added cursor pointer */
.hub-card:hover {
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
    transform: translateY(-2px);
}

.hub-card-image {
    height: 200px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #eee;
}

.hub-card-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.hub-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: #333;
    line-height: 1.3;
}

.hub-meta {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 20px;
}

.hub-author strong {
    color: var(--arduino-teal);
}

.hub-footer {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #888;
}

.hub-category {
    background: #f1f1f1;
    padding: 3px 8px;
    border-radius: 3px;
    color: #555;
    font-weight: 600;
}

/* Banner */
.banner-container {
    width: 100%;
    background: #e0e0e0;
    position: relative;
    margin-bottom: 20px;
}

.banner-slider {
    max-width: 100%;
    position: relative;
    margin: auto;
}

.slide {
    display: none;
    width: 100%;
}

.banner-content {
    height: 300px;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
}

.prev,
.next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    margin-top: -22px;
    padding: 16px;
    color: white;
    font-weight: bold;
    font-size: 18px;
    transition: 0.6s ease;
    background-color: rgba(0, 0, 0, 0.3);
}

.next {
    right: 0;
}

.dot {
    cursor: pointer;
    height: 12px;
    width: 12px;
    margin: 0 2px;
    background-color: #bbb;
    border-radius: 50%;
    display: inline-block;
}

.active-dot {
    background-color: #717171;
}

.fade {
    animation-name: fade;
    animation-duration: 1.5s;
}

@keyframes fade {
    from {
        opacity: .4
    }

    to {
        opacity: 1
    }
}

/* Auth */
.auth-container {
    max-width: 400px;
    margin: 50px auto;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.form-group {
    margin-bottom: 15px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-color);
    background-color: white;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.auth-btn {
    width: 100%;
    padding: 10px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

/* Footer */
footer {
    background-color: var(--text-color);
    /* Dark Slate */
    color: white;
    padding: 60px 0 30px;
    margin-top: 60px;
    border-top: 1px solid #e2e8f0;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h4 {
    color: white;
    margin-bottom: 15px;
    margin-top: 0;
    font-size: 1.1rem;
    position: relative;
    padding-bottom: 10px;
}

.footer-section h4::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 30px;
    height: 2px;
    background-color: var(--primary-color);
}

.footer-section p {
    color: #cbd5e1;
    margin: 8px 0;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-section i {
    width: 20px;
    text-align: center;
    color: var(--primary-color);
    /* Or keep white/accent */
}

.social-icons {
    display: flex;
    gap: 15px;
}

.social-icons a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: white;
    transition: 0.3s;
    font-size: 1.2rem;
}

.social-icons a:hover {
    background: var(--primary-color);
    transform: translateY(-3px);
}

.copyright {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    font-size: 0.9rem;
}

/* --- RESPONSIVE UTILITIES --- */
.responsive-row {
    display: flex;
    gap: 20px;
}

/* --- MEDIA QUERIES --- */
@media (max-width: 768px) {
    .container {
        width: 95%;
    }

    /* Navigation */
    .navbar .container {
        flex-direction: column;
        gap: 0;
        align-items: flex-start;
    }

    .brand-container {
        width: 100%;
        justify-content: space-between;
    }

    .menu-toggle {
        display: block !important;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        text-align: center;
        margin-top: 15px;
    }

    .nav-links.show {
        display: flex;
    }

    .nav-links a {
        display: block;
        padding: 10px;
        margin: 0;
        border-bottom: 1px solid #f0f0f0;
    }

    /* Layout */
    .page-layout {
        flex-direction: column;
    }

    .sidebar-column {
        position: static;
        /* Remove sticky on mobile */
        order: 1;
        /* Profile Info FIRST */
    }

    .main-column {
        order: 2;
        /* Projects SECOND */
    }

    /* Grids */
    .featured-grid,
    .browse-grid {
        grid-template-columns: 1fr;
        /* Single column for cards */
    }

    /* Project Detail Header */
    .project-header .container>div {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .project-header h1 {
        font-size: 1.8rem;
    }

    /* Forms */
    .responsive-row {
        flex-direction: column;
        gap: 0;
    }

    /* Stats Profile */
    .profile-widget h3 {
        font-size: 1.2rem;
    }
}