/* ============================================================
   cards.css — 天气搜索栏/多城市标签、计算器、日历、待办
   视觉语言与 weather.css 保持一致：
   半透明底 + 16px 圆角 + 主色 var(--main)
   ============================================================ */

/* ========== 天气：搜索栏 ========== */
.weather-toolbar {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.weather-city-input {
    flex: 1;
    min-width: 0;
    padding: 7px 11px;
    font-size: 12px;
    border-radius: 9px;
    border: 1px solid rgba(128, 128, 140, 0.25);
    background: rgba(255, 255, 255, 0.5);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.weather-city-input:focus {
    border-color: var(--main);
}

.weather-mini-btn {
    padding: 7px 13px;
    font-size: 12px;
    border-radius: 9px;
    border: 1px solid var(--main);
    background: var(--main);
    color: #fff;
    cursor: pointer;
    transition: opacity 0.2s, background 0.2s;
    white-space: nowrap;
}

.weather-mini-btn:hover { opacity: 0.88; }
.weather-mini-btn:disabled { opacity: 0.55; cursor: default; }

.weather-icon-btn {
    background: transparent;
    color: var(--main);
    border-color: rgba(128, 128, 140, 0.25);
    padding: 6px 11px;
    font-size: 15px;
    line-height: 1;
}

.weather-icon-btn:hover {
    background: rgba(128, 128, 140, 0.08);
    opacity: 1;
}

/* ========== 天气：城市标签 ========== */
.weather-city-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.w-city-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px 3px 11px;
    font-size: 12px;
    border-radius: 16px;
    background: rgba(128, 128, 140, 0.08);
    color: var(--text);
    border: 1px solid rgba(128, 128, 140, 0.16);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.w-city-chip:hover {
    background: rgba(128, 128, 140, 0.14);
}

.w-city-chip.active {
    background: var(--main);
    color: #fff;
    border-color: var(--main);
}

.w-city-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    font-size: 10px;
    border-radius: 50%;
    opacity: 0.55;
    transition: opacity 0.2s, background 0.2s;
}

.w-city-remove:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.15);
}

.w-city-chip.active .w-city-remove:hover {
    background: rgba(255, 255, 255, 0.25);
}

.w-chip-spinner {
    width: 9px;
    height: 9px;
    border: 1.5px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: wSpin 0.7s linear infinite;
}

@keyframes wSpin {
    to { transform: rotate(360deg); }
}

.weather-city-msg {
    font-size: 11px;
    color: var(--main);
    margin-bottom: 6px;
}

.weather-city-msg:empty {
    margin-bottom: 0;
}

.weather-city-msg-err {
    color: var(--danger);
}

