/* Tool Page Specific Styles */

/* 动画关键帧 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Tool Header */
.tool-header {
    padding: 120px 0 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.tool-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    pointer-events: none;
}

.tool-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: var(--space-md);
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.8);
    position: relative;
    z-index: 1;
}

.tool-breadcrumb a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: color 0.2s ease;
}

.tool-breadcrumb a:hover {
    color: white;
    text-decoration: underline;
}

.tool-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--space-md);
    color: white;
    position: relative;
    z-index: 1;
    animation: slideInFromLeft 0.8s ease-out;
}

.tool-description {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: var(--space-lg);
    max-width: 600px;
    position: relative;
    z-index: 1;
    animation: slideInFromLeft 0.8s ease-out 0.2s both;
}

.tool-badges {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
    animation: slideInFromLeft 0.8s ease-out 0.4s both;
}

.tool-badge {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: white;
    border-radius: 25px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.tool-badge:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Tool Interface Section */
.tool-interface-section {
    padding: 60px 0;
    background: #f8fafc;
    min-height: 70vh;
}

.tool-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
    align-items: start;
}

.tool-content {
    min-width: 0; /* Prevent overflow */
}

.tool-panel {
    background: white;
    border: none;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    animation: fadeInUp 0.6s ease-out;
}

.tool-panel:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-bottom: none;
    position: relative;
}

.panel-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    pointer-events: none;
}

.panel-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    margin: 0;
    position: relative;
    z-index: 1;
}

