/* Base deckbuilder styling */
body * {
    text-align: left;
}
h1, button {
    text-align: center;
}
.container {
    display: flex;
    gap: 20px; /* Horizontal spacing between columns */
    /* By default, we want them side by side for desktop */
    flex-direction: row;
}

/* Give each section a specific width on desktop */
.card-grid-container {
    width: 60%;
}
.form-container {
    width: 40%;
}

/* Input groups and general form elements */
.input-group {
    margin-bottom: 12px;
    width: 100%;
}
label {
    display: block;
    font-size: 12px;
    margin-bottom: 5px;
}
input[type="text"],
textarea,
select {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    color: #f5f5f5;
    background-color: #555;
    border: 1px solid #ccc;
    border-radius: 5px;
}
textarea {
    height: 250px;
    resize: none;
}
#save-btn, #export-btn, #upload-btn {
    font-family: 'Roboto Slab', serif;
    font-size: 16px;
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
}
.card-validation-error {
    color: lightcoral;
    margin-top: 10px;
    font-size: 14px;
}
.card-count {
    margin-top: 10px;
    font-size: 14px;
    color: #f5f5f5;
}

/* Card list and items */
.search-bar {
    margin-bottom: 10px;
}
.search-bar input {
    width: 100%;
    padding: 6px;
    font-size: 14px;
    color: #f5f5f5;
    background-color: #555;
    border: 1px solid #ccc;
    border-radius: 5px;
}
.card-list {
    max-height: 800px;
    overflow-y: auto;
    border: 1px solid #444;
    padding: 10px;
    background-color: #1f1f1f;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}
.card-list-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px;
    background-color: #2e2e2e;
    border-radius: 5px;
    border: 1px solid #444;
    transition: transform 0.3s ease;
    cursor: pointer;
}
.card-list-item img {
    width: 100%;
    height: auto;
    margin-bottom: 5px;
    border-radius: 5px;
}
.card-list-item:hover {
    transform: scale(1.1);
}
.card-list-item label {
    font-size: 14px;
    text-align: center;
}

/* New horizontal filters */
.filters.horizontal-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.filters.horizontal-filters select,
.filters.horizontal-filters label {
    background-color: #444;
    color: #f5f5f5;
    padding: 5px;
    border-radius: 5px;
    border: 1px solid #ccc;
}
.filters.horizontal-filters label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

/* Button for clearing filters */
#clear-filter-btn {
    font-family: 'Roboto Slab', serif;
    font-size: 16px;
    padding: 8px 12px;
    background-color: #888;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

/* Modal / Card details styles */
.card-details {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.9);
    padding: 20px;
    border-radius: 8px;
    z-index: 10;
    width: 80%;
    max-width: 800px;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}
.card-details.show {
    display: flex;
    opacity: 1;
}
.card-content {
    display: flex;
    align-items: flex-start;
    position: relative;
}
.card-details img {
    width: 300px;
    height: auto;
    margin-right: 20px;
    border: 1px solid #ccc;
    border-radius: 5px;
}
.card-details .details * {
    flex-grow: 1;
    text-align: left;
    margin: 8px;
}
.close-btn {
    position: absolute;
    background-color: #444;
    color: white;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    top: 10px;
    right: 10px;
}
.close-btn:hover {
    background-color: #666;
}
.button-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
}
.card-quantity-input {
    width: 80px;
    height: 40px;
    font-size: 18px;
    text-align: center;
    color: #f5f5f5;
    background-color: #555;
    border: 1px solid #ccc;
    border-radius: 5px;
}
.add-to-deck-btn {
    background-color: #007BFF; /* Blue color */
    color: white;
    border: none;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    width: 50%;  /* Half width */
    min-width: 100px;
}

/* Custom keyword popup */
.keyword-popup {
    position: absolute;
    background-color: tan;
    color: brown;
    font-family: "Californian FB", serif;
    border: 1px solid brown;
    padding: 10px;
    border-radius: 5px;
    z-index: 100000;
    box-shadow: 0px 0px 10px rgba(0,0,0,0.3);
}
.popup-close-btn {
    background: none;
    border: none;
    font-weight: bold;
    cursor: pointer;
    float: right;
    color: brown;
}
strong.keyword {
    cursor: pointer;
    text-decoration: none;
}
strong.keyword:hover {
    text-decoration: underline;
}

/* Mobile: reorder so the card-grid-container is on top, form-container is below. 
   Also force card list into 2 columns. */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        width: 100%;
    }
    .card-grid-container {
        order: 1;
        width: 100% !important;
        margin-right: 0;
    }
    .form-container {
        order: 2;
        width: 100% !important;
        margin-right: 0;
    }
    .card-list {
        grid-template-columns: repeat(2, 1fr) !important;
        width: 100%;
    }
    .card-details {
        width: 95vw;
        max-height: 90vh;
    }
}

#class-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
}

#class-image {
    max-width: 50%;
    height: auto;
    display: none;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}