/* ========================================   个人所得税计算器 - 主样式文件   包含所有自定义样式定义   ======================================== */

/* ========================================   核心UI组件样式   ======================================== */

/* 卡片样式 */
.card {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
}

/* 标签样式 */
.label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

/* 输入框样式 */
.input-field {
    display: block;
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #374151;
    background-color: white;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.input-field:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 错误消息样式 */
.error-message {
    font-size: 0.75rem;
    color: #ef4444;
    margin-top: 0.25rem;
}

.error-message.hidden {
    display: none;
}

/* 标签页样式 */
.tab {
    flex: 1;
    padding: 0.75rem 1.5rem;
    text-align: center;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease-in-out;
}

.tab:hover {
    background-color: #f3f4f6;
}

.tab-active {
    border-bottom-color: #3b82f6;
    color: #3b82f6;
    font-weight: 500;
}

.tab-inactive {
    border-bottom-color: #e5e7eb;
    color: #6b7280;
}

/* 标题样式 */
.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

.btn-primary {
    background-color: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background-color: #2563eb;
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

/* 表格样式 */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table-header-cell {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    background-color: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
}

.table-header-cell.table-cell-right {
    text-align: right;
}

.table-data-cell {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.875rem;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

.table-data-cell.table-cell-right {
    text-align: right;
}

/* 模态框样式 */
.modal-content {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 28rem;
}

.modal-header {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-body {
    padding: 1rem;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 1rem;
    border-top: 1px solid #e5e7eb;
    gap: 0.5rem;
}

/* 月度输入容器样式 */
.month-input-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* 平台输入框样式 */
.platform-input {
    display: block;
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #374151;
    background-color: white;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.platform-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 平台输入网格样式 */
.platform-input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.75rem;
}

/* ========================================
   页面交互和安全性样式
   ======================================== */

/* 防止用户选择页面文本（安全保护） */
body {
    user-select: text;
}
button, .modal-drag-handle, .modal-dragging {
  user-select: none;
}


/* 计算中的加载状态提示 */
body.calculating::after {
    content: '计算中...';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    z-index: 10000;
}

/* 允许输入框和文本框选择文本（覆盖全局禁用） */
input, textarea, button, select, a {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    pointer-events: auto !important;
}

/* 确保所有按钮可点击 */
button {
    pointer-events: auto !important;
    cursor: pointer !important;
    -webkit-user-select: auto;
    -moz-user-select: auto;
    -ms-user-select: auto;
    user-select: auto;
}

/* ========================================
   悬浮球操作指引按钮样式
   ======================================== */

.floating-guide-btn {
    position: fixed;
    right: -10px; /* 默认部分显示在屏幕右侧 */
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    border-radius: 50% 0 0 50%; /* 只显示左侧半圆 */
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 10px;
    font-size: 24px;
    z-index: 9999;
    cursor: pointer;
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.15);
}

/* 鼠标悬停时滑出屏幕 */
.floating-guide-btn:hover {
    right: 0;
    width: auto;
    border-radius: 30px 0 0 30px;
}

/* 操作指引文字样式 */
.floating-guide-btn .guide-text {
    margin-right: 15px;
    margin-left: 15px;
    font-size: 16px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.2s ease-in-out 0.1s;
}

/* 鼠标悬停时显示文字 */
.floating-guide-btn:hover .guide-text {
    display: inline;
    opacity: 1;
}

/* 特别处理操作指引按钮 */
#help-guide-btn {
    pointer-events: auto !important;
    cursor: pointer !important;
    z-index: 9999 !important;
}

/* ========================================
   模态框布局样式
   ======================================== */

/* 模态框基础定位 - 居中显示 */
.modal-positioned {
    position: fixed;
    transform: translate(-50%, -50%);
    top: 50%;
    left: 50%;
}

/* 模态框头部拖动区域样式 */
.modal-drag-handle {
    cursor: move;
    user-select: none;
}

/* ========================================
   导入模态框专用样式
   ======================================== */

/* 修复：导入模态框布局优化 - 简化版本 */
#import-match-modal .modal-draggable {
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    width: 90vw;
    max-width: 1200px;
}

/* 模态框内容区域 - 可滚动 */
#import-match-modal .modal-content-area {
    flex: 1;
    overflow-y: auto;
    min-height: 300px; /* 确保最小高度 */
    padding: 1.5rem;
}