/* ========== 通用：卡片内小输入框（待办复用） ========== */
.todo-input,
.todo-options input[type="datetime-local"],
.todo-options input[type="number"] {
    padding: 7px 10px;
    font-size: 12px;
    border-radius: 9px;
    border: 1px solid rgba(128, 128, 140, 0.25);
    background: rgba(255, 255, 255, 0.5);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.todo-input:focus,
.todo-options input:focus {
    border-color: var(--main);
}

.todo-options input[type="number"] {
    width: 62px;
    padding: 6px 8px;
}

/* ========== 计算器 ========== */
.calc-expr {
    font-size: 11px;
    color: var(--text-placeholder);
    text-align: right;
    min-height: 15px;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
}

.calc-display {
    width: 100%;
    padding: 9px 12px;
    font-size: 23px;
    font-weight: 600;
    text-align: right;
    border-radius: 10px;
    border: 1px solid rgba(128, 128, 140, 0.2);
    background: rgba(128, 128, 140, 0.06);
    color: var(--text);
    margin-bottom: 8px;
    min-height: 45px;
    white-space: nowrap;
    overflow-x: auto;
}

.calc-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.calc-btn {
    padding: 12px 0;
    font-size: 16px;
    border-radius: 10px;
    border: 1px solid rgba(128, 128, 140, 0.15);
    background: rgba(255, 255, 255, 0.35);
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.calc-btn:hover { background: rgba(128, 128, 140, 0.13); }
.calc-btn:active { transform: scale(0.94); }

.calc-btn.op {
    color: var(--main);
    font-weight: 700;
}

.calc-btn.fn {
    color: var(--text-placeholder);
}

.calc-btn.eq {
    background: var(--main);
    color: #fff;
    border-color: var(--main);
}

.calc-btn.eq:hover { opacity: 0.9; }

/* ========== 日历 ========== */
.cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.cal-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.cal-nav,
.cal-today-btn {
    width: 29px;
    height: 29px;
    border-radius: 8px;
    border: 1px solid rgba(128, 128, 140, 0.18);
    background: transparent;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cal-today-btn {
    width: auto;
    padding: 0 10px;
    font-size: 11px;
}

.cal-nav:hover,
.cal-today-btn:hover {
    background: rgba(128, 128, 140, 0.1);
}

.cal-header-actions {
    display: flex;
    gap: 5px;
}

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

.cal-weekday {
    font-size: 11px;
    color: var(--text-placeholder);
    padding: 4px 0;
    font-weight: 600;
}

.cal-day {
    position: relative;
    padding: 7px 0;
    font-size: 12px;
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s;
}

.cal-day:hover {
    background: rgba(128, 128, 140, 0.1);
}

.cal-day.other {
    opacity: 0.3;
}

.cal-day.today {
    background: var(--main);
    color: #fff;
    font-weight: 700;
}

.cal-day.selected:not(.today) {
    background: rgba(var(--main-rgb, 0, 122, 255), 0.16);
}

.cal-day.has-todo::after {
    content: '';
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--warning);
}

.cal-day.today.has-todo::after {
    background: #fff;
}

.cal-footer {
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-placeholder);
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

/* ========== 待办 ========== */
.todo-add-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.todo-input { flex: 1; min-width: 0; }

.todo-options {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.todo-opt-label {
    font-size: 11px;
    color: var(--text-placeholder);
}

.todo-add-btn {
    padding: 7px 15px;
    border-radius: 9px;
    border: 1px solid var(--main);
    background: var(--main);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.todo-add-btn:hover { opacity: 0.88; }

.todo-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 250px;
    overflow-y: auto;
}

.todo-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 9px;
    border-radius: 9px;
    background: rgba(128, 128, 140, 0.05);
    transition: background 0.2s;
}

.todo-item:hover {
    background: rgba(128, 128, 140, 0.09);
}

.todo-check {
    margin-top: 3px;
    accent-color: var(--main);
    cursor: pointer;
    flex-shrink: 0;
    width: 15px;
    height: 15px;
}

.todo-body {
    flex: 1;
    min-width: 0;
}

.todo-text {
    font-size: 13px;
    color: var(--text);
    word-break: break-word;
    line-height: 1.4;
}

.todo-item.done .todo-text {
    text-decoration: line-through;
    opacity: 0.45;
}

.todo-meta {
    font-size: 10px;
    color: var(--text-placeholder);
    margin-top: 2px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.todo-meta .overdue {
    color: var(--danger);
}

.todo-del {
    border: none;
    background: transparent;
    color: var(--text-placeholder);
    font-size: 13px;
    cursor: pointer;
    padding: 2px 4px;
    opacity: 0.5;
    transition: opacity 0.2s, color 0.2s;
    flex-shrink: 0;
}

.todo-del:hover {
    opacity: 1;
    color: var(--danger);
}

.todo-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-placeholder);
    flex-wrap: wrap;
}

.todo-notify-btn {
    border: 1px solid rgba(128, 128, 140, 0.25);
    background: transparent;
    color: var(--text);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.todo-notify-btn:hover { background: rgba(128, 128, 140, 0.1); }

.todo-notify-btn.on {
    color: var(--success);
    border-color: var(--success);
}

.todo-notify-btn.unsupported {
    opacity: 0.4;
    cursor: default;
}

.todo-clear-done {
    border: none;
    background: transparent;
    color: var(--text-placeholder);
    font-size: 10px;
    cursor: pointer;
    text-decoration: underline;
}

.todo-clear-done:hover { color: var(--danger); }

.todo-empty {
    text-align: center;
    font-size: 12px;
    color: var(--text-placeholder);
    padding: 18px 0;
}

/* ========== 深色主题适配 ========== */
.theme-dark .weather-city-input,
.theme-dark .todo-input,
.theme-dark .todo-options input[type="datetime-local"],
.theme-dark .todo-options input[type="number"] {
    background: rgba(255, 255, 255, 0.08);
}

.theme-dark .calc-btn {
    background: rgba(255, 255, 255, 0.07);
}

.theme-dark .calc-btn:hover {
    background: rgba(255, 255, 255, 0.14);
}

/* ========== 移动端微调 ========== */
@media (max-width: 425px) {
    .calc-btn { padding: 11px 0; font-size: 15px; }
    .calc-display { font-size: 20px; }
    .todo-list { max-height: 220px; }
}
