/* === 1. Base Reset & Typography === */
:root {
    --font-size-base: 0.9rem !important;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Public Sans", sans-serif;
    font-optical-sizing: auto;
    height: 100%;
    font-size: 0.9rem !important;
    font-weight: 400;
    line-height: 1.2;
}

/* === 2. Layout Containers === */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

.container {
    max-width: 1400px;
}

@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }
}

/* === 3. Navbar/Header === */
.navbar {
    font-weight: 510;
    padding: 0.5rem 1rem;
    background: linear-gradient(to right, #265fb7, #6a398e, #b90aa9);
}

.navbar-brand img {
    max-height: 40px;
    height: auto;
}

.navbar-nav {
    flex-wrap: wrap;
}

.nav-item a {
    font-size: 0.85rem;
}

.btn {
    font-size: 0.9rem !important;
}

/* === 4. Form Elements === */
.btn-default {
    background-color: #f0f0f0;
}

.ks-form-control {
    width: auto;
    display: inline;
}

.form-control {
    height: calc(2.19rem + -5px);
    border: 1px solid #aaaaaa;
    font-size: var(--font-size-base) !important;
}

.h-form {
    height: calc(2.19rem + -5px);
    font-size: var(--font-size-base) !important;
}

.select2-container.is-invalid {
    border-color: #dc3545;
}

.invalid-feedback-cus {
    width: 100%;
    margin-top: 0.25rem;
    font-size: 80%;
    color: #dc3545;
}

.ui-datepicker {
    z-index: 9999 !important;
}

/* === 5. Dropdowns & Language Flags === */
.dropdown-menu {
    font-size: 0.85rem;
}

.dropdown-submenu {
    position: relative;
}

.dropdown-submenu > .dropdown-menu {
    top: 0;
    left: 100%;
    margin-top: -0.125rem;
}

.dropdown-submenu:hover > .dropdown-menu {
    display: block;
}

.dropdown-submenu > a::after {
    float: right;
    margin-left: 5px;
}

.lang-sm-my,
.lang-sm-en {
    min-width: 22px;
    height: 16px;
    min-height: 16px;
    max-height: 16px;
    background-repeat: no-repeat;
    display: inline-block;
}

.lang-sm-my {
    background-image: url("/images/my.svg");
}

.lang-sm-en {
    background-image: url("/images/gb.svg");
}

/* === 6. Background Color Themes === */

/* Solid Nudes */
.bg-nude-red {
    background: #ff6c3e !important;
}
.bg-nude-yellow {
    background: #e8e34d !important;
}
.bg-nude-green {
    background: #55ca53 !important;
}

/* Nude Pastels */
.bg-nude2-yellow {
    background: #faedcb !important;
}
.bg-nude2-green {
    background: #c9e4de !important;
}
.bg-nude2-blue {
    background: #c6def1 !important;
}
.bg-nude2-purple {
    background: #dbcdf0 !important;
}
.bg-nude2-pink {
    background: #f2c6de !important;
}
.bg-nude2-orange {
    background: #f7d9c4 !important;
}

.bg-nude3-1 {
    background: #f8f3e8 !important;
}
.bg-nude3-2 {
    background: #e6f8f6 !important;
}
.bg-nude3-3 {
    background: #f8dbb8 !important;
}
.bg-nude3-4 {
    background: #cde8e6 !important;
}
.bg-nude3-5 {
    background: #f6c7b3 !important;
}
.bg-nude3-6 {
    background: #add5d0 !important;
}
.bg-nude3-7 {
    background: #eadbdd !important;
}
.bg-nude3-8 {
    background: #fcd5ce !important;
}
.bg-nude3-9 {
    background: #ffcad4 !important;
}
.bg-nude3-10 {
    background: #fadde1 !important;
}
.bg-nude3-11 {
    background: #fff1f5 !important;
}
.bg-nude3-12 {
    background: #f6eee9 !important;
}

/* Gradients */
.bg-c-red {
    background: linear-gradient(45deg, #e52d27, #b31217) !important;
}
.bg-c-dark-red {
    background: linear-gradient(45deg, #d70c24, #784759) !important;
}
.bg-c-dark-orange {
    background: linear-gradient(45deg, #da7912, #785c47) !important;
}
.bg-c-dark-pink {
    background: linear-gradient(45deg, #f3329f, #784759) !important;
}
.bg-c-dark-green {
    background: linear-gradient(45deg, #2dc947, #47784c) !important;
}
.bg-c-blue {
    background: linear-gradient(45deg, #3949ab, #2962ff) !important;
}
.bg-c-dark-blue {
    background: linear-gradient(45deg, #00bcd4, #162384) !important;
}
.bg-c-green {
    background: linear-gradient(45deg, #2ca961, #2ed88a) !important;
}
.bg-c-yellow {
    background: linear-gradient(45deg, #f57c00, #ffb64d) !important;
}
.bg-c-dark-yellow {
    background: linear-gradient(45deg, #e5da15, #797713) !important;
}
.bg-c-purple {
    background: linear-gradient(45deg, #820094, #ad54e1) !important;
}
.bg-c-dark {
    background: linear-gradient(45deg, #202020, #403447) !important;
}
.bg-c-grey {
    background: linear-gradient(45deg, #828282, #3f3f3f) !important;
}

.bg-c-nude-blue {
    background: linear-gradient(45deg, #8aabdc, #6a95d3) !important;
}
.bg-c-nude-green {
    background: linear-gradient(45deg, #c7db78, #a3bf45) !important;
}
.bg-c-nude-orange {
    background: linear-gradient(45deg, #fbbf77, #ff9e3d) !important;
}
.bg-c-nude-pink {
    background: linear-gradient(45deg, #ff8fab, #fb6f92) !important;
}
.bg-c-nude-red {
    background: linear-gradient(45deg, #f36565, #ef4444) !important;
}
.bg-c-nude-purple {
    background: linear-gradient(45deg, #bc9ae3, #ad54e1) !important;
}
.bg-c-nude-grey {
    background: linear-gradient(45deg, #b5b5b5, #8c8c8c) !important;
}

/* === 7. Utilities & Miscellaneous === */
.hover-pointer {
    cursor: pointer;
}

.card-body {
    border-radius: 5px;
}

.row-ghost {
    background-color: #eff6ff;
    box-shadow: 0 3px 0 0 #3b82f6;
}

.image-preview-wrapper {
    position: relative;
    width: 140px;
    height: 105px;
    overflow: hidden;
    border-radius: 6px;
    cursor: pointer;
    display: inline-block;
}

.image-preview-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    border-radius: 6px;
    display: block;
}

.image-preview-wrapper:hover img,
.image-preview-wrapper:focus img {
    transform: scale(1.1);
}

.image-preview-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 6px;
    pointer-events: none;
}

.image-preview-wrapper:hover .image-preview-overlay,
.image-preview-wrapper:focus .image-preview-overlay {
    opacity: 1;
}

.image-preview-link {
    display: inline-block;
    outline: none;
    border: none;
}

.tippy-box {
    font-size: 0.8rem !important;
    line-height: 1.2 !important;
}

/* === Flatpickr Custom Styling === */

/* Calendar Container */
.flatpickr-calendar {
    font-size: 0.875rem; /* text-sm */
    z-index: 9999 !important; /* ensure it appears above modals */
}

/* Day Hover and Focus */
.flatpickr-day:hover,
.flatpickr-day:focus {
    background: #e0f2fe; /* blue-100 */
    border-color: #3b82f6; /* blue-500 */
    color: #1d4ed8; /* blue-700 */
    border-radius: 0.375rem;
    cursor: pointer;
}

/* Today’s Date */
.flatpickr-day.today {
    border: 1px solid #3b82f6; /* blue-500 */
    background: #e0f2fe; /* blue-100 */
    color: #1d4ed8; /* blue-700 */
}

.flatpickr-current-month {
    font-size: 0.975rem !important;
}

/* Wrapper around year input (month header) */
.flatpickr-calendar .numInputWrapper {
    padding: 2px 4px;
}

/* Remove spinner arrows if not needed */
.flatpickr-calendar .numInputWrapper .arrowUp,
.flatpickr-calendar .numInputWrapper .arrowDown {
    display: none; /* Optional: hide the up/down arrows */
}

/* Style the year input itself */
.flatpickr-calendar .flatpickr-year {
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    border: 1px solid #d1d5db; /* gray-300 */
}

.flatpickr-custom-footer {
    margin-top: 0.5rem;
    padding: 0.5rem;
    text-align: right;
    border-top: 1px solid #e5e7eb; /* gray-200 */
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.flatpickr-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem; /* space-x-1 */
    font-size: 0.75rem; /* text-sm */
    border-radius: 0.375rem;
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: background-color 0.2s ease, color 0.2s ease;
    border: none;
}

.flatpickr-reset-btn {
    background-color: #fef2f2; /* red-50 */
    color: #991b1b; /* red-800 */
}

.flatpickr-reset-btn:hover {
    background-color: #fecaca; /* red-200 */
}

.flatpickr-today-btn {
    background-color: #eff6ff; /* blue-50 */
    color: #1e3a8a; /* blue-800 */
}

.flatpickr-today-btn:hover {
    background-color: #bfdbfe; /* blue-200 */
}

.flatpickr-btn svg {
    width: 1rem;
    height: 1rem;
}

.upload-wrapper {
    width: 100%;
    max-width: 500px;
    margin-bottom: 1rem;
}

.upload-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    background-color: #fff;
    font-size: 0.9rem;
    height: calc(2.19rem + -5px);
    overflow: hidden;
}

.upload-label:hover {
    background-color: #f9f9f9;
}

.file-preview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
}

.hidden-input {
    display: none;
}

.upload-text {
    background-color: #007bff;
    color: #fff;
    height: 100%;
    width: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 1rem;
    white-space: nowrap;
    border-radius: 0.25rem 0 0 0.25rem;
}

.file-name {
    border: 1px solid #aaaaaa;
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
    font-size: 0.75rem !important;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border-radius: 0 0.25rem 0.25rem 0;
}
