/* Card and hover styling */
.card {
    border: none;
    border-radius: 10px;
    padding: 15px; /* Reduced padding for smaller layout */
    background-color: rgba(128, 128, 128, 0.1);
    max-width: 320px; /* Adjusted card size */
    margin: 10px;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    height: auto; /* Set height to auto to prevent clipping */
}

.card-body {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

/* Form check hover effect */
.form-check {
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease, border 0.3s ease;
    cursor: pointer;
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid transparent;
}

.form-check:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #dee2e6;
}

.form-check-label {
    cursor: pointer;
    display: inline-block;
    width: 100%;
    text-align: center;
    font-weight: 500;
    transition: color 0.3s ease;
    padding: 2px 0;
}

.form-check:hover .form-check-label {
    color: #007bff;
}

.form-check-input {
    margin-right: 5px;
}

.icon-container img {
    height: 120px; /* Reduced image size */
    width: 100%; /* Ensure image fills container width */
    object-fit: contain;
}

.card-title {
    font-size: 1.1rem; /* Slightly smaller font */
    font-weight: bold;
    text-align: center;
}

.card-text {
    font-size: 0.9rem; /* Slightly smaller text */
    margin-bottom: 10px; /* Reduced margin */
    text-align: center;
}

.container {
    margin-top: 20px;
    margin-bottom: 20px;
}

/* Modal styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 400px;
    text-align: center;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
}

/* Responsive styling */
@media (max-width: 768px) {
    .card {
        max-width: 280px; /* Reduced card width for smaller screens */
        margin: 10px auto; /* Center the card */
    }

    .icon-container img {
        height: 120px; /* Maintain image size for mobile */
        width: 100%; /* Ensure image fills the container */
    }

    .card-title {
        font-size: 1rem; /* Smaller font for mobile */
    }

    .card-text {
        font-size: 0.85rem; /* Smaller text size */
    }

    .container {
        margin-top: 15px; /* Reduced container margins */
        margin-bottom: 15px;
    }

    /* Ensure full-width checkboxes and buttons on mobile */
    .form-check-label {
        font-size: 0.85rem; /* Smaller font for labels */
    }

    #orderButton {
        font-size: 1rem; /* Slightly smaller font */
        padding: 10px 15px; /* Reduced button padding */
    }
}

@media (max-width: 576px) {
    /* Make sure cards take up full width on smaller devices */
    .card {
        max-width: 100%; /* Full width for small screens */
        margin: 10px 0; /* Center the card */
    }

    .icon-container img {
        height: 100px; /* Even smaller image size on very small screens */
    }

    .card-body {
        padding: 10px; /* Reduced padding */
    }

    .card-title {
        font-size: 0.9rem; /* Even smaller font for mobile */
    }

    .card-text {
        font-size: 0.8rem; /* Even smaller text size */
    }

    .container {
        margin-top: 10px;
        margin-bottom: 10px;
    }

    /* Ensure full-width checkboxes and buttons on mobile */
    #orderButton {
        font-size: 0.9rem; /* Even smaller font on small devices */
        padding: 8px 12px; /* Reduced button padding */
    }
}

/* Card selected state */
.card:has(.form-check-input:checked),
.card.selected {
    background-color: rgba(0, 123, 255, 0.15) !important; /* Increased opacity and !important to override base style */
}

/* Ensure the hover effect still works on selected cards */
.card:has(.form-check-input:checked):hover,
.card.selected:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
    background-color: rgba(0, 123, 255, 0.2) !important; /* Slightly darker on hover */
}

/* Fallback for browsers that don't support :has() */
.form-check-input:checked {
    accent-color: #007bff;
}
