.fuel-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: flex-start; /* Changed from center to allow scrolling from top */
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(10px);
    padding: 40px 20px;
    overflow-y: auto; /* Allow the modal overlay to scroll */
}

.fuel-modal.active {
    display: flex;
}

.fuel-form-container {
    background: var(--surface, #151515);
    width: 100%;
    max-width: 500px;
    padding: 35px;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
    margin-bottom: 40px; /* Space at bottom when scrolling */
}

.fuel-form-header {
    text-align: center;
    margin-bottom: 30px;
    padding-right: 40px; /* Space for the close button on mobile */
    padding-left: 40px;
}

@media (max-width: 480px) {
    .fuel-form-header {
        padding-top: 10px;
        margin-bottom: 20px;
    }
}

.fuel-form-header h2 {
    color: var(--primary, #FF6B35);
    font-size: 24px; /* Slightly smaller for mobile compatibility */
    font-weight: 700;
    letter-spacing: -0.02em;
}

.fuel-form-group {
    margin-bottom: 20px;
    position: relative;
    display: flex;
    background: var(--input, #1f1f1f);
    border-radius: 12px;
    overflow: hidden;
    align-items: center;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    transition: border-color 0.3s ease;
}

.fuel-form-group:focus-within {
    border-color: var(--primary, #FF6B35);
}

.fuel-form-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary, #FF6B35);
    border-right: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    font-size: 18px;
    flex-shrink: 0;
}

.fuel-form-input {
    flex: 1;
    border: none;
    padding: 12px 15px;
    font-size: 15px;
    color: var(--text, #ffffff);
    outline: none;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    height: 50px; /* Ensure all inputs match the icon height */
    box-sizing: border-box;
}

/* Ensure Date and Time inputs have identical padding and icon positioning */
input[type="date"].fuel-form-input,
select.fuel-form-input {
    display: flex;
    align-items: center;
}

/* Hide native date icon on some browsers to prevent duplication */
input[type="date"]::-webkit-calendar-picker-indicator {
    background: transparent;
    bottom: 0;
    color: transparent;
    cursor: pointer;
    height: auto;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    width: auto;
}

select.fuel-form-input option {
    background: var(--surface-secondary, #232323);
    color: var(--text, #ffffff);
    padding: 10px;
}

.fuel-form-input::placeholder {
    color: var(--placeholder, #707070);
}

.fuel-form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23FF6B35' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
    cursor: pointer;
}

.location-label {
    color: var(--text-secondary, #c7c7c7);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
    display: block;
    font-weight: 600;
}

.fuel-type-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.fuel-type-btn {
    width: 100%;
    background: var(--surface-secondary, #232323);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    text-align: left;
}

.fuel-type-btn:hover:not(:disabled) {
    border-color: rgba(255, 107, 53, 0.65);
    transform: translateY(-1px);
}

.fuel-type-btn.active {
    background: var(--primary, #FF6B35);
    border-color: var(--primary, #FF6B35);
    box-shadow: none;
}

.fuel-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary, #FF6B35);
    font-size: 16px;
    flex-shrink: 0;
}

.fuel-type-btn.active .fuel-icon {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.fuel-type-btn .fuel-name {
    color: var(--text, #ffffff);
    font-weight: 600;
    font-size: 16px;
    flex: 1;
    min-width: 90px;
}

.fuel-meta {
    width: 100%;
    color: var(--text-secondary, #c7c7c7);
    font-size: 12px;
    line-height: 1.4;
    padding-left: 48px;
}

.fuel-meta strong {
    color: var(--text, #ffffff);
    float: right;
}

.availability-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 6px;
    border-radius: 50%;
    background: #49d17d;
}

.fuel-type-btn.active .fuel-meta {
    color: rgba(255, 255, 255, 0.82);
}

.fuel-type-btn.unavailable {
    cursor: not-allowed;
    opacity: 0.48;
    filter: grayscale(0.7);
}

/* A grade that is not sold yet is still worth advertising, so it is dimmed
   less than one that is genuinely out of stock. */
.fuel-type-btn.coming-soon {
    opacity: 0.66;
    filter: grayscale(0.35);
}

.fuel-type-btn.coming-soon .fuel-meta {
    color: var(--primary, #ff6b35);
    font-weight: 600;
}

/* Stepper Input Styles */
.amount-input-stepper {
    display: flex;
    align-items: center;
    background: var(--surface-secondary, #232323);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
    border-radius: 16px;
    padding: 8px;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

.stepper-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text, #ffffff);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stepper-btn:hover {
    background: var(--primary, #FF6B35);
    color: #ffffff;
}

.amount-input-stepper input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text, #ffffff);
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    outline: none;
    width: 60px;
}

/* Hide arrows/spinners */
.amount-input-stepper input::-webkit-outer-spin-button,
.amount-input-stepper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.order-summary {
    background: var(--surface-secondary, #232323);
    border-radius: 16px;
    padding: 20px;
    margin: 24px 0;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    color: var(--text-secondary, #c7c7c7);
    font-size: 14px;
}

.summary-divider {
    height: 1px;
    background: var(--border, rgba(255, 255, 255, 0.08));
    margin: 12px 0;
}

.summary-row.total-row {
    color: var(--text, #ffffff);
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 0;
}

.total-row #summary-total {
    color: var(--primary, #FF6B35);
    font-size: 22px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.fuel-submit-btn {
    width: 100%;
    background: var(--primary, #FF6B35);
    color: #ffffff;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px 0 rgba(255, 107, 53, 0.39);
}

.fuel-submit-btn:hover {
    background: var(--primary-dark, #D94F24);
    transform: translateY(-2px);
    box-shadow: none;
}

.fuel-submit-btn:active {
    transform: translateY(0);
}

.fuel-submit-btn:disabled {
    cursor: wait;
    opacity: 0.75;
    transform: none;
}

.order-form-note,
.order-form-status,
.fuel-price-status {
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
}

.order-form-note {
    color: var(--text-secondary, #c7c7c7);
    margin: 14px 0 0;
}

.order-form-status {
    min-height: 20px;
    margin: 10px 0 0;
}

.order-form-status.error {
    color: #ff8b7b;
}

.order-form-status.success {
    color: #69df9b;
}

.fuel-price-status {
    color: var(--text-secondary, #c7c7c7);
    margin: -12px 0 20px;
}

.fuel-price-status.error {
    color: #ff8b7b;
}

.fuel-price-status.success {
    color: #69df9b;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    color: var(--text-secondary, #c7c7c7);
    background: var(--surface-secondary, #232323);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 2010; /* Ensure it stays above everything */
}

.close-modal:hover {
    background: var(--primary, #FF6B35);
    color: #ffffff;
    border-color: var(--primary, #FF6B35);
}

/* WhatsApp Ordering Button (Hero) */
.btn-whatsapp {
    background-color: #25d366;
    color: white !important;
    padding: 16px 32px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: bold;
    font-size: 18px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(37, 211, 102, 0.2);
}

.btn-whatsapp:hover {
    background-color: #1DA851; /* True dark green, removing the teal/blue tint */
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(37, 211, 102, 0.3);
}

@media (max-width: 480px) {
    .fuel-form-container {
        padding: 25px;
    }
    .fuel-type-container {
        grid-template-columns: 1fr;
    }
    .grid-2 {
        grid-template-columns: 1fr;
    }
}
