/* General Body Styles */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    /* Set a slightly larger base font size. Default is 16px (100%). 106.25% = 17px. */
    font-size: 100%;
}

body {
    background-color: #f8fafc;
    /* bg-slate-50 */
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    /* p-4 */
    font-family: "Roboto", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    /* font-sans */
    color: #334155;
    /* text-slate-800 */
}

/* Main Container */
.container {
    max-width: 42rem;
    /* max-w-2xl (672px) */
    width: 100%;
    background-color: #ffffff;
    /* bg-white */
    border-radius: 1rem;
    /* rounded-2xl */
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    /* shadow-xl */
    overflow: hidden;
}

/* Header */
.header {
    background-color: #2563eb;
    /* bg-blue-600 */
    padding: 1rem;
    /* Increased padding for better spacing */
    color: #ffffff;
    /* text-white */
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    /* Align items to the top */
    flex-wrap: wrap;
    /* Allow items to wrap on very small screens */
    gap: 0.5rem;
    /* Add a gap between wrapped items */
}

.header-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-basis: 70%;
    /* Allow title content to take up most of the space */
    flex-grow: 1;
}

.header-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    /* Align button and username to the right */
}

.btn-logout {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-logout:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.btn-logout i {
    margin-right: 0.5rem;
}

.username-display {
    color: #dbeafe;
    /* A lighter blue for contrast */
    font-size: 0.75rem;
    /* Smaller font size */
    font-weight: 500;
    text-align: right;
    margin-top: 0.25rem;
    /* Add a little space below the button */
}

.header-icon {
    font-size: 1.5rem;
    /* text-2xl */
}

.header-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.025em;
    line-height: 1.2;
    /* Adjust line height for potential wrapping */
}

.header-description {
    margin-top: 0rem;
    /* mt-2 */
    color: #bfdbfe;
    /* text-blue-100 */
    font-size: 0.875rem;
    /* text-sm */
}

/* Form */
.form-section {
    padding: 2rem;
    /* px-8 py-8 */
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    /* space-y-6 */
}

.status-message.success {
    background-color: #dcfce7;
    /* bg-green-100 */
    color: #16a34a;
    /* text-green-800 */
    border-color: #bbf7d0;
    /* border-green-200 */
}

/* Form Grid Layout */
.form-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    /* grid-cols-1 */
    gap: 1rem;
    /* gap-6 */
}

@media (min-width: 768px) {

    /* md breakpoint */
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        /* md:grid-cols-2 */
    }

    .form-grid-full {
        grid-column: span 2 / span 2;
        /* md:col-span-2 */
    }
}

/* Asset Info Display (inside the diesel meter field) */
#assetInfo {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    /* 12px */
    transform: translateY(-50%);
    background-color: #e2e8f0;
    /* slate-200 */
    color: #475569;
    /* slate-600 */
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Form Group */
.form-group {
    position: relative;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    /* text-sm */
    font-weight: 600;
    /* font-semibold */
    color: #334155;
    /* text-slate-700 */
    margin-bottom: 0.25rem;
    /* mb-1 */
}

.form-group .required-star {
    color: #ef4444;
    /* text-red-500 */
}

.form-group .optional-text {
    color: #94a3b8;
    /* text-slate-400 */
    font-weight: 400;
    /* font-normal */
    font-size: 0.75rem;
    /* text-xs */
}

.input-with-icon {
    position: relative;
}

.input-icon {
    position: absolute;
    top: 50%;
    left: 0.75rem;
    /* pl-3 */
    transform: translateY(-50%);
    pointer-events: none;
    color: #94a3b8;
    /* text-slate-400 */
}

.input-field {
    width: 100%;
    padding: 0.625rem 1rem;
    /* The padding-left for inputs with icons is handled below */
    /* For inputs without an icon, this is the default padding */
    /* For inputs with an icon, this will be overridden */

    /* px-4 py-2.5 */
    border-radius: 0.5rem;
    /* rounded-lg */
    border: 1px solid #cbd5e1;
    /* border border-slate-300 */
    outline: none;
    color: #334155;
    /* text-slate-700 */
    font-size: 1rem;
    /* 16px */
    background-color: #f8fafc;
    /* bg-slate-50 */
    transition: all 0.3s ease;
}

