/*
 * coax的小工具 - 一套实用的前端工具集合
 * 
 * MIT License
 * 
 * Copyright (c) 2025 coax
 * 
 *  Permission is hereby granted, free of charge, to any person obtaining a copy
 *  of this software and associated documentation files (the "Software"), to deal
 *  in the Software without restriction, including without limitation the rights
 *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 *  copies of the Software, and to permit persons to whom the Software is
 *  furnished to do so, subject to the following conditions:
 * 
 *  The above copyright notice and this permission notice shall be included in all
 *  copies or substantial portions of the Software.
 * 
 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 *  SOFTWARE.
 * 
 *  一套实用的前端工具集合，包括文本处理、数据转换、文件操作等多种实用工具。
 *  源码可得，快乐加倍！记得给个Star哦~ 🌟
 */

/* ========================================
   公共基础样式 - 所有主题的共同依赖
   ======================================== */

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

/* 工具提示 */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 12px;
    white-space: nowrap;
    border-radius: 4px;
    z-index: 1000;
}

/* 禁用状态 */
.disabled,
[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* 隐藏元素 */
.hidden {
    display: none !important;
}

/* 可见性隐藏 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* 加载动画 */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

/* 渐入动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

/* 滑入动画 */
@keyframes slideIn {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

/* ========================================
   公共组件样式
   ======================================== */

/* 消息提示 - 通用 */
.message {
    padding: 12px 16px;
    border-radius: 6px;
    margin: 10px 0;
    animation: slideIn 0.3s ease-out;
}

.message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* 按钮基础 - 通用 */
.btn {
    display: inline-block;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary:hover {
    background: #5a6268;
}

/* 输入框基础 - 通用 */
input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
textarea,
select {
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* 标签页 */
.tabs {
    display: flex;
    gap: 0.3vw;
    margin-bottom: 1.5vw;
    border-bottom: 1px solid #ddd;
}

/* 工具卡片加载动画 - 打字机风格 */
.tool-card {
    opacity: 0;
}

.tool-card.animate {
    animation: fadeIn 0.08s ease forwards;
}

.tool-card.animate h3 {
    overflow: hidden;
    white-space: nowrap;
}

.tool-card.animate p {
    animation: fadeSlideIn 0.08s ease forwards;
    animation-delay: 0.08s;
    opacity: 0;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 0.8;
        transform: translateY(0);
    }
}

/* 共享光标 */
.type-cursor {
    position: fixed;
    width: 2px;
    height: 1.2em;
    background: #333;
    animation: cursorBlink 0.3s steps(1) infinite;
    pointer-events: none;
    z-index: 1000;
    display: none;
}

.type-cursor.active {
    display: block;
}

@keyframes cursorBlink {
    50% { opacity: 0; }
}
