/**
 * 顶部工具栏模块样式
 * 包含工具栏、按钮、控件、署名等所有相关样式
 */

/* ==================== 工具栏主容器 ==================== */
.top-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 4px 12px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    z-index: 1000;
    box-shadow: none;
    transition: all 0.3s ease;
    height: 36px;
    box-sizing: border-box;
}

/* ==================== 工具栏按钮 ==================== */
.toolbar-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.toolbar-btn:hover {
    background: var(--hover);
    border-color: var(--primary);
}

.toolbar-btn.active {
    background: #3b82f6 !important;
    color: white !important;
    border-color: #3b82f6 !important;
}

/* ==================== 搜索输入框 ==================== */
.search-input-inline {
    background: white;
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    width: 180px;
    transition: all 0.2s ease;
}

.search-input-inline:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ==================== 字体大小控制 ==================== */
.font-size-control {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    white-space: nowrap;
    height: 26px;
    box-sizing: border-box;
}

.font-size-label {
    font-size: 12px;
    color: var(--text);
    font-weight: 500;
}

.font-size-slider {
    width: 80px;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.font-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.font-size-slider::-webkit-slider-thumb:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
}

.font-size-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.font-size-slider::-moz-range-thumb:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
}

.font-size-value {
    font-size: 11px;
    color: var(--text);
    font-weight: 500;
    min-width: 35px;
    text-align: center;
}

/* ==================== HTML缩放控制 ==================== */
.html-zoom-control {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    white-space: nowrap;
    height: 26px;
    box-sizing: border-box;
}

/* ==================== 工具栏右侧按钮组 ==================== */
.toolbar-right-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex-shrink: 0;
}

.toolbar-action-btn {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 4px 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    color: #475569;
    white-space: nowrap;
    position: relative;
}

.toolbar-action-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #1e293b;
}

.toolbar-action-btn:active {
    transform: scale(0.97);
}

.toolbar-action-btn .action-icon {
    font-size: 13px;
    line-height: 1;
}

.toolbar-action-btn .action-text {
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* 首页按钮特殊样式 */
#homeBtn:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

/* 关于按钮特殊样式 */
#aboutBtn:hover {
    background: #faf5ff;
    border-color: #e9d5ff;
    color: #7c3aed;
}

/* 联系按钮特殊样式 */
.contact-btn:hover {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #15803d;
}

/* ==================== 联系悬浮卡片 ==================== */
.contact-tooltip {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.25s ease;
    z-index: 1000;
    pointer-events: none;
}

.contact-btn:hover .contact-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.contact-tooltip-content {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 16px;
    min-width: 150px;
    text-align: center;
    border: 1px solid #e2e8f0;
}

/* 小三角箭头 */
.contact-tooltip-content::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 16px;
    width: 12px;
    height: 12px;
    background: #ffffff;
    border-left: 1px solid #e2e8f0;
    border-top: 1px solid #e2e8f0;
    transform: rotate(45deg);
}

.contact-qrcode {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid #f1f5f9;
}

.contact-phone {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 6px;
    font-size: 13px;
    color: #334155;
    font-weight: 500;
}

.contact-phone .phone-number {
    letter-spacing: 0.5px;
    user-select: all;
}

/* ==================== 暗色模式适配 ==================== */
@media (prefers-color-scheme: dark) {
    .toolbar-right-actions .toolbar-action-btn {
        background: #1e293b;
        border-color: #334155;
        color: #94a3b8;
    }

    .toolbar-right-actions .toolbar-action-btn:hover {
        background: #334155;
        border-color: #475569;
        color: #f1f5f9;
    }

    #homeBtn:hover {
        background: #1e3a5f;
        border-color: #3b82f6;
        color: #93c5fd;
    }

    #aboutBtn:hover {
        background: #2e1065;
        border-color: #7c3aed;
        color: #c4b5fd;
    }

    .contact-btn:hover {
        background: #14532d;
        border-color: #22c55e;
        color: #86efac;
    }

    .contact-tooltip-content {
        background: #1e293b;
        border-color: #334155;
    }

    .contact-tooltip-content::before {
        background: #1e293b;
        border-color: #334155;
    }

    .contact-phone {
        background: #0f172a;
        color: #e2e8f0;
    }

    .current-file-name {
        background: linear-gradient(135deg, #1e3a5f 0%, #1e40af 100%);
        border-color: #3b82f6;
        color: #e0f2fe;
        box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
    }

    .current-file-name:hover {
        background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
        border-color: #60a5fa;
        box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
    }
}

/* ==================== 当前文件显示 ==================== */
.current-file-display {
    display: none !important;
    align-items: center;
    padding: 0;
    max-width: 500px;
    min-width: 150px;
}

.current-file-name {
    font-size: 13px;
    color: #075985;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 450px;
    cursor: pointer;
    padding: 4px 10px 4px 8px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: 4px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(14, 165, 233, 0.1);
    letter-spacing: 0.01em;
}