/* Add specific padding for inputs inside .input-with-icon */
.input-with-icon .input-field {
    padding-left: 2.5rem;
    /* pl-10 */
}

.input-field:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border-color: #3b82f6;
    /* focus:border-blue-500 */
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
    /* focus:ring-2 focus:ring-blue-500 */
    background-color: #ffffff;
    /* focus:bg-white */
}

/* Ensure date input doesn't overflow on mobile */
input[type="date"].input-field {
    width: 100%;
    box-sizing: border-box;
    /* Include padding and border in the element's total width */
}

textarea.input-field {
    resize: none;
}

.input-field.uppercase {
    text-transform: uppercase;
}

/* Form Actions */
.form-actions {
    padding-top: 1rem;
    /* pt-4 */
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    gap: 0.75rem;
    /* gap-3 */
}

.btn {
    padding: 0.625rem 1rem;
    /* px-4 py-2.5 */
    border-radius: 0.5rem;
    /* rounded-lg */
    font-weight: 500;
    /* font-medium */
    transition: all 0.2s ease-in-out;
    border: solid 1px rgb(180, 180, 180);
    cursor: pointer;
}

.btn-reset {
    border: 1px solid #cbd5e1;
    /* border border-slate-300 */
    color: #475569;
    /* text-slate-600 */
    background-color: #ffffff;
}

.btn-reset:hover {
    background-color: #f8fafc;
    /* hover:bg-slate-50 */
}

.btn-reset:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(203, 213, 225, 0.5);
    /* focus:ring-2 focus:ring-slate-200 */
}

.btn-submit {
    padding: 0.625rem 2rem;
    /* px-8 py-2.5 */
    background-color: #2563eb;
    /* bg-blue-600 */
    color: #ffffff;
    /* text-white */
    box-shadow: 0 10px 15px -3px rgba(255, 255, 255, 0.3), 0 4px 6px -2px rgba(37, 99, 235, 0.05);
    /* shadow-lg shadow-blue-600/30 */
}

.btn-submit:hover {
    background-color: #1d4ed8;
    /* hover:bg-blue-700 */
}

.btn-submit:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5), 0 0 0 4px rgba(59, 130, 246, 0.25);
    /* focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 */
}

.btn-submit .icon-right {
    margin-left: 0.5rem;
    /* ml-2 */
}

/* Autocomplete / Typeahead Styles */
.autocomplete {
    position: relative;
}

.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    /* Position it right below the input field */
    left: 0;
    right: 0;
    z-index: 10;
    /* Ensure it floats above other elements */
    background-color: #ffffff;
    /* bg-white */
    border: 1px solid #e2e8f0;
    /* border-slate-200 (soft border) */
    border-radius: 0.5rem;
    /* rounded-lg */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    /* shadow-lg */
    margin-top: 0.25rem;
    /* 4px space from the input */
    max-height: 15rem;
    /* Limit height and allow scrolling */
    overflow-y: auto;
    display: none;
    /* Hidden by default */
}

