/* ==========================================
 * 9bps Studio - 串口调试工具样式
 * ========================================== */

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.dark ::-webkit-scrollbar-thumb {
    background: #475569;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* 信号LED动画 */
.signal-led {
    transition: all 0.3s ease;
}

.signal-led.active {
    box-shadow: 0 0 10px currentColor;
    animation: pulse-led 1s ease-in-out infinite;
}

@keyframes pulse-led {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* 玻璃态效果 */
.glass {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* 终端光标闪烁 */
.cursor-blink {
    animation: blink 1s step-end infinite;
}

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

/* Hex文本样式 */
.hex-text {
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    letter-spacing: 0.05em;
}

/* 切换图标样式 */
.toggle-icon-small {
    position: relative;
    width: 16px;
    height: 16px;
    cursor: pointer;
    user-select: none;
    overflow: hidden;
}

.icon-cross-small,
.icon-check-small {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.23, 1, 0.32, 1),
                transform 0.45s cubic-bezier(0.23, 1, 0.32, 1);
    will-change: transform, opacity;
    transform-origin: 50% 50%;
}

/* 叉 - 初始可见 */
.icon-cross-small {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* 勾 - 初始隐藏 */
.icon-check-small {
    opacity: 0;
    transform: scale(0.75) rotate(-8deg);
}

/* 显示勾时 */
.toggle-icon-small.show-check .icon-cross-small {
    opacity: 0;
    transform: scale(0.75) rotate(8deg);
}

.toggle-icon-small.show-check .icon-check-small {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* SVG线条样式 */
.icon-cross-small line,
.icon-check-small polyline {
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    stroke-width: 3;
}

/* 拖拽样式 */
.dragging {
    opacity: 0.5;
    transform: scale(1.02);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* 按钮悬停效果 */
button {
    transition: all 0.2s ease;
}

button:active:not(:disabled) {
    transform: scale(0.98);
}

/* 输入框焦点效果 */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.dark input:focus,
.dark select:focus,
.dark textarea:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

/* 卡片悬停效果 */
.command-list-item {
    transition: all 0.3s ease;
}

.command-list-item:hover {
    transform: translateY(-1px);
}

/* 状态指示器动画 */
.status-item {
    transition: all 0.3s ease;
}

/* 终端样式 */
#terminal {
    line-height: 1.6;
    tab-size: 4;
}

#terminal div {
    word-break: break-all;
}

/* 快速发送按钮样式 */
.flex.gap-2.flex-wrap.mb-3 button {
    transition: all 0.2s ease;
}

.flex.gap-2.flex-wrap.mb-3 button:hover {
    transform: translateY(-1px);
}

/* 模态框动画 */
#commandEditDialog,
#serialBridgeSettingsModal {
    animation: fadeIn 0.2s ease;
}

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

#commandEditDialog > div,
#serialBridgeSettingsModal > div {
    animation: slideUp 0.2s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 侧边栏过渡 */
aside {
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 标签页切换动画 */
#toolsContentModbus,
#toolsContentBatch,
#toolsContentSerialBridge {
    animation: fadeIn 0.2s ease;
}

/* 二维码容器 */
#serialBridgeQrcode {
    display: flex;
    justify-content: center;
    padding: 1rem;
    background: white;
    border-radius: 0.5rem;
}

.dark #serialBridgeQrcode {
    background: #1e1e2e;
}

#serialBridgeQrcode img {
    border-radius: 0.25rem;
}

/* 信号按钮样式 */
.signal-btn {
    transition: all 0.3s ease;
}

.signal-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 通知样式 */
.notification {
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 加载动画 */
.loading-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 脉冲动画 */
.pulse-animation {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

/* 渐变背景 */
.gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* 阴影效果 */
.shadow-soft {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.shadow-medium {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* 文本截断 */
.truncate-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 多行文本截断 */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 禁用文本选择 */
.no-select {
    user-select: none;
    -webkit-user-select: none;
}

/* 平滑滚动 */
.smooth-scroll {
    scroll-behavior: smooth;
}

/* 隐藏滚动条但保持功能 */
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

/* 响应式调整 */
@media (max-width: 1024px) {
    aside {
        width: 100% !important;
    }
}

/* 打印样式 */
@media print {
    .no-print {
        display: none !important;
    }
}
