/* ========================================
   个人所得税计算器 - 主样式文件
   包含所有自定义样式定义
   ======================================== */

/* ========================================
   页面交互和安全性样式
   ======================================== */

/* 防止用户选择页面文本（安全保护） */
body {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    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;
    }
}