/* HMAC-SHA 加密工具样式 */

/* 主容器布局 */
.hmac-sha-container {
    display: flex;
    gap: 0;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 20px;
}

/* 左侧输入区域 */
.hmac-sha-input-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 300px;
    overflow: hidden;
}

/* 右侧输出区域 */
.hmac-sha-output-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 300px;
    overflow: hidden;
}

/* 编辑器容器 */
.hmac-sha-editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 加密选项区域 */
.encryption-options-section {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
}

.encryption-options-header {
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.options-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* 算法选择块 */
.encryption-mode-block {
    margin-bottom: 20px;
}

.mode-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.mode-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
}

.mode-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.2s ease;
    cursor: pointer;
}

.mode-select:focus {
    border-color: var(--accent-light);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.mode-info {
    margin-top: 6px;
}

.mode-description {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.3;
}

/* 密钥输入块 */
.key-input-block {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 12px;
}

.key-input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.key-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
}

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

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
}

.key-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: var(--font-family-mono);
    font-size: 13px;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.2s ease;
}

.key-input:focus {
    border-color: var(--accent-light);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.key-input::placeholder {
    color: var(--text-muted);
}

.key-info {
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.key-length-info {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-family-mono);
}

.key-length-valid {
    color: var(--accent-light);
}

.key-length-invalid {
    color: var(--error-color);
}

/* 结果查看器 */
.hmac-sha-result {
    flex: 1;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    overflow-wrap: break-word;
}

.result-viewer {
    overflow: auto;
    padding: 0;
    margin: 0;
    font-family: var(--font-family-mono);
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
}

#resultOutput {
    background-color: var(--bg-tertiary);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 16px;
    font-family: var(--font-family-mono);
    font-size: 14px;
    line-height: 1.4;
    overflow-x: auto;
    min-height: 200px;
}

.resize-handle {
    width: 12px;
    background-color: var(--bg-primary);
    cursor: col-resize;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    min-width: 8px;
    flex-shrink: 0;
}

.resize-line {
    width: 2px;
    height: 60px;
    background-color: var(--border-color);
    border-radius: 1px;
    transition: background-color 0.2s ease;
}

.resize-handle:hover .resize-line {
    background-color: var(--text-primary);
}

.resize-handle:active .resize-line {
    background-color: var(--text-primary);
}

/* 结果占位符 */
.result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    border: 1px dashed var(--border-color);
}

.placeholder-icon {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.4;
    color: var(--text-muted);
}

.placeholder-text {
    font-size: 14px;
    max-width: 280px;
    line-height: 1.4;
    color: var(--text-muted);
    font-weight: 400;
}

/* 错误信息样式 */
.hmac-sha-error {
    background-color: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    padding: 16px;
}

.hmac-sha-error h4 {
    color: var(--error-color);
    font-size: 14px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #3c1b1a;
}

.hmac-sha-error h4::before {
    font-size: 18px;
}

.hmac-sha-error .error-message {
    display: block;
    margin-top: 0;
    background-color: transparent;
    border: none;
    border-radius: 0;
    border-left: none;
    padding: 15px 0px;
    font-family: var(--font-family-mono);
    font-size: 13px;
    line-height: 1.5;
}

/* 结果内容样式 */
.result-content {
    font-family: var(--font-family-mono);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    padding: 16px;
    margin: 0;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    outline: none;
    width: 100%;
    min-height: 120px;
}

/* 成功状态样式 */
.result-success {
    border-left: 3px solid var(--success-color);
    background: rgba(16, 185, 129, 0.05);
}

/* HMAC结果样式 */
.hmac-result {
    color: var(--accent-light);
    background: rgba(16, 185, 129, 0.05);
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid var(--success-color);
    margin-bottom: 8px;
}

/* 结果区域整体样式 */
.result-section {
    padding: 12px;
}

/* HMAC哈希显示 */
.hmac-hash-container {
    background: var(--bg-secondary);
    border-radius: 6px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hmac-hash-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.hmac-hash-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 60px;
    flex-shrink: 0;
}

.hmac-hash {
    font-family: var(--font-family-mono);
    font-size: 14px;
    line-height: 1.4;
    color: var(--accent-light);
    word-break: break-all;
    flex: 1;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    border: 1px solid var(--border-color);
}

