/* assets/css/thai-datepicker.css
 * CAAD NRRU Official Mint-Glass Thai Date & DateTime Picker
 */

.tdp-field-wrap {
    position: relative;
    display: block;
    width: 100%;
}

.tdp-display-input {
    padding-right: 2.75rem !important;
    cursor: pointer;
    font-variant-numeric: tabular-nums;
    accent-color: #0d9468;
}

.tdp-field-wrap.tdp-has-clear .tdp-display-input {
    padding-right: 4.4rem !important;
}

.tdp-display-input::placeholder {
    color: #4b6b60;
    opacity: 1;
}

/* Modern validity styling: only after user interaction */
input.tdp-display-input:user-invalid {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14);
}

.tdp-actions-inline {
    position: absolute;
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    z-index: 2;
}

.tdp-icon-btn,
.tdp-clear-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 0.55rem;
    border: none;
    background: transparent;
    color: #0d9468;
    cursor: pointer;
    transition: background-color 0.18s cubic-bezier(0.16, 1, 0.3, 1), color 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    padding: 0;
}

.tdp-clear-btn {
    color: #4b6b60;
    width: 1.6rem;
    height: 1.6rem;
}

.tdp-icon-btn:hover {
    background-color: #ecfdf5;
    color: #065f46;
}

.tdp-clear-btn:hover {
    background-color: #fee2e2;
    color: #b91c1c;
}

/* Floating Mint-Glass Popover */
.tdp-popover {
    position: fixed;
    z-index: 100050;
    width: 312px;
    max-width: calc(100vw - 16px);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    border: 1px solid rgba(13, 148, 104, 0.22);
    border-radius: 16px;
    box-shadow: 0 18px 40px -10px rgba(13, 148, 104, 0.18), 0 8px 20px -4px rgba(15, 41, 34, 0.08);
    padding: 14px;
    font-family: 'Noto Sans Thai', -apple-system, BlinkMacSystemFont, sans-serif;
    color: #0f2922;
    font-variant-numeric: tabular-nums;
    opacity: 0;
    transform: translateY(6px) scale(0.98);
    transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1), transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.tdp-popover.tdp-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header Navigation */
.tdp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 10px;
}

.tdp-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid rgba(13, 148, 104, 0.16);
    background: #f6fbf9;
    color: #0f2922;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
    user-select: none;
    flex-shrink: 0;
}

.tdp-nav-btn:hover {
    background: #ecfdf5;
    border-color: rgba(13, 148, 104, 0.35);
    color: #065f46;
}

.tdp-nav-btn:focus-visible,
.tdp-title-btn:focus-visible,
.tdp-day-btn:focus-visible,
.tdp-cell-btn:focus-visible,
.tdp-footer-btn:focus-visible,
.tdp-chip-btn:focus-visible {
    outline: 2px solid #10b981;
    outline-offset: 2px;
}

.tdp-title-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.tdp-title-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: #0f2922;
    font-size: 0.9375rem; /* 15px */
    font-weight: 700;
    line-height: 1.35;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    user-select: none;
    white-space: nowrap;
}

.tdp-title-btn:hover,
.tdp-title-btn.tdp-active {
    background: #ecfdf5;
    border-color: rgba(13, 148, 104, 0.24);
    color: #065f46;
}

.tdp-era-tag {
    font-size: 0.75rem; /* 12px floor */
    font-weight: 600;
    color: #065f46;
    background: #d1fae5;
    padding: 1px 7px;
    border-radius: 9999px;
}

/* Weekday Row */
.tdp-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 4px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(13, 148, 104, 0.12);
}

.tdp-weekday {
    text-align: center;
    font-size: 0.75rem; /* 12px minimum per design system */
    font-weight: 600;
    color: #3d5a50;
    padding: 2px 0;
    user-select: none;
}

.tdp-weekday.tdp-sun {
    color: #b91c1c;
}

/* Days Grid */
.tdp-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.tdp-day-btn {
    height: 36px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: #0f2922;
    font-size: 0.875rem; /* 14px */
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    user-select: none;
    padding: 0;
}

.tdp-day-btn:hover:not(:disabled):not(.tdp-selected) {
    background: #ecfdf5;
    color: #065f46;
}

.tdp-day-btn.tdp-outside {
    color: #647d74;
    opacity: 0.65;
}