/* 模态框底部操作区域 - 固定 */
#import-match-modal .import-modal-footer {
    background: white;
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

/* 确保预览表格有足够滚动空间 */
.preview-table-container {
    min-height: 200px;
    max-height: 400px;
    overflow: auto;
}

/* ========================================
   工具提示(Tooltip)样式
   ======================================== */

/* 工具提示容器 */
.tooltip-container {
    position: relative;
    display: inline-block;
    width: 100%;
    height: 100%;
}

/* 工具提示文本框 */
.tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 10000;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
    line-height: 1.4;
    pointer-events: none;
}

/* 工具提示显示状态 */
.tooltip-container:hover .tooltip-text,
.tooltip-container.tooltip-active .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* 工具提示箭头 */
.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

/* ========================================
   其他功能样式
   ======================================== */

/* 批量调整错误提示样式 */
.adjust-error-item {
    @apply flex items-center mt-1 text-xs;
}

/* 空单元格特殊样式 */
.empty-cell {
    background-color: #f9fafb;
    color: #6b7280;
    font-style: italic;
}

/* 预览表格样式 */
.preview-table {
    width: 100%;
    border-collapse: collapse;
}

/* 预览表格表头 - 固定定位 */
.preview-table th {
    position: sticky;
    top: 0;
    background: #f9fafb;
    z-index: 10;
}

/* 批量调整错误容器 */
.adjust-error-container {
    min-height: 40px;
}

/* ========================================
   操作指引样式
   ======================================== */

/* 指引高亮区域 */
#guide-highlight {
    position: fixed;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5), 0 0 25px 5px rgba(59, 130, 246, 1);
    background-color: rgba(59, 130, 246, 0.2);
    border: 2px solid rgba(59, 130, 246, 0.8);
    z-index: 61;
    border-radius: 8px;
}

/* 指引提示框 */
#guide-tooltip {
    position: fixed;
    z-index: 62;
}

/* 指引提示框箭头 */
#guide-tooltip::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 10px solid transparent;
}

/* 箭头位置 - 根据不同位置设置 */
#guide-tooltip.arrow-top::before {
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: white;
}

#guide-tooltip.arrow-bottom::before {
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: white;
}

#guide-tooltip.arrow-left::before {
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    border-left-color: white;
}

#guide-tooltip.arrow-right::before {
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    border-right-color: white;
}

/* 指引步骤圆点 */
.guide-dots {
    display: flex;
    justify-content: center;
    gap: 2px;
    margin-top: 4px;
}

.guide-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #d1d5db;
    transition: all 0.3s ease;
}

.guide-dot.active {
    background-color: #3b82f6;
    transform: scale(1.2);
}

/* 欢迎页面样式 */
.guide-welcome {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: center;
}

.guide-welcome-content {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    max-width: 28rem;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.guide-welcome-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
}

/* ========================================
   响应式设计 - 移动设备适配
   ======================================== */

@media (max-width: 640px) {
    /* 减小移动设备上的提示框最大宽度 */
    #guide-tooltip {
        max-width: 90vw !important;
        max-width: calc(100vw - 40px) !important;
        padding: 4px !important;
    }
    
    /* 调整提示框内容内边距 */
    #guide-tooltip > div {
        padding: 8px !important;
    }
    
    /* 调整提示框文本大小 */
    #guide-tooltip #guide-title {
        font-size: 1rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    #guide-tooltip #guide-content {
        font-size: 0.875rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    /* 调整按钮样式和间距 */
    #guide-tooltip .flex.space-x-2 > button {
        padding: 2px 6px !important;
        font-size: 0.75rem !important;
    }
    
    /* 减小步骤指示器大小 */
    #guide-tooltip .text-sm {
        font-size: 0.75rem !important;
    }
    
    /* 调整悬浮球按钮位置 */
    .floating-guide-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}
