/* 通知設定頁面樣式 */

/* 卡片樣式 */
.settings-card {
    background-color: var(--surface-color);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 24px;
}

.settings-card h3 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.3rem;
}

.settings-card p {
    color: var(--text-secondary);
    margin-top: 0;
    margin-bottom: 16px;
}

.section-description {
    font-size: 1.1rem;
    margin-bottom: 24px;
    color: var(--text-secondary);
}

/* 時間設定樣式 */
.time-settings {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 14px;
}

.time-slot {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background-color: var(--background-color);
    border-radius: 8px;
    flex: 1;
    min-width: 250px;
}

.time-slot label {
    font-weight: 500;
    min-width: 80px;
}

.time-slot input[type="time"] {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    /* flex: 1; */ /* Removed to prevent excessive stretching */
}

.add-time-btn,
.remove-time-btn {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.add-time-btn {
    padding: 10px 16px;
    background-color: var(--primary-color);
    color: white;
}

.add-time-btn:hover:not(:disabled) {
    background-color: #1976D2;
    color: white;
}

.add-time-btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.remove-time-btn {
    padding: 7px 10px;
    background-color: transparent;
    color: var(--text-secondary);
}

.remove-time-btn:hover:not(:disabled) {
    border-color: var(--danger-color, #EF4444);
    background-color: var(--danger-color, #EF4444);
    color: white;
}

.remove-time-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

/* 通知類型樣式 */
.notification-types {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.notification-type {
    background-color: var(--background-color);
    border-radius: 8px;
    padding: 16px;
}

.type-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.type-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.weather-icon {
    background-color: #4a90e2;
}

.rain-icon {
    background-color: #50b7c1;
}

.extreme-icon {
    background-color: #e25b4a;
}

.disaster-icon {
    background-color: #d9534f;
}

.pollution-icon {
    background-color: #8c6d62;
}

.type-header h4 {
    margin: 0;
    flex: 1;
    font-size: 1.1rem;
}

.priority-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.priority-selector span {
    font-weight: 500;
}

.priority-selector select {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
}

/* 勿擾模式樣式 */
.do-not-disturb {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dnd-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dnd-time {
    display: flex;
    gap: 16px;
}

.time-range {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.time-range label {
    font-weight: 500;
}

.time-range input[type="time"] {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
}

/* 通知歷史樣式 */
.notification-history {
    display: flex;
    justify-content: center;
}

#view-history-btn {
    padding: 10px 20px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

#view-history-btn:hover {
    background-color: #D97706;
    color: white;
}

/* 按鈕樣式 */
.toggle-btn {
    position: relative;
    flex: 0 0 auto;
    width: 48px;
    height: 28px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background-color: #CBD5E1;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.toggle-btn::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s;
}

.toggle-btn.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.toggle-btn.active::after {
    transform: translateX(20px);
}

.toggle-btn:hover {
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.18);
}

.settings-actions {
    display: flex;
    gap: 16px;
    margin-top: 32px;
    justify-content: center;
}

.primary-btn {
    padding: 12px 24px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.primary-btn:hover {
    background-color: #1976D2;
    color: white;
}

.secondary-btn {
    padding: 12px 24px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.secondary-btn:hover {
    background-color: #D97706;
    color: white;
}

.tertiary-btn {
    padding: 12px 24px;
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.tertiary-btn:hover {
    background-color: var(--background-color);
    color: var(--text-primary);
}

.notification-status-panel {
    border-left: 4px solid var(--primary-color);
}

.notification-status-panel p {
    margin-bottom: 8px;
}

.notification-history-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.5);
}

.notification-history-content {
    position: relative;
    width: min(640px, 100%);
    max-height: 80vh;
    overflow-y: auto;
    padding: 24px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    color: var(--text-primary);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.notification-history-content .close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background-color: var(--background-color);
    color: var(--text-primary);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.notification-history-content .close-btn:hover { background-color:var(--border-color); color:var(--text-primary); }
.notification-history-content > h3 { margin:0; padding-right:44px; color:var(--text-primary); }

.notification-list {
    margin-top: 16px;
}

.notification-item {
    margin-bottom:10px;
    padding:14px;
    border:1px solid var(--border-color);
    border-left:4px solid var(--primary-color);
    border-radius:8px;
    background-color:var(--background-color);
}

.notification-item:last-child {
    border-bottom: none;
}

.item-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

.item-header h4 {
    margin: 0;
    font-size: 1rem;
    color:var(--text-primary);
}

.item-header span {
    flex-shrink: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding:2px 7px;
    border-radius:999px;
    background-color:var(--surface-color);
}

.notification-item p {
    margin: 0;
    color: var(--text-primary);
    line-height: 1.5;
    white-space: pre-line;
}

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    z-index: 1001;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    animation: fadeInOut 3s;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { opacity: 0; }
}

/* 響應式設計 */
@media (max-width: 768px) {
    .time-settings {
        flex-direction: column;
    }
    
    .settings-actions {
        flex-direction: column;
    }
    
    .dnd-time {
        flex-direction: column;
    }

    .item-header {
        flex-direction: column;
        gap: 4px;
    }
}