.autocomplete-suggestions div {
    padding: 0.75rem 1rem;
    /* px-4 py-3 */
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.autocomplete-suggestions div:hover {
    background-color: #f1f5f9;
    /* hover:bg-slate-100 */
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    /* top-0 right-0 bottom-0 left-0 */
    background-color: rgba(0, 0, 0, 0.5);
    /* bg-black bg-opacity-50 */
    display: none;
    /* hidden */
    align-items: center;
    justify-content: center;
    padding: 1rem;
    /* p-4 */
    z-index: 50;
    /* z-50 */
}

.modal-content {
    position: relative;
    background-color: #ffffff;
    /* bg-white */
    border-radius: 0.5rem;
    /* rounded-lg */
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    /* shadow-xl */
    max-width: 24rem;
    /* max-w-sm */
    width: 100%;
    padding: 1.5rem;
    /* p-6 */
    text-align: center;
}

.modal-icon-wrapper {
    margin-left: auto;
    margin-right: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 3rem;
    /* h-12 */
    width: 3rem;
    /* w-12 */
    border-radius: 9999px;
    /* rounded-full */
}

.modal-icon {
    font-size: 1.25rem;
    /* text-xl */
}

.modal-icon-wrapper.warning {
    background-color: #fffbeb;
    /* bg-yellow-100 */
}

.modal-icon.warning {
    color: #d97706;
    /* text-yellow-600 */
}

.modal-icon-wrapper.success {
    background-color: #dcfce7;
    /* bg-green-100 */
}

.modal-icon.success {
    color: #16a34a;
    /* text-green-600 */
}

.modal-icon-wrapper.error {
    background-color: #fee2e2;
    /* bg-red-100 */
}

.modal-icon.error {
    color: #dc2626;
    /* text-red-600 */
}

.modal-title {
    font-size: 1.125rem;
    /* text-lg */
    line-height: 1.5rem;
    /* leading-6 */
    font-weight: 500;
    /* font-medium */
    color: #111827;
    /* text-gray-900 */
    margin-top: 1rem;
    /* mt-4 */
}

.modal-close-btn {
    position: absolute;
    top: 0.5rem;
    /* top-2 */
    right: 0.5rem;
    /* right-2 */
    color: #6b7280;
    /* text-gray-500 */
}

.modal-close-btn:hover {
    color: #374151;
    /* hover:text-gray-700 */
}

.modal-body {
    margin-top: 0.5rem;
    /* mt-2 */
    padding: 0.75rem 1.75rem;
    /* px-7 py-3 */
}

.modal-body p {
    font-size: 0.875rem;
    /* text-sm */
    color: #6b7280;
    /* text-gray-500 */
}

.modal-actions {
    margin-top: 1rem;
    /* mt-4 */
    display: flex;
    flex-direction: column-reverse;
    /* flex-col-reverse */
    gap: 0.75rem;
    /* gap-3 */
}

.modal-btn {
    width: 100%;
    display: inline-flex;
    justify-content: center;
    border-radius: 0.375rem;
    /* rounded-md */
    border: 1px solid transparent;
    /* border border-transparent */
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    /* shadow-sm */
    padding: 0.5rem 1rem;
    /* px-4 py-2 */
    font-size: 1rem;
    /* text-base */
    font-weight: 500;
    /* font-medium */
    color: #ffffff;
    background-color: #2563eb;
    /* bg-blue-600 */
    transition: all 0.2s ease-in-out;
}

.modal-btn:hover {
    background-color: #1d4ed8;
    /* hover:bg-blue-700 */
}

.modal-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5), 0 0 0 4px rgba(59, 130, 246, 0.25);
    /* focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 */
}

.modal-btn.secondary {
    border-color: #d1d5db;
    /* border-gray-300 */
    background-color: #ffffff;
    /* bg-white */
    color: #374151;
    /* text-gray-700 */
}

.modal-btn.secondary:hover {
    background-color: #f9fafb;
    /* hover:bg-gray-50 */
}

.modal-btn.secondary:focus {
    box-shadow: 0 0 0 2px rgba(107, 114, 128, 0.5), 0 0 0 4px rgba(107, 114, 128, 0.25);
    /* focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 */
}

@media (min-width: 640px) {

    /* sm breakpoint */
    .modal-actions {
        flex-direction: row-reverse;
        /* sm:flex-row-reverse */
    }

    .modal-btn {
        width: auto;
        /* sm:w-auto */
        font-size: 0.875rem;
        /* sm:text-sm */
    }

    .modal-btn.secondary {
        margin-top: 0;
        /* sm:mt-0 */
    }

    /* Reduce header title font size on smaller screens to prevent wrapping issues */
    .header-title {
        font-size: 1.25rem;
        /* Make title smaller on mobile */
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

input[type="date"]::-webkit-inner-spin-button,
input[type="date"]::-webkit-calendar-picker-indicator {
    display: none;
    -webkit-appearance: none;
}