.tdp-day-btn.tdp-today:not(.tdp-selected) {
    background: #f6fbf9;
    border-color: #10b981;
    color: #065f46;
    font-weight: 700;
}

.tdp-day-btn.tdp-selected {
    background: #0d9468;
    border-color: #0d9468;
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 4px 10px -2px rgba(13, 148, 104, 0.35);
}

.tdp-day-btn:disabled {
    color: #9cb3aa;
    opacity: 0.45;
    cursor: not-allowed;
}

/* Month & Year Picker Grids */
.tdp-subgrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 4px 0;
}

.tdp-subgrid.tdp-years-grid {
    grid-template-columns: repeat(4, 1fr);
    max-height: 210px;
    overflow-y: auto;
    scrollbar-width: auto;
    scrollbar-color: #0a7a56 #ebf7f2;
}

.tdp-cell-btn {
    height: 38px;
    border-radius: 10px;
    border: 1px solid rgba(13, 148, 104, 0.12);
    background: #f6fbf9;
    color: #0f2922;
    font-size: 0.8125rem; /* 13px */
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    user-select: none;
}

.tdp-cell-btn:hover:not(.tdp-selected) {
    background: #ecfdf5;
    border-color: rgba(13, 148, 104, 0.35);
    color: #065f46;
}

.tdp-cell-btn.tdp-current:not(.tdp-selected) {
    border-color: #10b981;
    color: #065f46;
}

.tdp-cell-btn.tdp-selected {
    background: #0d9468;
    border-color: #0d9468;
    color: #ffffff;
}

/* 24h Time Picker Section */
.tdp-time-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(13, 148, 104, 0.14);
}

.tdp-time-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.tdp-time-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem; /* 13px */
    font-weight: 600;
    color: #3d5a50;
}

.tdp-time-inputs {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f6fbf9;
    border: 1px solid rgba(13, 148, 104, 0.22);
    border-radius: 10px;
    padding: 3px 6px;
}

.tdp-time-select {
    appearance: none;
    -webkit-appearance: none;
    background: #ffffff;
    border: 1px solid rgba(13, 148, 104, 0.18);
    border-radius: 7px;
    padding: 3px 8px;
    font-size: 0.875rem; /* 14px */
    font-weight: 700;
    color: #0f2922;
    font-family: inherit;
    font-variant-numeric: tabular-nums;
    text-align: center;
    cursor: pointer;
    scrollbar-width: auto;
    scrollbar-color: #0a7a56 #ebf7f2;
}

.tdp-time-select:focus {
    outline: 2px solid #10b981;
    outline-offset: 1px;
}

.tdp-time-sep {
    font-weight: 700;
    color: #0f2922;
    font-size: 0.9375rem;
}

.tdp-time-unit {
    font-size: 0.75rem; /* 12px */
    font-weight: 600;
    color: #3d5a50;
    margin-left: 2px;
}

.tdp-time-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.tdp-chip-btn {
    padding: 3px 9px;
    border-radius: 9999px;
    border: 1px solid rgba(13, 148, 104, 0.18);
    background: #f6fbf9;
    color: #3d5a50;
    font-size: 0.75rem; /* 12px */
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    user-select: none;
}

.tdp-chip-btn:hover,
.tdp-chip-btn.tdp-active {
    background: #d1fae5;
    border-color: #0d9468;
    color: #065f46;
}

/* Footer Action Bar */
.tdp-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(13, 148, 104, 0.14);
}

.tdp-footer-left {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tdp-footer-btn {
    padding: 5px 12px;
    border-radius: 9999px;
    font-size: 0.8125rem; /* 13px */
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
    user-select: none;
    border: 1px solid transparent;
}

.tdp-btn-today {
    background: #ecfdf5;
    border-color: rgba(13, 148, 104, 0.2);
    color: #065f46;
}

.tdp-btn-today:hover {
    background: #d1fae5;
    color: #065f46;
}

.tdp-btn-clear {
    background: transparent;
    color: #4b6b60;
}

.tdp-btn-clear:hover {
    background: #fee2e2;
    color: #b91c1c;
}

.tdp-btn-confirm {
    background: #0d9468;
    color: #ffffff;
    padding: 5px 16px;
}

.tdp-btn-confirm:hover {
    background: #065f46;
}
