/* Body */

body {
    background-color: #121212;
    color: #ffffff;
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

body.light-mode {
    background-color: #f9f9f9;
    color: #000000;
}

/* Header */

header {
    background-color: #1e1e1e;
    color: #ffffff;
    padding: 1em;
    width: 100%;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5em;
}

header h1 {
    margin: 0;
    font-size: 2em;
    color: #f44336;
}

header.light-mode {
    background-color: #ffffff;
    color: #333333;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); 
}

/* Main & Layout */

main {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1600px;
    padding-top: 3em;
    padding-bottom: 3em;
}

#card-display, #collection-display {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1em;
    width: 100%;
}

#empty-message{
    text-align: center;
    margin-top: 10em;
    font-size: 2em;
}

/* Card Styles */

.card {
    background-color: #333;  
    color: #fff;             
    border: 1px solid #444;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 1em;
    text-align: center;
    transition: transform 0.2s;
}

.card:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.card h3 {
    font-size: 1.6em;
    color: #fff;
}

.card img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 0.5em 0;
}

.card p {
    font-size: 1em;
    color: #ccc;
    margin: 0.7em;
}

/* Inputs & Filters */

#search-input, #set-filter{
    width: 100%;
    max-width: 300px;
    padding: 0.5em 1em;
    font-size: 1em;
    border: 1px solid #444;
    border-radius: 5px;
    background-color: #333;
    color: #fff;
    transition: border-color 0.3s, background-color 0.3s;
    margin: 0.5em;
}

#search-input:focus, #set-filter:focus {
    outline: none;
    border-color: #f44336;
    background-color: #444;
}

#search-input::placeholder {
    color: #bbb;
}

select.grade-dropdown{
    max-width: 200px;
    padding: 0.5em 0.8em;
    font-size: 1em;
    border: 1px solid #444;
    border-radius: 5px;
    background-color: #333;
    color: #fff;
}

.grade-container{
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Autocomplete */

.autocomplete-list {
    list-style: none;
    margin: 0;
    padding: 0;
    position: absolute;
    background-color: #222;
    border: 1px solid #444;
    border-radius: 5px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    width: 100%;
    max-width: 300px;
}

.autocomplete-list li {
    padding: 0.5em 1em;
    cursor: pointer;
    color: #fff;
}

.autocomplete-list li:hover {
    background-color: #444;
}

/* Buttons */

button {
    background-color: #1e1e1e;
    color: #fff;
    border: 1px solid #444;
    padding: 0.6em 1em;
    font-size: 1em;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s;
    margin-top: 0.6em;
}

button:hover {
    background-color: #f44336;
    border: 1px solid #f44336;
}

/* Toggle Switch */

#toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 150px;
    margin: 20px auto;
}

.icon {
    font-size: 1.5em;
    color: white;
    transition: color 0.3s ease;
}

.moon {
    color: #f39c12;
}

.sun {
    color: #f1c40f;
}

#toggle-switch {
    width: 50px;
    height: 25px;
    background: #555;
    border-radius: 50px;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 3px;
    transition: background 0.3s ease;
}

#toggle-knob {
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    position: absolute;
    left: 3px;
    transition: transform 0.3s ease;
}

body.light-mode #toggle-switch {
    background: #f44336;
}

body.light-mode #toggle-knob {
    transform: translateX(25px);
}

/* Modal Styles */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: #222;
    color: white;
    padding: 2em;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    position: relative;
    text-align: center;
}

.modal-content img {
    transition: transform 0.3s ease, max-height 0.3s ease;
    cursor: zoom-in;
    max-height: 300px;
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    margin-bottom: 1em;
}

.modal-content img.zoomed {
    transform: scale(1.25);
    cursor: zoom-out;
    max-height: none;
    z-index: 1100;
}

.modal-content a {
    display: block;
    margin-top: 1em;
    color: #f44336;
    text-decoration: underline;
}

#modal-title {
    font-size: 3em;
}

.close-button {
    position: absolute;
    top: 0.5em;
    right: 1em;
    font-size: 1.5em;
    cursor: pointer;
}

/* Light Mode */

#search-input.light-mode, #set-filter.light-mode {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
}

#search-input.light-mode:focus, #set-filter.light-mode:focus {
    border-color: #f44336;
    background-color: #e0e0e0;
}

body.light-mode .autocomplete-list {
    background-color: #fff;
    border: 1px solid #ccc;
}

body.light-mode .autocomplete-list li {
    color: #000;
}

body.light-mode .autocomplete-list li:hover {
    background-color: #eee;
}

button.light-mode {
    background-color: #f44336;
    color: #ffffff;
    border: 1px solid #f44336;
}

button.light-mode:hover {
    background-color: #b13128;
    border-color: #b13128;
}

body.light-mode .card {
    background-color: #ffffff;
    color: #333333;
    border: 1px solid #dddddd;   
}

body.light-mode .card h3 {
    color: #000;
}

body.light-mode .card p {
    color: #333;
}

body.light-mode .card button {
    background-color: #f44336; 
    color: #ffffff;
    border: 1px solid #f44336;
}

body.light-mode .card button:hover {
    background-color: #b13128; 
    border-color: #b13128;
}

body.light-mode #set-filter {
    background-color: #ffffff;
    color: #333333;
}

body.light-mode #search-input {
    background-color: #ffffff;
    color: #333333;
}

body.light-mode button{
    background-color: #f44336; 
    color: #ffffff;
    border: 1px solid #f44336;
}

body.light-mode button:hover {
    background-color: #b13128; 
    border-color: #b13128;
}

body.light-mode select.grade-dropdown {
    background-color: #fff;
    color: #000;
    border: 1px solid #ccc;
}

body.light-mode .modal {
    background-color: rgba(255, 255, 255, 0.8);
    color: #000;
}

body.light-mode .modal .modal-content {
    background-color: #fff;
    color: #000;
    border: 1px solid #ccc;
}

body.light-mode .modal-content button {
    background-color: #f44336;
    border: 1px solid #f44336;
}

body.light-mode .modal-content button:hover {
    background-color: #b13128;
    border-color: #b13128;
}

/* Media Queries */

@media (min-width: 600px) {
    header h1 {
        font-size: 2.5em;
    }

    #search-input, #set-filter {
        width: 45%;
        margin: 1em;
    }

    #card-display {
        grid-template-columns: repeat(2, 1fr);
    }

    button {
        width: 45%;
        margin: 0.5em;
    }
}

@media (min-width: 768px) {
    #card-display {
        grid-template-columns: repeat(3, 1fr);
    }

    header {
        flex-direction: row;
        justify-content: space-between;
    }

    #search-input, #set-filter {
        width: 30%;
    }

    button {
        width: auto;
    }
}

@media (min-width: 1024px) {
    #card-display {
        grid-template-columns: repeat(7, 1fr);
    }

    header h1 {
        font-size: 3em;
        margin-left: 1.5em;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5em;
    }

    #search-input, #set-filter {
        max-width: 90%;
        font-size: 0.9em;
    }

    #card-display {
        grid-template-columns: repeat(2, 1fr);
    }

    button {
        width: 90%;
    }
}

@media (max-width: 768px) {
  #card-modal {
    display: none !important;
  }
}