.panel-actions {
    display: flex;
    gap: var(--space-sm);
    position: relative;
    z-index: 1;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-sm:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.panel-body {
    padding: 32px;
    background: white;
}

/* Tool Sidebar */
.tool-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-panel {
    background: white;
    border: none;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    animation: fadeInUp 0.6s ease-out;
    animation-delay: 0.2s;
    animation-fill-mode: both;
}

.sidebar-panel:hover {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.sidebar-panel h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-panel h4::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

.usage-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.usage-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.usage-step:hover {
    background: #f1f5f9;
    border-color: #667eea;
    transform: translateX(4px);
}

.step-number {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.step-text {
    font-size: 0.875rem;
    color: #475569;
    line-height: 1.5;
}

.related-tools {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.related-tool {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    text-decoration: none;
    color: #1f2937;
    transition: all 0.3s ease;
    background: white;
}

.related-tool:hover {
    background: #f8fafc;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
}

.related-tool-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.related-tool-content {
    flex: 1;
}

.related-tool-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: #1f2937;
    margin-bottom: 2px;
}

.related-tool-desc {
    font-size: 0.75rem;
    color: #64748b;
}

/* Feature List */
.feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.feature-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.feature-list li:hover {
    background: #f1f5f9;
    border-color: #10b981;
    transform: translateX(4px);
}

.feature-list li i {
    color: #10b981;
    font-size: 0.875rem;
    width: 16px;
    text-align: center;
}

.feature-list li span {
    font-size: 0.875rem;
    color: #374151;
    font-weight: 500;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .tool-layout {
        grid-template-columns: 1fr 280px;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .tool-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .tool-sidebar {
        order: -1;
    }

    .panel-header {
        padding: 20px 24px;
    }

    .panel-body {
        padding: 24px;
    }

    .sidebar-panel {
        padding: 20px;
    }

    .tool-title {
        font-size: 2rem;
    }

    .textarea-field {
        min-height: 150px;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn-group.btn-group-grid {
        grid-template-columns: 1fr;
    }
}

/* 工具界面样式 */
.tool-interface {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
    margin-bottom: 4px;
}

.textarea-field {
    width: 100%;
    min-height: 180px;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    background: #f9fafb;
    transition: all 0.3s ease;
    resize: vertical;
    max-height: 400px;
}

.textarea-field:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.textarea-field[readonly] {
    background: #f8fafc;
    color: #374151;
    cursor: default;
}

.input-field {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    background: #f9fafb;
    transition: all 0.3s ease;
}

.input-field:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 8px 0;
}

.btn-group.btn-group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.btn-group.btn-group-center {
    justify-content: center;
}

.btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

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

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}

.btn-secondary:hover {
    box-shadow: 0 8px 20px rgba(107, 114, 128, 0.4);
}

/* 状态消息样式 */
.status-message {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    margin-top: 16px;
}

.status-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.status-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.status-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* 代码编辑器样式 */
.code-editor {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #1e293b;
    border: 2px solid #334155;
    transition: all 0.3s ease;
}

.code-editor:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.code-editor-header {
    background: #0f172a;
    padding: 12px 16px;
    border-bottom: 1px solid #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.code-editor-title {
    color: #e2e8f0;
    font-size: 0.875rem;
    font-weight: 500;
}

.code-editor-actions {
    display: flex;
    gap: 8px;
}

.code-editor-btn {
    padding: 4px 8px;
    background: #334155;
    color: #e2e8f0;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.code-editor-btn:hover {
    background: #475569;
}

.code-editor textarea {
    background: #1e293b;
    color: #e2e8f0;
    border: none;
    padding: 16px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    width: 100%;
    min-height: 200px;
    resize: vertical;
}

.code-editor textarea:focus {
    outline: none;
}

.code-editor textarea::placeholder {
    color: #64748b;
}

/* 语法高亮样式 */
.syntax-highlight {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    overflow-x: auto;
}

.syntax-highlight .string { color: #22d3ee; }
.syntax-highlight .number { color: #fb7185; }
.syntax-highlight .boolean { color: #a78bfa; }
.syntax-highlight .null { color: #6b7280; }
.syntax-highlight .key { color: #fbbf24; }

/* 工具特定样式 */
.tool-grid {
    display: grid;
    grid-template-columns: 4fr;
    gap: 24px;
    margin-top: 24px;
}

/* 当有多个工具部分时使用两列布局 */
.tool-grid.two-columns {
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 768px) {
    .tool-grid.two-columns {
        grid-template-columns: 1fr;
    }
}

.tool-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.tool-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-section-title::before {
    content: '';
    width: 3px;
    height: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

@media (max-width: 768px) {
    .tool-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn-group.btn-group-grid {
        grid-template-columns: 1fr;
    }
}

/* 统计网格样式 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.stat-item {
    text-align: center;
    padding: 16px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.stat-item:hover {
    background: #f1f5f9;
    border-color: #667eea;
    transform: translateY(-2px);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 复选框组样式 */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    transition: color 0.2s ease;
}

.checkbox-group label:hover {
    color: #1f2937;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #667eea;
}

/* 选择框样式 */
select.input-field {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
    appearance: none;
}

/* 范围滑块样式 */
input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* 加载状态样式 */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn.loading::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

/* 工具提示样式 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px 12px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

.related-tool-info h5 {
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0 0 2px 0;
}

.related-tool-info p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.feature-list li {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.feature-list i {
    color: var(--success);
    font-size: 0.75rem;
}

/* Other Tools Section */
.other-tools {
    padding: 60px 0;
    background: var(--bg-secondary);
}

.other-tools h2 {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--space-2xl);
    color: var(--text-primary);
}

.other-tools .tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-lg);
}

.other-tool-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: var(--space-lg);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.other-tool-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.other-tool-icon {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    margin-bottom: var(--space-md);
}

.other-tool-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.other-tool-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tool-layout {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
    
    .tool-sidebar {
        order: -1;
    }
    
    .tool-title {
        font-size: 2rem;
    }
    
    .panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }
    
    .other-tools .tools-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .tool-header {
        padding: 100px 0 40px;
    }
    
    .tool-title {
        font-size: 1.75rem;
    }
    
    .tool-badges {
        justify-content: center;
    }
    
    .panel-body {
        padding: var(--space-md);
    }
    
    .sidebar-panel {
        padding: var(--space-md);
    }
}

/* Text Analysis Styles */
.analysis-results {
    margin-top: var(--space-lg);
    padding: var(--space-lg);
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-md);
}

.stat-card {
    background: white;
    padding: var(--space-md);
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--space-xs);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
