/**
 * LinkageDatePicker styles. Relies on the shared CSS variables from common/css/base.css
 * (--surface, --border, --text, --text-muted, --primary, --input-bg, --radius, --radius-sm).
 */

.dp {
    position: relative;
    max-width: 320px;
}

.dp-field {
    position: relative;
    display: block;
}

.dp-input {
    display: block;
    width: 100%;
}

/* Higher specificity than .profile-form-input so the icon padding isn't reset. */
.dp-field .dp-input {
    padding-right: 40px;
}

.dp-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.dp-toggle:hover {
    background: var(--input-bg);
    color: var(--text);
}

.dp-toggle svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Validation marks the hidden input (a sibling of the field wrapper) with .invalid. */
.dp input.invalid ~ .dp-field .dp-input {
    border-color: var(--error);
}

.dp-popup {
    position: absolute;
    z-index: 40;
    top: calc(100% + 6px);
    left: 0;
    width: 280px;
    max-width: 92vw;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.dp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 8px;
}

.dp-nav {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--text);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.dp-nav:hover {
    background: var(--input-bg);
}

.dp-title {
    flex: 1 1 auto;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    cursor: pointer;
}

.dp-title:not(.dp-title--static):hover {
    background: var(--input-bg);
}

.dp-title--static {
    cursor: default;
}

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

.dp-grid--years {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.dp-weekday {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
}

.dp-day {
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: var(--text);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.dp-day:hover:not(.dp-day--blank) {
    background: var(--input-bg);
}

.dp-day--blank {
    cursor: default;
}

.dp-day--today {
    box-shadow: inset 0 0 0 1px var(--primary);
}

.dp-day--selected,
.dp-day--selected:hover {
    background: var(--primary);
    color: var(--primary-text);
}

.dp-year {
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: var(--text);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.dp-year:hover {
    background: var(--input-bg);
}

.dp-year--selected,
.dp-year--selected:hover {
    background: var(--primary);
    color: var(--primary-text);
    border-color: var(--primary);
}

.dp-footer {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.dp-action {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    background: transparent;
    border: none;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.dp-action:hover {
    background: var(--input-bg);
}

.dp-action--clear {
    color: var(--text-muted);
}
