/* ===================== Global Styles ===================== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    max-width: 1000px;
    margin: auto;
    padding: 20px;
    background-color: #2c2c2c;
    color: #f0f0f0;
}

h1,
h2 {
    text-align: center;
    font-weight: 600;
    margin-bottom: 20px;
    color: #ffffff;
}

form {
    text-align: center;
    margin-bottom: 30px;
}

/* ===================== Comic Collection / Scanned Comic Grid ===================== */
.scanned-comic,
.comic-collection {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    justify-items: center;
}

.comic-card {
    background-color: #3c3c3c;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    padding: 15px;
    text-align: center;
    transition: transform 0.2s;
}

.comic-card:hover {
    transform: translateY(-4px);
}

/* Comic cover images */
.comic-card img {
    max-width: 140px;
    max-height: 180px;
    object-fit: contain;
    border-radius: 6px;
    margin-bottom: 10px;
    cursor: pointer;
}

/* ===================== Buttons ===================== */
.comic-card button {
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s ease;
}

/* Navigation Buttons */
.nav-button {
    background-color: #444;
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    text-decoration: none;
    margin-left: 8px;
}

.nav-button:hover {
    background-color: #666;
}

/* Collection Button */
.collection-button {
    display: inline-block;
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
}

.collection-button:hover {
    background-color: #0056b3;
}

/* Custom File Input Button */
.file-button {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 6px;
    background-color: #28a745 !important;
    color: white;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    margin-top: 10px;
}

.file-button:active {
    background-color: #218838 !important;
}

/* Sort Dropdown */
#sortSelect {
    padding: 8px 12px;
    border-radius: 6px;
    border: none;
    font-weight: 500;
    font-size: 14px;
    outline: none;
    color: #ffffff;
    background-color: #007BFF;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 150px;
}

#sortSelect:focus {
    background-color: #3399ff;
}

/* Search Input */
#searchInput {
    padding: 8px 12px;
    border-radius: 6px;
    border: none;
    font-weight: 500;
    font-size: 14px;
    outline: none;
    color: #000000;
    background-color: #ffffff;
    cursor: text;
    width: 220px;
}

#searchInput:focus {
    background-color: #f0f0f0;
}

/* Top-right auth buttons */
.top-right {
    position: absolute;
    top: 20px;
    right: 30px;
}

/* ===================== Edit/Delete Buttons ===================== */
.card-buttons {
    display: flex;
    gap: 5px;
    /* small space between buttons */
    margin-top: 10px;
}

.card-buttons button,
.card-buttons .delete-form {
    flex: 1;
    /* both Edit button and form take equal width */
    display: flex;
    /* ensures children stretch */
    justify-content: center;
    /* center horizontally */
    align-items: center;
    /* center vertically */
}

.card-buttons .delete-form button {
    flex: 1;
    /* Delete button fills the form */
}

/* Edit Button */
.edit-button {
    background-color: #ffc107;
    color: #000;
    padding: 10px 0;
    font-size: 14px;
}

.edit-button:hover {
    background-color: #e0a800;
}

/* Delete Button */
.delete-button {
    background-color: #dc3545;
    color: #fff;
    padding: 10px 0;
    font-size: 14px;
}

.delete-button:hover {
    background-color: #b02a37;
}

/* ===================== Modal Styles ===================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
    background-color: #3c3c3c;
    margin: 10% auto;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    color: #fff;
}

.modal-content input {
    width: 100%;
    padding: 8px 10px;
    margin: 8px 0;
    border-radius: 6px;
    border: none;
    font-size: 14px;
}

.modal-content button {
    margin-top: 10px;
    width: 100%;
}

/* Close Button */
.close {
    color: #aaa;
    float: right;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #fff;
}

/* ===================== Mobile Responsiveness ===================== */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .comic-card {
        width: 90%;
        padding: 10px;
    }

    .comic-card img {
        max-width: 80%;
        max-height: 160px;
    }

    .comic-card p {
        font-size: 14px;
    }

    .comic-card button {
        padding: 8px 14px;
        font-size: 14px;
    }

    #sortSelect,
    #searchInput {
        width: 80%;
        margin: 5px auto;
        display: block;
        font-size: 14px;
    }

    .nav-button,
    .collection-button {
        width: 80%;
        display: block;
        text-align: center;
        margin: 5px auto;
        padding: 10px 0;
    }

    .top-right {
        position: static;
        text-align: center;
        margin-bottom: 15px;
    }

    .card-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .card-buttons button,
    .card-buttons .delete-form {
        flex: 1;
        display: flex;
    }

    .card-buttons .delete-form button {
        flex: 1;
    }
}