/* Reset & basics */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-body: #e9e7f5;
    --bg-body: #121018;

    --color-header: #ffffff;
    --bg-header: #3c2f5c;

    --color-sidebar: #d6d1eb;
    --bg-sidebar: #1a1625;
    --sidebar-border-color: #5b4b8a;

    --color-action-btn: #ffffff;
    --bg-action-btn: #6d5ba6;
    --bg-action-btn-hover: #5b4b8a;

    --accent: #a78bfa;
}

body {
    font-family: Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--color-body);
    display: flex;
    flex-direction: column;
    height: 100dvh;
}

#layout {
    display: flex;
    height: 100dvh;
}

/* Header */
header {
    padding: 1rem;
    background-color: var(--bg-header);
    color: var(--color-header);
}

.right {
    overflow-y: auto;
    flex: 1;
}

#sidebar {
    width: 200px;
    flex: 0 0 200px;
    height: 100dvh;
    padding: 1rem;
    overflow-y: auto;

    color: var(--color-sidebar);
    background-color: var(--bg-sidebar);
}

#sidebar input {
    width: 100%;
    height: 45px;
    padding: 0.5rem;
    margin-bottom: 1rem;
    font-size: 1rem;
    border-radius: 6px;
    border: 1px solid #ccc;
}

/* filter dropdown titles */
#sidebar h3 {
    margin-top: 1.75rem;      /* space ABOVE each "Filter by..." */
    margin-bottom: 0.4rem;    /* small space before the select */
    font-size: 1rem;
    color: inherit;
}

#sidebar h3:first-of-type {
    margin-top: 0;            /* no extra space at top */
}

/* filter dropdowns */
#sidebar select {
    width: 100%;
    font-size: 1.1rem;
    padding: 0.6rem 0.5rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    cursor: pointer;
    color:#3a3413;
    background-color: white;
}

#sidebar select:focus {
    outline: none;
    border-color: #4a90e2;
}

/* sidebar buttons */
#applyFilters {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--color-action-btn);
    background-color: var(--bg-action-btn);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s, transform 0.1s;
}

#applyFilters:hover {
    background-color: var(--bg-action-btn-hover);
    transform: translateY(-2px);
}

#toggleAllCollected {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    margin-top: 1.75rem;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--color-action-btn);
    background-color: var(--bg-action-btn);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s, transform 0.1s;
}

#toggleAllCollected:hover {
    background-color: var(--bg-action-btn-hover);
    transform: translateY(-2px); /* slight lift on hover */
}

/* Import & Export buttons */
#importCollected,
#exportCollected {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    margin-top: 1rem; /* slightly less than toggleAll for spacing */
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--color-action-btn);
    background-color: var(--bg-action-btn);
    border: none;
    border-radius: 6px; /* same as toggleAll */
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s, transform 0.1s;
}

#importCollected:hover,
#exportCollected:hover {
    background-color: var(--bg-action-btn-hover);
    transform: translateY(-2px); /* slight lift on hover */
}

.sidebar-link-button {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--color-action-btn);
    background-color: var(--bg-action-btn);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.1s;
}

.sidebar-link-button:hover {
    background-color: var(--bg-action-btn-hover);
    transform: translateY(-2px);
}

/* Card grid */
#cardGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

/* all content aside from header and sidebar */
.content {
    padding: 1rem;
}

/* individual card on main page */
.card {
    background: transparent;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
    position: relative;
}

.card img {
    width: 100%;
    height: auto;
    display: block;
}

/* card ID and name overlay on bottom of each card */
.card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.5);
}

/* card ID not the card name */ 
.card-title {
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

.card-content > div:not(.card-title) {
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}


/* Card detail page not main page*/
.card-detail {
    max-width: 500px;
    margin: 2rem auto;
    text-align: center;
}

.card-detail img {
    width: 100%;
    max-height: 600px;
    object-fit: contain;
    background: transparent;
    border-radius: 0;
}

.card-tags {
    font-size: 0.85rem;
    color: #666;
}

.card-detail .card-tags {
    margin-top: 0.5rem;
}

/* Info table */
.card-info-table {
    width: 100%;
    max-width: 500px;
    margin: 2rem auto;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.card-info-table th {
    background-color: #222;
    color: white;
    padding: 0.75rem;
    text-align: left;
    font-weight: bold;
    width: 30%;
}

.card-info-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #ddd;
    color: black;
}

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

.card-info-table a {
    color: #0066cc;
    text-decoration: none;
}

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

/* collected badge */

.collected-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(255,255,255,0.9);
    color: #666;
    border-radius: 50%;
    width: 36px;      /* bigger width */
    height: 36px;     /* bigger height */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;  /* bigger checkmark */
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.collected-badge:hover {
    transform: scale(1.1);
}

.collected-badge.active {
    background-color: #4caf50;
    color: white;
}

/* Back button */
.back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  
    width: 40px;
    height: 40px;
  
    border-radius: 50%;
    text-decoration: none;
  
    font-size: 20px;
    font-weight: bold;
  
    background-color: rgb(255, 255, 255);
    color: rgb(0, 0, 0);
  
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.back-button:hover {
    transform: scale(1.05);
}

#sidebarToggle {
    display: none;
}

/* Info page */
.info-main {
    padding: 2rem 1rem 3rem;
}

.info-container {
    max-width: 820px;
    margin: 0 auto;
    line-height: 1.6;
}

.info-intro {
    margin-bottom: 1.25rem;
}

.info-section {
    margin: 1rem 0;
    border: 1px solid var(--sidebar-border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    padding: 0.5rem 1rem;
}

.info-section summary {
    cursor: pointer;
    font-weight: bold;
    padding: 0.5rem 0;
}

.info-section-content {
    color: var(--color-body);
    padding-bottom: 0.75rem;
}

.info-section-content h3 {
    margin: 0.5rem 0;
}

.info-section-content p,
.info-section-content ul {
    margin: 0.5rem 0;
}

.info-section-content ul {
    padding-left: 1.25rem;
}

.info-section-content a {
    color: var(--accent);
}

/* MOBILE ONLY */
@media (max-width: 768px) {

    /* Sidebar becomes overlay */
    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        z-index: 1000;

        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    /* When open */
    #sidebar.open {
        transform: translateX(0);
    }

    /* Prevent content from shifting */
    #layout {
        position: relative;
    }

    /* Toggle button styling */
    #sidebarToggle {
        display: inline-block;
        padding: 0.5rem 0.75rem;
        font-size: 1.2rem;
        background: var(--bg-action-btn);
        color: var(--color-action-btn);
        border: none;
        border-radius: 6px;
        cursor: pointer;
        width: fit-content;
    }
}