/**
 * 个人标签引导页 - 工具样式
 *
 * @description 工具弹窗样式：计算器、记事本、待办、时钟、换算、密码、JSON、Base64、颜色、屏幕检测及新增17个工具
 */

/* ==================== 工具弹窗基础 ==================== */
#toolModal .modal-content {
    max-width: 500px;
}

#toolModalBody {
    padding: 1rem 0;
}

/* ==================== 通用表单元素样式 ==================== */
#toolModalBody textarea,
#toolModalBody input[type="text"],
#toolModalBody input[type="number"],
#toolModalBody select {
    width: 100%;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    box-sizing: border-box;
}

#toolModalBody textarea {
    resize: vertical;
    min-height: 80px;
}

#toolModalBody label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

#toolModalBody input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

#toolModalBody input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

#toolModalBody code {
    font-family: 'SF Mono', Monaco, monospace;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

#toolModalBody img {
    max-width: 100%;
    border-radius: 8px;
}

/* ==================== 计算器 ==================== */
.calc-display {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.calc-display input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 2rem;
    text-align: right;
    outline: none;
}

.calc-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.calc-buttons button {
    padding: 1rem;
    font-size: 1.25rem;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.calc-buttons button:hover {
    background: var(--accent);
}

.calc-buttons button.calc-zero {
    grid-column: span 2;
}

/* ==================== 记事本 ==================== */
.notepad-textarea {
    width: 100%;
    height: 300px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    resize: none;
    outline: none;
}

.notepad-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: flex-end;
}

/* ==================== 待办事项 ==================== */
.todo-input-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.todo-input-row input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    outline: none;
}

.todo-list {
    max-height: 300px;
    overflow-y: auto;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin-bottom: 0.5rem;
}

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

.todo-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.todo-item span {
    flex: 1;
}

.todo-item button {
    padding: 0.25rem 0.75rem;
    background: rgba(239, 68, 68, 0.2);
    border: none;
    border-radius: 6px;
    color: #ef4444;
    cursor: pointer;
}

/* ==================== 时钟 ==================== */
.clock-display {
    text-align: center;
    padding: 2rem;
}