.current-file-name::before {
    content: "📄 ";
    font-size: 13px;
    margin-right: 4px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.current-file-name:hover {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border-color: #7dd3fc;
    box-shadow: 0 4px 8px rgba(14, 165, 233, 0.15);
    transform: translateY(-1px);
    color: #0c4a6e;
}

/* ==================== 图片旋转按钮 ==================== */
.image-rotate-btn {
    background: #f9fafb;
    border: 1px solid #d1d5db;
    color: #374151;
    transition: all 0.2s ease;
    margin-left: 6px;
}

.image-rotate-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.image-rotate-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ==================== 移动端样式优化 ==================== */
@media (max-width: 768px) {
    .top-toolbar {
        padding: 8px 12px;
        gap: 8px;
        height: 33px;
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    /* 隐藏滚动条但保持滚动功能 */
    .top-toolbar::-webkit-scrollbar {
        display: none;
    }

    .top-toolbar {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    /* 移动端隐藏不必要的元素 */
    .developer-signature,
    .search-input-inline,
    .font-size-control,
    .html-zoom-control {
        display: none !important;
    }

    /* 移动端按钮更紧凑 */
    .toolbar-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .current-file-display {
        max-width: 300px;
        min-width: 120px;
        padding: 0;
    }

    .current-file-name {
        max-width: 250px;
        font-size: 11px;
        padding: 6px 12px 6px 10px;
        border-radius: 16px;
    }

    .current-file-name::before {
        font-size: 13px;
        margin-right: 4px;
    }

    .image-rotate-btn {
        padding: 6px 8px;
        font-size: 14px;
        margin-left: 6px;
    }
}

/* ==================== 超小屏幕优化 ==================== */
@media (max-width: 480px) {
    .top-toolbar {
        padding: 6px 8px;
        gap: 6px;
    }

    .toolbar-btn {
        padding: 5px 5px;
        font-size: 12px;
    }

    .current-file-display {
        max-width: 150px;
        min-width: 80px;
    }

    .current-file-name {
        max-width: 130px;
        font-size: 9px;
        padding: 4px 8px 4px 6px;
        border-radius: 12px;
    }

    .current-file-name::before {
        font-size: 11px;
        margin-right: 3px;
    }

    .image-rotate-btn {
        padding: 4px 6px;
        font-size: 12px;
        margin-left: 4px;
    }

    /* 移动端右侧按钮组样式优化 - 只显示图标 */
    .toolbar-right-actions {
        display: flex !important;
        gap: 2px;
        margin-left: auto;
    }

    /* 移动端按钮只显示图标，隐藏文字 */
    .toolbar-right-actions .action-text {
        display: none;
    }

    .toolbar-right-actions .toolbar-action-btn {
        padding: 4px 8px;
        min-width: 28px;
        justify-content: center;
    }

    .toolbar-right-actions .action-icon {
        font-size: 14px;
    }

    /* 移动端隐藏联系悬浮卡片，改为点击显示 */
    .contact-tooltip {
        display: none;
    }
}

/* ==================== 关于弹窗 ==================== */
.about-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.about-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.about-modal {
    background: #ffffff;
    border-radius: 16px;
    max-width: 420px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    position: relative;
}

.about-modal-overlay.show .about-modal {
    transform: scale(1) translateY(0);
}

.about-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f1f5f9;
    border-radius: 50%;
    font-size: 20px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.about-modal-close:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.about-modal-header {
    text-align: center;
    padding: 32px 24px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px 16px 0 0;
    color: white;
}

.about-avatar {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 0 auto 12px;
    backdrop-filter: blur(10px);
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.about-name {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 4px;
    letter-spacing: 0.05em;
}

.about-title {
    font-size: 14px;
    opacity: 0.9;
    margin: 0;
}

.about-modal-body {
    padding: 24px;
}

.about-section {
    margin-bottom: 20px;
}

.about-section:last-child {
    margin-bottom: 0;
}

.about-section h3 {
    font-size: 14px;
    color: #475569;
    margin: 0 0 8px;
    font-weight: 600;
}

.about-section p {
    font-size: 14px;
    color: #64748b;
    margin: 0;
    line-height: 1.6;
}

.about-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.about-tag {
    display: inline-block;
    padding: 4px 10px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    color: #0369a1;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* 暗色模式关于弹窗 */
@media (prefers-color-scheme: dark) {
    .about-modal {
        background: #1e293b;
    }

    .about-modal-close {
        background: #334155;
        color: #94a3b8;
    }

    .about-modal-close:hover {
        background: #475569;
        color: #f1f5f9;
    }

    .about-section h3 {
        color: #94a3b8;
    }

    .about-section p {
        color: #cbd5e1;
    }

    .about-tag {
        background: linear-gradient(135deg, #1e3a5f 0%, #1e40af 100%);
        color: #93c5fd;
    }
}
