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

body {
    background-color: #0D1117;
    color: #c9d1d9;
    font-family: 'Quicksand', sans-serif;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    max-width: 1300px;
    margin: 40px auto;
    gap: 60px;
    padding: 0 40px;
    height: calc(100vh - 80px);
    overflow: hidden;
}

/* mobile nav default (hidden on desktop) */
.mobile-nav {
    display: none;
}

@media (max-width: 768px) {
    /* make page scrollable on mobile */
    body {
        height: auto;
        overflow: auto;
    }
    /* stack sidebar and main content vertically and control order */
    .container {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
        height: auto;
        overflow: visible;
    }
    /* show mobile nav and make it sticky at the top */
    .mobile-nav {
        display: block !important;
        order: 0;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100vw;
        box-sizing: border-box;
        padding: 12px 8px;
        background: #0D1117;
        border-bottom: 1px solid #333333;
        z-index: 10000;
        height: 56px;
    }
    .mobile-logo {
        font-size: 18px;
        margin: 0;
        display: block;
        width: 100%;
        text-align: center;
    }
    /* hide the desktop logo header on small screens to avoid duplicate navs */
    .main-content .logo {
        display: none;
    }
    .sidebar {
        order: 1;
        width: 100%;
        padding: 8px 8px 24px 8px;
        border-left: none;
        border-bottom: none;
        height: auto;
        overflow: visible;
        background: transparent;
    }
    /* create a small gap between nav separator and about section */
    .about {
        margin-top: 12px;
    }
    .main-content {
        order: 2;
        width: 100%;
        padding: 0;
        min-width: 0;
    }
    /* push content down so fixed nav doesn't cover it */
    .container {
        padding-top: 96px; /* more breathing room to avoid overlap on devices */
    }
    /* let whole page scroll; disable inner scrolling on cards-wrapper */
    .cards-wrapper {
        overflow-y: visible;
        max-height: none;
        padding-bottom: 24px;
    }
}

/* LEFT CONTENT */

.main-content {
    flex: 2;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.logo {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #333333;
    background-color: #0D1117;
    flex-shrink: 0;
}

.cards-wrapper {
    overflow-y: auto;
    flex: 1;
    padding-right: 10px;
    padding-bottom: 40px;
    scroll-behavior: smooth;
}

.cards-wrapper::-webkit-scrollbar {
    width: 8px;
}

.cards-wrapper::-webkit-scrollbar-track {
    background: #0d1117;
    border-radius: 4px;
}

.cards-wrapper::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 4px;
}

.cards-wrapper::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

.logo span {
    color: #3fb950;
}

.logo .lang {
    color: #ffffff;
}

/* CARD */

.card {
    border: 1px solid #30363d;
    padding: 20px;
    margin-bottom: 20px;
    background: #0D1117;
    transition: 0.2s ease;
    cursor: pointer;
    position: relative; /* allow absolutely positioned avatar */
    /* desktop: reserve space on the left for avatar */
    padding-left: 84px;
}

.card:hover {
    transform: translateY(-4px);
}

.card-header {
    display: flex;
    gap: 12px;
    align-items: flex-start; /* place avatar at top-left and title to its right */
    flex-wrap: nowrap; /* keep avatar and title on the same row */
}

.owner-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid #30363d;
    position: absolute; /* desktop: top-left by default */
    left: 16px;
    top: 16px;
    background-size: cover;
    display: block;
    object-fit: cover;
}

/* ensure repository/meta info doesn't get overlapped by avatar on desktop */
.card .meta {
    padding-left: 8px; /* small inner spacing; left padding offsets from avatar */
}

@media (max-width: 768px) {
    /* mobile: avatar moves to bottom-right; adjust card padding to reserve space */
    .card {
        padding-left: 20px; /* remove large left padding on mobile */
        padding-right: 84px; /* reserve space on right for avatar */
        padding-bottom: 72px; /* reserve space at bottom for avatar */
    }
    .owner-avatar {
        width: 40px;
        height: 40px;
        left: auto;
        top: auto;
        right: 12px;
        bottom: 12px;
        border-width: 1px;
    }
    .card .meta {
        padding-left: 0;
        padding-right: 72px;
    }
}

.card-content {
    flex: 1;
    min-width: 0; /* allow flex children to shrink and enable text-overflow */
}

.card h3 {
    color: #ffffff;
    margin: 0;
    font-size: 18px;
    white-space: nowrap; /* prevent wrapping */
    overflow: hidden;
    text-overflow: ellipsis; /* show ellipsis when too long */
}

.card h3 a {
    color: #58a6ff;
    text-decoration: none;
}

.card h3 a:hover {
    text-decoration: underline;
}

.card h3 a:visited {
    color: #58a6ff;
}

.card p {
    font-size: 14px;
    color: #8b949e;
    margin-bottom: 24px; /* slightly larger gap before meta/info */
}

.meta {
    font-size: 13px;
    color: #8b949e;
    margin-top: 6px; /* small spacing from description */
}

.meta span {
    margin-left: 15px;
}

/* ISSUE BUTTON */

.card button {
    background: transparent;
    border: 1px solid #30363d;
    color: #c9d1d9;
    padding: 6px 14px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 13px;
}

.card button:hover {
    border-color: #58a6ff;
}

/* SIDEBAR */