.clock-time {
    font-size: 4rem;
    font-weight: 700;
    font-family: 'SF Mono', Monaco, monospace;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.clock-date {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* ==================== 单位换算 ==================== */
.converter-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.converter-row input,
.converter-row select {
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    outline: none;
}

.converter-row input {
    width: 100px;
}

.converter-row span {
    font-size: 1.5rem;
    color: var(--text-secondary);
}

/* ==================== 密码生成 ==================== */
.password-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.password-options label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.password-length {
    margin-bottom: 1rem;
}

.password-length input[type="range"] {
    width: 100%;
    margin-top: 0.5rem;
}

.password-result {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.password-result input {
    flex: 1;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: monospace;
}

/* ==================== JSON格式化 ==================== */
.json-editor textarea {
    width: 100%;
    height: 150px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.9rem;
    resize: none;
    outline: none;
    margin-bottom: 0.75rem;
}

.json-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

/* ==================== Base64 ==================== */
.base64-editor textarea {
    width: 100%;
    height: 120px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.9rem;
    resize: none;
    outline: none;
    margin-bottom: 0.75rem;
}

.base64-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

/* ==================== 颜色选择器 ==================== */
.color-picker-wrapper {
    text-align: center;
    padding: 1rem;
}

.color-picker-wrapper input[type="color"] {
    width: 100%;
    height: 60px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

.color-preview {
    width: 100%;
    height: 100px;
    border-radius: 10px;
    margin: 1rem 0;
    background: #6366f1;
}

.color-value-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.color-value-row span {
    color: var(--text-secondary);
    min-width: 50px;
}

.color-value-row code {
    flex: 1;
    font-family: monospace;
    color: var(--text-primary);
}

/* ==================== 屏幕检测 ==================== */
.screen-test {
    text-align: center;
    padding: 1rem;
}

.screen-info {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    font-family: monospace;
    line-height: 1.8;
}

/* .btn 已统一定义在 components.css,此处删除重复 */

/* ==================== 倒数日 ==================== */
.countdown-tool .countdown-input-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.countdown-tool label {
    min-width: 80px;
    color: var(--text-secondary);
}

.countdown-tool input {
    flex: 1;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    outline: none;
}

.countdown-result {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 10px;
    text-align: center;
}

.countdown-message {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.countdown-list {
    margin-top: 1rem;
    max-height: 200px;
    overflow-y: auto;
}

.countdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.countdown-item.future { border-left: 3px solid #22c55e; }
.countdown-item.today { border-left: 3px solid #f59e0b; }
.countdown-item.past { border-left: 3px solid #ef4444; }

/* ==================== 日期换算 ==================== */
.dateconvert-tool .tab-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.dateconvert-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.dateconvert-row label {
    min-width: 100px;
    color: var(--text-secondary);
}

.dateconvert-row input {
    flex: 1;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    outline: none;
}

.dateconvert-result {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    line-height: 1.8;
}

/* ==================== 文本统计 ==================== */
.textstats-tool textarea {
    width: 100%;
    height: 200px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    resize: vertical;
    outline: none;
    margin-bottom: 1rem;
}

.textstats-result {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.stat-label {
    color: var(--text-secondary);
}

.stat-value {
    color: var(--accent);
    font-weight: 600;
}

/* ==================== 颜色码转换 ==================== */
.colorcode-tool .colorcode-input-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.colorcode-tool label {
    min-width: 80px;
    color: var(--text-secondary);
}

.colorcode-tool input {
    flex: 1;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    outline: none;
}

.colorcode-preview {
    width: 100%;
    height: 80px;
    border-radius: 10px;
    margin-bottom: 1rem;
    background: transparent;
    border: 1px solid var(--border);
}

.colorcode-results {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.colorcode-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.colorcode-result-item span {
    min-width: 50px;
    color: var(--text-secondary);
}

.colorcode-result-item code {
    flex: 1;
    font-family: monospace;
    color: var(--text-primary);
}

/* ==================== 摩斯码转换 ==================== */
.morse-tool .morse-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.morse-tool textarea {
    width: 100%;
    height: 120px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    color: var(--text-primary);
    font-family: monospace;
    resize: none;
    outline: none;
    margin-bottom: 0.75rem;
}

/* ==================== 图片工具通用 ==================== */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 1rem;
}

.upload-area:hover {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.05);
}

.upload-area i {
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.upload-area p {
    color: var(--text-secondary);
}

/* ==================== 图片压缩 ==================== */
.compress-options {
    margin-bottom: 1rem;
}

.compress-options label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.compress-options input[type="range"] {
    width: 100%;
}

.compress-result {
    margin-top: 1rem;
}

.compress-info {
    display: flex;
    justify-content: space-around;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    margin-bottom: 1rem;
}

/* ==================== 格式转换 ==================== */
.format-options {
    margin-bottom: 1rem;
}

.format-options label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.format-options select {
    width: 100%;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    outline: none;
}

.format-result {
    margin-top: 1rem;
}

/* ==================== 九宫格切图 ==================== */
.grid-pieces {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}

.grid-piece {
    position: relative;
}

.grid-piece img {
    width: 100%;
    border-radius: 8px;
}

.grid-piece .btn {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.grid-piece:hover .btn {
    opacity: 1;
}

/* ==================== 图片拼接 ==================== */
.merge-options {
    margin-bottom: 1rem;
}

.merge-options label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.merge-options select {
    width: 100%;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    outline: none;
}

.merge-result {
    margin-top: 1rem;
}

/* ==================== 图片加水印 ==================== */
.watermark-options {
    margin-bottom: 1rem;
}

.watermark-options label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.watermark-options input {
    width: 100%;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    outline: none;
    margin-bottom: 0.75rem;
}

.watermark-result {
    margin-top: 1rem;
}

/* ==================== 趣味抽签/决策 ==================== */
.lottery-tool textarea,
.decision-tool textarea,
.wheel-tool textarea {
    width: 100%;
    height: 120px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    color: var(--text-primary);
    resize: none;
    outline: none;
    margin-bottom: 1rem;
}

.lottery-result,
.decision-result,
.wheel-result {
    margin-top: 1rem;
    text-align: center;
}

.lottery-animation,
.decision-animation,
.eatwhat-animation {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent);
    animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.lottery-winner,
.decision-winner,
.eatwhat-winner,
.wheel-winner {
    font-size: 1.3rem;
    font-weight: 600;
    color: #22c55e;
    padding: 1rem;
    background: rgba(34, 197, 94, 0.1);
    border-radius: 10px;
}

/* ==================== 吃什么 ==================== */
.eatwhat-categories {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.category-btn {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.category-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.eatwhat-result {
    margin-top: 1rem;
    text-align: center;
}

/* ==================== 房贷计算 ==================== */
.mortgage-tool .mortgage-input-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.mortgage-tool label {
    min-width: 100px;
    color: var(--text-secondary);
}

.mortgage-tool input,
.mortgage-tool select {
    flex: 1;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    outline: none;
}

.mortgage-result {
    margin-top: 1rem;
}

.mortgage-summary {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.summary-item strong {
    color: var(--accent);
    font-size: 1.1rem;
}

/* ==================== 心情日记 ==================== */
.mood-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.mood-btn {
    flex: 1;
    min-width: 80px;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.mood-btn:hover {
    background: rgba(99, 102, 241, 0.1);
}

.mood-btn.selected {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.mood-tool textarea {
    width: 100%;
    height: 100px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    color: var(--text-primary);
    resize: none;
    outline: none;
    margin-bottom: 1rem;
}

.mood-history {
    margin-top: 1rem;
    max-height: 200px;
    overflow-y: auto;
}

.mood-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.mood-emoji {
    font-size: 1.5rem;
}

.mood-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.mood-note {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* ==================== 习惯打卡 ==================== */
.habit-tool .habit-input-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.habit-tool input {
    flex: 1;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    outline: none;
}

.habit-list {
    max-height: 300px;
    overflow-y: auto;
}

.habit-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.habit-name {
    flex: 1;
    color: var(--text-primary);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

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

.btn.checked {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

/* ==================== 响应式适配 ==================== */
@media (max-width: 768px) {
    .calc-buttons {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
    }

    .clock-time {
        font-size: 2.5rem;
    }

    .textstats-result {
        grid-template-columns: 1fr;
    }

    .grid-pieces {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.25rem;
    }

    .mood-selector {
        flex-wrap: wrap;
    }

    .mood-btn {
        min-width: 60px;
        font-size: 0.9rem;
    }
}