/*
© 2025 Sharon Aicler (saichler@gmail.com)

Layer 8 Ecosystem is licensed under the Apache License, Version 2.0.
You may obtain a copy of the License at:

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
 * Layer 8 Date Picker Component Styles
 * A reusable calendar date picker component
 */

/* Date Input Wrapper */
.date-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.date-input-wrapper input {
    flex: 1;
    padding-right: 36px;
}

.date-picker-trigger {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 16px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.date-picker-trigger:hover {
    opacity: 1;
}

/* Styling for "Current" or "N/A" values */
.date-input[data-is-zero="true"] {
    font-style: italic;
    color: var(--layer8d-success, #22c55e);
}

/* Date Picker Overlay */
.layer8d-datepicker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layer8d-datepicker-overlay.hidden {
    display: none;
}

/* Date Picker Container */
.layer8d-datepicker {
    position: relative;
    z-index: 10001;
    background: var(--layer8d-bg-secondary, #fff);
    border: 1px solid var(--layer8d-border, #e2e8f0);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    width: 300px;
    font-family: inherit;
    user-select: none;
}

/* Header with navigation */
.layer8d-datepicker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid var(--layer8d-border, #e2e8f0);
    background: var(--layer8d-bg-primary, #f8fafc);
    border-radius: 8px 8px 0 0;
}

.layer8d-datepicker-nav {
    display: flex;
    gap: 4px;
}

.layer8d-datepicker-nav-btn {
    background: none;
    border: 1px solid var(--layer8d-border, #e2e8f0);
    border-radius: 4px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--layer8d-text-primary, #1e293b);
    transition: background-color 0.2s, border-color 0.2s;
}

.layer8d-datepicker-nav-btn:hover {
    background: var(--layer8d-bg-hover, #e2e8f0);
    border-color: var(--layer8d-primary, #0ea5e9);
}

.layer8d-datepicker-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.layer8d-datepicker-month-select,
.layer8d-datepicker-year-select {
    padding: 4px 8px;
    border: 1px solid var(--layer8d-border, #e2e8f0);
    border-radius: 4px;
    background: var(--layer8d-bg-secondary, #fff);
    color: var(--layer8d-text-primary, #1e293b);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.layer8d-datepicker-month-select:focus,
.layer8d-datepicker-year-select:focus {
    outline: none;
    border-color: var(--layer8d-primary, #0ea5e9);
}

/* Calendar Grid */
.layer8d-datepicker-calendar {
    padding: 8px;
}

.layer8d-datepicker-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 4px;
}

.layer8d-datepicker-weekday {
    font-size: 11px;
    font-weight: 600;
    color: var(--layer8d-text-muted, #64748b);
    text-transform: uppercase;
    padding: 8px 0;
}

.layer8d-datepicker-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.layer8d-datepicker-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
    color: var(--layer8d-text-primary, #1e293b);
    border: none;
    background: none;
}

.layer8d-datepicker-day:hover:not(.disabled):not(.selected) {
    background: var(--layer8d-bg-hover, #e2e8f0);
}

.layer8d-datepicker-day.other-month {
    color: var(--layer8d-text-muted, #94a3b8);
    opacity: 0.5;
}

.layer8d-datepicker-day.today {
    font-weight: 700;
    color: var(--layer8d-primary, #0ea5e9);
    background: var(--layer8d-primary-light, #e0f2fe);
}

.layer8d-datepicker-day.selected {
    background: var(--layer8d-primary, #0ea5e9);
    color: #fff;
    font-weight: 600;
}

.layer8d-datepicker-day.selected.today {
    background: var(--layer8d-primary, #0ea5e9);
    color: #fff;
}

.layer8d-datepicker-day.disabled {
    color: var(--layer8d-text-muted, #94a3b8);
    opacity: 0.3;
    cursor: not-allowed;
}

/* Footer with buttons */
.layer8d-datepicker-footer {
    padding: 8px 12px;
    border-top: 1px solid var(--layer8d-border, #e2e8f0);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.layer8d-datepicker-today-btn {
    background: none;
    border: 1px solid var(--layer8d-primary, #0ea5e9);
    color: var(--layer8d-primary, #0ea5e9);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.layer8d-datepicker-today-btn:hover {
    background: var(--layer8d-primary, #0ea5e9);
    color: #fff;
}

.layer8d-datepicker-clear-btn {
    background: none;
    border: 1px solid var(--layer8d-border, #e2e8f0);
    color: var(--layer8d-text-muted, #64748b);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.layer8d-datepicker-clear-btn:hover {
    background: var(--layer8d-bg-hover, #e2e8f0);
    color: var(--layer8d-text-primary, #1e293b);
}

.layer8d-datepicker-current-btn {
    background: none;
    border: 1px solid var(--layer8d-success, #22c55e);
    color: var(--layer8d-success, #22c55e);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.layer8d-datepicker-current-btn:hover {
    background: var(--layer8d-success, #22c55e);
    color: #fff;
}

/* Animation */
@keyframes datepicker-fade-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.layer8d-datepicker {
    animation: datepicker-fade-in 0.15s ease-out;
}

/* Focus states for keyboard navigation */
.layer8d-datepicker-day:focus {
    outline: 2px solid var(--layer8d-primary, #0ea5e9);
    outline-offset: -2px;
}

.layer8d-datepicker-day:focus:not(:focus-visible) {
    outline: none;
}

.layer8d-datepicker-day:focus-visible {
    outline: 2px solid var(--layer8d-primary, #0ea5e9);
    outline-offset: -2px;
}