.copy-hash-btn {
    padding: 4px 8px;
    font-size: 11px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--accent-color);
    color: var(--bg-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.copy-hash-btn:hover {
    background: var(--accent-light);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

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

/* 结果标题 */
.result-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* 统计区域整体样式 */
.stats-section {
    margin-top: 16px;
    padding: 12px;
}

/* 统计标题 */
.stats-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* 结果统计信息 */
.result-stats {
    display: flex;
    gap: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
    flex-wrap: nowrap;
    justify-content: space-between;
}

.stat-item {
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex: 1 1 0;
    min-width: 0;
    text-align: left;
}

.stat-label {
    font-weight: 500;
    font-size: 11px;
    white-space: nowrap;
}

.stat-value {
    font-weight: 600;
    font-family: var(--font-family-mono);
    font-size: 11px;
    white-space: nowrap;
}

/* HMAC结果格式样式 */
.hmac-format-section {
    margin-bottom: 16px;
}

.format-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.format-value {
    font-family: var(--font-family-mono);
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    word-break: break-all;
    overflow-wrap: break-word;
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.copy-btn:active {
    transform: scale(0.95);
}

/* 动画效果 */
.result-fade-in {
    animation: fadeInResult 0.3s ease-in-out;
}

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

/* 处理状态指示器 */
.processing-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 14px;
}

.processing-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-muted);
    border-radius: 50%;
    border-top-color: var(--accent-light);
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

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

/* 文档区域样式 */
.character-set {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 20px;
    margin: 16px 0;
    border: 1px solid var(--border-color);
}

.charset-item {
    margin-bottom: 16px;
}

.charset-item:last-child {
    margin-bottom: 0;
}

.charset-item h4 {
    color: var(--accent-light);
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

.charset-item code {
    display: block;
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 6px;
    font-family: var(--font-family-mono);
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-primary);
    margin: 8px 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.charset-item p {
    color: var(--text-secondary);
    font-size: 13px;
    margin: 8px 0 0 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .hmac-sha-container {
        flex-direction: column;
        height: auto;
    }
    
    .hmac-sha-input-section {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .resize-handle {
        display: none;
    }
    
    .encryption-options-section {
        padding: 12px;
        margin-top: 8px;
    }
    
    .options-title {
        font-size: 14px;
    }
    
    .encryption-mode-block {
        margin-bottom: 16px;
    }
    
    .mode-select {
        font-size: 12px;
        padding: 8px 10px;
    }
    
    .key-input-block {
        padding: 10px;
    }
    
    .key-input-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .key-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .key-input {
        font-size: 12px;
        padding: 10px;
    }
    
    .result-title {
        font-size: 12px;
        margin-bottom: 6px;
        padding-bottom: 4px;
    }
    
    .hmac-result {
        font-size: 12px;
        padding: 10px;
    }
    
    .stats-section {
        padding: 8px;
        margin-top: 12px;
    }
    
    .stats-title {
        font-size: 12px;
        margin-bottom: 6px;
        padding-bottom: 4px;
    }
    
    .result-stats {
        flex-direction: column;
        gap: 8px;
    }
    
    .stat-item {
        justify-content: space-between;
        flex: none;
    }
    
    #algorithmSelect {
        min-width: 150px;
        margin-right: 4px;
    }
    
    .format-value {
        font-size: 12px;
        padding: 10px;
    }
    
    .copy-btn {
        position: static;
        margin-top: 8px;
        width: 100%;
        text-align: center;
    }
}


/* 高对比度模式适配 */
@media (prefers-contrast: high) {
    .result-viewer {
        border: 2px solid var(--border-color);
    }
    
    .hmac-result {
        border-width: 2px;
    }
    
    .hmac-sha-error {
        border-width: 2px;
    }
    
    .benefit-item {
        border: 2px solid var(--border-color);
    }
    
    .key-input {
        border-width: 2px;
    }
    
    .format-value {
        border-width: 2px;
    }
}

/* 减少动画模式适配 */
@media (prefers-reduced-motion: reduce) {
    .result-fade-in,
    .processing-spinner {
        animation: none;
    }
}