.sidebar {
    flex: 1;
    padding-left: 40px;
    border-left: 1px solid #333333;
    overflow-y: auto;
    height: 100%;
}

.sidebar h2 {
    font-size: 14px;
    margin-bottom: 10px;
    color: #8b949e;
    letter-spacing: 1px;
}

.about {
    margin-bottom: 40px;
}

.about h2 {
    color: #c9d1d9 !important; /* ensure heading is visible against dark background */
    font-size: 14px;
    margin-bottom: 8px;
    letter-spacing: 1px;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.about p {
    font-size: 14px;
    line-height: 1.6;
    color: #8b949e;
}

.browse {
    margin-bottom: 30px;
}

/* TAGS */

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

.tags span {
    border: 1px solid #30363d;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: 0.2s;
}

.tags span:hover {
    border-color: #58a6ff;
}

/* ADD BUTTON */

.add-project {
    width: 85%;
    background-color: #ffffff;
    border: none;
    padding: 12px;
    padding-bottom: 10px;
    color: #000000;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 20px;
    transition: 0.2s;
}

.add-project:hover {
    background-color: #e6e6e6;
}

.footer {
    font-size: 13px;
    color: #8b949e;
}

/* MODAL */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background-color: #0d1117;
    border: 1px solid #30363d;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
}

.modal h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 20px;
    color: #c9d1d9;
}

.modal-input {
    width: 100%;
    padding: 12px;
    background-color: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    font-size: 14px;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.modal-input:focus {
    outline: none;
    border-color: #58a6ff;
}

.modal-preview {
    display: none;
    margin-bottom: 20px;
}

.modal-preview.show {
    display: block;
}

.modal-preview .card {
    margin: 0;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: 0.2s;
}

.modal-button.primary {
    background-color: #ffffff;
    color: #000000;
}

.modal-button.primary:hover {
    background-color: #e6e6e6;
}

.modal-button.primary:disabled {
    background-color: #6e7681;
    color: #484f58;
    cursor: not-allowed;
}

.modal-button.secondary {
    background-color: transparent;
    color: #c9d1d9;
    border: 1px solid #30363d;
}

.modal-button.secondary:hover {
    border-color: #8b949e;
}

.modal-error {
    display: none;
    color: #f85149;
    font-size: 14px;
    margin-bottom: 16px;
}

.modal-error.show {
    display: block;
}

/* SKELETON LOADING */
.skeleton-card {
    background: #161b22;
    border-color: #22262c;
    position: relative;
    overflow: hidden;
}
.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #23272e;
    border: none;
}
.skeleton-title {
    width: 180px;
    height: 18px;
    background: #23272e;
    border-radius: 4px;
    margin-bottom: 12px;
}
.skeleton-desc {
    width: 100%;
    height: 14px;
    background: #23272e;
    border-radius: 4px;
    margin-bottom: 16px;
}
.skeleton-meta {
    width: 120px;
    height: 12px;
    background: #23272e;
    border-radius: 4px;
}
.skeleton-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -120px;
    width: 100px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.07), transparent);
    animation: skeleton-shimmer 1.2s infinite;
}
@keyframes skeleton-shimmer {
    0% { left: -120px; }
    100% { left: 100%; }
}
/* =========================================
   MOBILE RESPONSIVENESS
   Mimics goodfirstissue.dev behavior
========================================= */

@media (max-width: 900px) {

    /* Allow page scrolling */
    body {
        height: auto;
        overflow: auto;
    }

    .container {
        flex-direction: column;
        height: auto;
        overflow: visible;
        gap: 0;
        padding: 0 20px;
        margin: 0 auto;
    }

    /* -------------------------
       NAV / HEADER
    ------------------------- */

    .logo {
        font-size: 24px;
        margin-top: 20px;
        margin-bottom: 0;
        padding-bottom: 16px;
        border-bottom: 1px solid #333333;
    }

    /* -------------------------
       SIDEBAR → TOP SECTION
    ------------------------- */

    .sidebar {
        order: -1; /* moves above cards */
        border-left: none; /* remove vertical separator */
        padding-left: 0;
        height: auto;
        overflow: visible;
        margin-top: 20px;
        padding-bottom: 20px;
        border-bottom: 1px solid #333333; /* separator under ABOUT */
    }

    /* ABOUT now feels like page intro */
    .about {
        margin-bottom: 20px;
    }

    /* ADD PROJECT button full width on mobile */
    .add-project {
        width: 100%;
    }

    /* -------------------------
       MAIN CONTENT
    ------------------------- */

    .main-content {
        overflow: visible;
    }

    .cards-wrapper {
        overflow: visible;
        padding-right: 0;
        padding-top: 20px;
    }

    /* -------------------------
       CARDS MOBILE LAYOUT
    ------------------------- */

    .card {
        padding: 16px;
    }

    .card-header {
        flex-direction: column;
        gap: 12px;
    }

    .owner-avatar {
        width: 40px;
        height: 40px;
    }

    .card h3 {
        font-size: 16px;
    }

    .meta span {
        margin-left: 10px;
    }

    /* -------------------------
       TAGS WRAP NICELY
    ------------------------- */

    .tags {
        gap: 8px;
    }

    .tags span {
        font-size: 12px;
        padding: 5px 10px;
    }

    /* -------------------------
       MODAL MOBILE
    ------------------------- */

    .modal {
        width: 95%;
        padding: 18px;
    }

}
