/* 基础重置和变量 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* 通用布局 */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.app-header {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.header-left {
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--primary-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    transform: scale(1.05);
}

.theme-icon {
    width: 20px;
    height: 20px;
    transition: opacity 0.3s ease;
}

.theme-icon.dark-icon {
    position: absolute;
    opacity: 0;
}

[data-theme="dark"] .theme-icon.light-icon {
    opacity: 0;
}

[data-theme="dark"] .theme-icon.dark-icon {
    opacity: 1;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.5rem;
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.logout-btn:hover {
    background-color: var(--danger-color);
    color: white;
}

.logout-btn svg {
    width: 16px;
    height: 16px;
}

/* 主要内容区域 */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    width: 100%;
}

/* 区域卡片 */
.section-card {
    background-color: var(--bg-surface);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    height: fit-content;
}

.card-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.card-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

/* 表单样式 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-label.required::after {
    content: ' *';
    color: var(--danger-color);
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-color-alpha);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-tertiary);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-help {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* 单选按钮组 */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.radio-item:hover {
    border-color: var(--primary-color);
    background-color: var(--bg-secondary);
}

.radio-item input[type="radio"] {
    margin-top: 0.125rem;
    accent-color: var(--primary-color);
}

.radio-item input[type="radio"]:checked + .radio-content {
    color: var(--primary-color);
}

.radio-content {
    flex: 1;
}

.radio-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.radio-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* 复选框 */
.checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.checkbox-item:hover {
    border-color: var(--primary-color);
    background-color: var(--bg-secondary);
}

.checkbox-item input[type="checkbox"] {
    margin-top: 0.125rem;
    accent-color: var(--primary-color);
}

.checkbox-label {
    flex: 1;
    cursor: pointer;
}

.checkbox-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.checkbox-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* 调度设置区域 */
.schedule-section {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    background-color: var(--bg-secondary);
}

.schedule-group {
    display: block;
}

.repeat-settings {
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 2px solid var(--border-color);
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    line-height: 1;
}

.btn-icon {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-color-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--primary-color);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* 表单操作区域 */
.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* 列表区域 */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.list-filters {
    display: flex;
    gap: 0.75rem;
}

.filter-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.list-stats {
    display: flex;
    gap: 1rem;
}

.stat-item {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* 消息列表 */
.message-list {
    max-height: calc(100vh - 300px);
    overflow-y: auto;
}

/* 加载和空状态 */
.loading-state,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.btn .loading-spinner {
    width: 1.2em;
    height: 1.2em;
    border-width: 2px;
    margin-bottom: 0;
    margin-right: 0.25em;
}

.loading-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.empty-icon {
    width: 64px;
    height: 64px;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
}

.empty-title {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-desc {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* 帮助链接 */
.help-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.help-link:hover {
    text-decoration: underline;
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-surface);
    border-radius: 1rem;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background-color: var(--danger-color);
    color: white;
}

.modal-close svg {
    width: 16px;
    height: 16px;
}

.modal-body {
    padding: 1.5rem;
}

/* Cron帮助内容 */
.cron-help-content h4 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-size: 1rem;
}

.cron-help-content h4:first-child {
    margin-top: 0;
}

.cron-help-content code {
    background-color: var(--bg-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    color: var(--primary-color);
}

.cron-help-content ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.cron-help-content li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.cron-help-content strong {
    color: var(--text-primary);
}

/* 通知提示 */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    min-width: 300px;
    padding: 1rem;
    border-radius: 0.5rem;
    color: white;
    font-size: 0.875rem;
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background-color: var(--success-color);
}

.toast.error {
    background-color: var(--danger-color);
}

.toast.warning {
    background-color: var(--warning-color);
}

.toast.info {
    background-color: var(--info-color);
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* 选择文本样式 */
::selection {
    background-color: var(--primary-color-alpha);
    color: var(--text-primary);
}

/* 焦点状态 */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Action Buttons Specific Styles */
.action-btn {
    background: none !important; /* Ensure override */
    border: none !important; /* Ensure override */
    padding: 0.35rem; /* Adjust for touch/click area if icons are small */
    cursor: pointer;
    line-height: 1;
    border-radius: 50%; /* Make a circular hover/focus area */
    transition: background-color 0.2s ease-in-out;
}

.action-btn:hover {
    background-color: var(--bg-secondary); /* Subtle hover, adjust color as needed */
}

.action-btn .icon-action {
    width: 18px;  /* Adjusted size */
    height: 18px; /* Adjusted size */
    color: var(--text-primary); /* Default icon color (white/light in dark theme, dark in light theme) */
    /* stroke-width is set in the SVG itself to 1.5px */
    display: block; /* Helps with layout inside button */
}

.action-btn.delete-btn .icon-action {
    color: var(--danger-color) !important; /* Red for delete, !important if needed to override */
}

/* Ensure action buttons in the list don't inherit other .btn styles that add padding/bg */
.task-actions-column .action-btn {
    margin: 0 0.1rem; /* Small margin between buttons */
}

/* Styling for the new datetime-input-wrapper */
.datetime-input-wrapper {
    display: block; /* Occupy full available width if needed, or inline-block */
    cursor: text;   /* Indicate it's clickable like a text input */
    /* position: relative; */ /* Uncomment if pseudo-elements or absolute positioning inside is needed */
}

/* Ensure the actual input inside the wrapper behaves as expected */
.datetime-input-wrapper .form-input {
    width: 100%; /* Make the input fill the wrapper */
    box-sizing: border-box; /* Ensure padding and border don't increase total width */
}

/* Focus styling for the wrapper to mimic input focus (optional) */
/*
.datetime-input-wrapper:focus-within {
    outline: 2px solid var(--primary-color); 
    outline-offset: 2px;
    border-radius: var(--border-radius);
}
*/

/* ---- Button Styles ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    line-height: 1;
}

.btn-icon {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-color-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--primary-color);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
} 