/* Propjini Date & Time Picker - Compact & Maximum Data Visibility */
:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --bg-light: #f9fafb;
    --border: #e5e7eb;
    --text: #1f2937;
    --text-light: #6b7280;
    --error: #ef4444;
    --hover-bg: #eff6ff;
    --disabled: #d1d5db;
    --shadow: rgba(0, 0, 0, 0.08);
    --shadow-lg: rgba(0, 0, 0, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 30px 16px;
    margin: 0;
    min-height: 100vh;
}

.input-wrapper {
    max-width: 380px;
    margin: 0 auto 16px;
    position: relative;
}

.input-wrapper label {
    display: block;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 5px;
    letter-spacing: 0.2px;
}

.date-display-input {
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    cursor: pointer;
    background: white;
    font-size: 13.5px;
    color: var(--text);
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px var(--shadow);
}

.date-display-input:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 4px var(--shadow);
}

.date-display-input:focus,
.date-display-input:focus-visible {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15), 0 1px 3px var(--shadow);
}

.date-display-input::placeholder {
    color: var(--disabled);
}

/* Modal Container - Compact */
.picker-modal {
    position: absolute;
    background: white;
    width: 540px;
    max-width: calc(100vw - 20px);
    padding: 10px 12px;
    border-radius: 9px;
    border: 1px solid var(--border);
    box-shadow: 0 6px 20px var(--shadow-lg), 0 2px 6px var(--shadow);
    z-index: 1000;
    
    /* Animation & Visibility */
    display: block;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px) scale(0.99);
    transition: opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1), transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.15s;
    pointer-events: none;
}

/* Position Variants */
.picker-modal.position-bottom {
    top: 100%;
    bottom: auto;
    margin-top: 4px;
    margin-bottom: 0;
    transform-origin: top center;
}

.picker-modal.position-top {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 4px;
    transform-origin: bottom center;
}

/* Modal Open State */
.picker-modal.active {
    visibility: visible;
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Mode-Specific Widths */
.picker-modal.mode-date,
.picker-modal:has(.modal-body.date-only-mode) {
    width: 310px;
}

.picker-modal.mode-time,
.picker-modal:has(.modal-body.time-only-mode) {
    width: 350px;
}

/* Modal Header - Compact */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.btn-link {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 5px;
    transition: all 0.15s ease;
    font-weight: 600;
}

.btn-link:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.btn-link.btn-clear {
    color: var(--error);
}

.btn-link.btn-clear:hover {
    background: rgba(239, 68, 68, 0.08);
}

.btn-link.btn-today {
    color: var(--primary);
}

.btn-link.btn-today:hover {
    background: var(--hover-bg);
}

.btn-link.btn-apply {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 4px 12px;
    box-shadow: 0 1px 4px rgba(59, 130, 246, 0.25);
}

.btn-link.btn-apply:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.35);
}

/* Modal Body Layouts */
.modal-body {
    display: flex;
    gap: 12px;
    padding-top: 0;
}

.modal-body.date-only-mode {
    padding: 4px 0;
    justify-content: center;
}

.modal-body.date-only-mode .calendar-section {
    flex: 1;
    width: 100%;
    max-width: 290px;
    margin: 0 auto;
}

.modal-body.time-only-mode {
    justify-content: center;
}

.modal-body.time-only-mode .time-section {
    flex: 1;
    width: 100%;
    max-width: 340px;
    border-left: none;
    padding-left: 0;
}

/* Calendar Section - Compact */
.calendar-section {
    flex: 1.1;
    min-width: 215px;
}

.month-label {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
}

.nav-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 15px;
    color: var(--text);
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.15s ease;
    line-height: 1;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover:not(:disabled):not(.disabled) {
    background: var(--hover-bg);
    color: var(--primary);
}

.nav-btn:active:not(:disabled):not(.disabled) {
    transform: scale(0.92);
}

.nav-btn:disabled,
.nav-btn.disabled {
    opacity: 0.25;
    cursor: not-allowed;
    pointer-events: none;
}

.nav-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.month-select,
.year-select {
    padding: 3px 6px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 12px;
    height: 25px;
    cursor: pointer;
    background: white;
    color: var(--text);
    transition: all 0.15s ease;
    font-weight: 500;
}

.month-select:hover,
.year-select:hover {
    border-color: var(--primary);
}

.month-select:focus,
.year-select:focus,
.month-select:focus-visible,
.year-select:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

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

.day-name {
    text-align: center;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-light);
    padding: 3px 0;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.day-num {
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
    text-align: center;
    font-size: 11.5px;
    transition: all 0.12s ease;
    position: relative;
    width: 26px;
    height: 26px;
    margin: 1px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    user-select: none;
}

.day-num:hover:not(.disabled) {
    background: var(--hover-bg);
    color: var(--primary);
    transform: scale(1.06);
}

.day-num:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
    background: var(--hover-bg);
}

.day-num.selected {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
    color: white !important;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(59, 130, 246, 0.3);
}

.day-num.is-today {
    border: 1.5px solid var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.day-num.is-today.selected {
    border-color: white;
    color: white !important;
}

.day-num.disabled {
    color: var(--disabled);
    cursor: not-allowed;
    opacity: 0.4;
}

.empty {
    visibility: hidden;
}

/* Time Section - Maximum Data Visibility, Minimal Scrolling */
.time-section {
    flex: 1.35;
    border-left: 1px solid var(--border);
    padding-left: 10px;
    min-width: 270px;
}

.time-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 2px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.time-section-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.time-section-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 1px 6px;
    margin-bottom: 2px;
    background: var(--hover-bg);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
}

/* 4 columns: 1 row = 1 full hour (:00, :15, :30, :45) */
.time-section-chips {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
}

.time-grid::-webkit-scrollbar {
    width: 2px;
}

.time-grid::-webkit-scrollbar-track {
    background: transparent;
}

.time-grid::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
    transition: background 0.15s;
}

.time-grid::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.time-chip {
    padding: 4px 2px;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    font-size: 10.5px;
    font-weight: 500;
    transition: all 0.12s ease;
    background: white;
    color: var(--text);
    position: relative;
    user-select: none;
    white-space: nowrap;
}

.time-chip:hover:not(.disabled):not(.selected) {
    border-color: var(--primary);
    background: var(--hover-bg);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 1px 3px var(--shadow);
}

.time-chip:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.time-chip.selected {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white !important;
    border-color: var(--primary);
    font-weight: 600;
    box-shadow: 0 1px 5px rgba(59, 130, 246, 0.3);
}

.time-chip.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--bg-light);
    color: var(--disabled);
    border-color: var(--border);
}

/* Time-Only Mode: 4 columns for zero-scroll layout */
.picker-modal.mode-time .time-section-chips,
.picker-modal:has(.modal-body.time-only-mode) .time-section-chips {
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.picker-modal.mode-time .time-grid,
.picker-modal:has(.modal-body.time-only-mode) .time-grid {
    max-height: 260px;
}

/* Responsive Media Queries */
@media (max-width: 600px) {
    body {
        padding: 16px 8px;
    }
    
    .picker-modal {
        width: 100% !important;
        left: 0 !important;
        right: 0 !important;
        max-width: 100%;
        padding: 10px;
    }
    
    .modal-body {
        flex-direction: column;
        gap: 10px;
    }
    
    .time-section {
        border-left: none;
        border-top: 1px solid var(--border);
        padding-left: 0;
        padding-top: 10px;
        min-width: 100%;
    }
    
    .time-grid {
        max-height: 180px;
    }
    
    .time-section-chips {
        grid-template-columns: repeat(4, 1fr);
        gap: 3px;
    }
}
