/*
 * ============================================================================
 * Redstone NOOB 加密工具专用样式 (crypto-tool.css)
 * ============================================================================
 * 设计原则：
 *   1. 复用主站的液态玻璃效果，保持一致性
 *   2. 按钮和输入框必须有明显的 hover/focus 反馈
 *   3. 操作状态用颜色和动画清晰表达
 * ============================================================================
 */

/* ========== 页面专属：右上角加密模式切换按钮 ========== */
.mode-toggle {
    position: absolute;
    top: 20px;
    right: 24px;
    display: flex;
    gap: 6px;
    background-color: rgba(255, 255, 255, 0.3);
    padding: 4px;
    border-radius: 20px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.mode-toggle button {
    padding: 8px 18px;
    border: none;
    border-radius: 16px;
    background-color: transparent;
    color: #5f6368;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.mode-toggle button:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.5);
    color: #1a73e8;
}

/* 选中状态：蓝色渐变背景 + 白色文字 + 阴影 */
.mode-toggle button.active {
    background: linear-gradient(135deg, #1a73e8, #4285f4);
    color: white;
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.35);
}

/* ========== 主工具区网格布局 ========== */
.tool-workspace {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px;
    display: grid;
    /* 默认：左栏 | 主卡片（右侧聊天栏宽度为0） */
    grid-template-columns: 56px 1fr 0fr;
    grid-template-rows: auto 1fr;
    gap: 12px;
    transition: grid-template-columns 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 进入聊天后展开右侧聊天栏 */
.tool-workspace.has-sidebar {
    grid-template-columns: 56px 1fr 300px;
}

/* ========== S/R 顶部书签栏 ========== */
.sr-tabs {
    grid-column: 2 / 3;
    display: flex;
    gap: 0;
    padding-left: 4px;
    position: relative;
    z-index: 2;
}

/* S/R 书签按钮 */
.sr-tab {
    padding: 10px 32px;
    border: none;
    border-radius: 12px 12px 0 0;
    background-color: rgba(255, 255, 255, 0.15);
    color: #9aa0a6;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    bottom: -1px;
    letter-spacing: 2px;
}

.sr-tab:hover {
    background-color: rgba(255, 255, 255, 0.3);
    color: #5f6368;
}

/* 激活状态：玻璃质感 + 蓝色文字 */
.sr-tab.active {
    background-color: rgba(255, 255, 255, 0.35);
    color: #1a73e8;
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-bottom: none;
    z-index: 3;
}

/* ========== 壹/贰 左侧垂直书签栏 ========== */
.step-tabs {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    padding-top: 24px;
}

/* 圆形步骤按钮 */
.step-tab {
    width: 44px;
    height: 44px;
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    color: #9aa0a6;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-tab:hover {
    background-color: rgba(255, 255, 255, 0.4);
    color: #5f6368;
    transform: scale(1.08);
    border-color: rgba(26, 115, 232, 0.3);
}

/* 激活状态：蓝色渐变 + 白字 + 阴影 */
.step-tab.active {
    background: linear-gradient(135deg, #1a73e8, #4285f4);
    color: white;
    border-color: transparent;
    box-shadow: 0 3px 10px rgba(26, 115, 232, 0.35);
    transform: scale(1.05);
}

.step-label {
    font-size: 0.65rem;
    color: #9aa0a6;
    margin-top: 2px;
    text-align: center;
    font-weight: 500;
    letter-spacing: 1px;
}

/* ========== 主功能卡片 ========== */
.main-card {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
    border-radius: 0 16px 16px 16px;
    overflow: hidden;
    padding: 36px 32px;
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    background-color: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    min-height: 420px;
    transition: box-shadow 0.2s ease;
}

.main-card:hover {
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

/* ========== 步骤内容面板 ========== */
.step-content {
    display: none;
}

.step-content.active {
    display: block;
    animation: fadeSlideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.step-title {
    font-size: 1.35rem;
    font-weight: 500;
    color: #202124;
    margin-bottom: 16px;
    text-align: center;
}

.step-desc {
    color: #5f6368;
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 28px;
    line-height: 1.6;
}

/* ========== 按钮系统 ========== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 32px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #1a73e8, #4285f4);
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.25);
    letter-spacing: 0.5px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(26, 115, 232, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(26, 115, 232, 0.25);
}

.btn-primary:disabled {
    background: linear-gradient(135deg, #dadce0, #e8eaed);
    color: #9aa0a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: 1.5px solid rgba(26, 115, 232, 0.2);
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.5);
    color: #1a73e8;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background-color: rgba(26, 115, 232, 0.08);
    border-color: rgba(26, 115, 232, 0.4);
    transform: translateY(-1px);
}

.btn-secondary:disabled {
    color: #9aa0a6;
    border-color: rgba(0, 0, 0, 0.08);
    cursor: not-allowed;
    transform: none;
}

/* ========== 输入框系统 ========== */
.tool-input,
.tool-textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    font-family: 'Noto Sans SC', Arial, sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    background-color: rgba(255, 255, 255, 0.55);
    color: #202124;
    resize: vertical;
    transition: all 0.2s ease;
    outline: none;
}

.tool-input::placeholder,
.tool-textarea::placeholder {
    color: #9aa0a6;
    font-size: 0.9rem;
}

/* 聚焦状态：蓝色边框 + 光晕 */
.tool-input:focus,
.tool-textarea:focus {
    border-color: #1a73e8;
    background-color: rgba(255, 255, 255, 0.75);
    box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.12);
}

/* 只读状态 */
.tool-input[readonly],
.tool-textarea[readonly] {
    background-color: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.06);
    color: #5f6368;
}

/* ========== 密钥显示框 ========== */
.key-display {
    background-color: rgba(0, 0, 0, 0.04);
    border: 1.5px dashed rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    padding: 16px;
    font-family: 'Courier New', 'SF Mono', monospace;
    font-size: 0.78rem;
    line-height: 1.5;
    word-break: break-all;
    color: #202124;
    margin: 12px 0;
    max-height: 160px;
    overflow-y: auto;
    background-image: linear-gradient(45deg, transparent 49%, rgba(0,0,0,0.02) 50%, transparent 51%);
    background-size: 8px 8px;
}

/* ========== PGP 交换消息区域 ========== */
.pgp-box {
    background: linear-gradient(135deg, rgba(26, 115, 232, 0.04), rgba(66, 133, 244, 0.04));
    border: 2px dashed rgba(26, 115, 232, 0.25);
    border-radius: 12px;
    padding: 28px 20px;
    text-align: center;
    margin: 16px 0;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

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

.pgp-box:hover::before {
    left: 100%;
}

.pgp-box:hover {
    border-color: rgba(26, 115, 232, 0.5);
    background: linear-gradient(135deg, rgba(26, 115, 232, 0.07), rgba(66, 133, 244, 0.07));
    transform: translateY(-1px);
}

.pgp-box .hint {
    color: #1a73e8;
    font-size: 1rem;
    font-weight: 500;
}

.pgp-box .sub-hint {
    color: #5f6368;
    font-size: 0.85rem;
    margin-top: 6px;
}

/* ========== 警告提示 ========== */
.alert-box {
    padding: 16px 20px;
    border-radius: 10px;
    margin: 16px 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

.alert-box.warning {
    background-color: rgba(251, 188, 5, 0.1);
    border: 1.5px solid rgba(251, 188, 5, 0.25);
    color: #b06000;
}

.alert-box.error {
    background-color: rgba(234, 67, 53, 0.08);
    border: 1.5px solid rgba(234, 67, 53, 0.2);
    color: #c5221f;
}

.alert-box.success {
    background-color: rgba(52, 168, 83, 0.08);
    border: 1.5px solid rgba(52, 168, 83, 0.2);
    color: #137333;
}

/* ========== 右侧聊天侧边栏 ========== */
.chat-sidebar {
    grid-column: 3 / 4;
    grid-row: 1 / 3;
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    background-color: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.tool-workspace.has-sidebar .chat-sidebar {
    opacity: 1;
    width: auto;
    overflow: visible;
}

.chat-header {
    padding: 16px 18px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    font-weight: 500;
    color: #202124;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.3);
}

.chat-header .burn-hint {
    font-size: 0.75rem;
    color: #ea4335;
    font-weight: 400;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.85rem;
    line-height: 1.4;
    word-break: break-word;
    animation: msgPopIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes msgPopIn {
    from { opacity: 0; transform: scale(0.9) translateY(4px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.chat-msg.sent {
    align-self: flex-end;
    background: linear-gradient(135deg, #1a73e8, #4285f4);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 6px rgba(26, 115, 232, 0.2);
}

.chat-msg.received {
    align-self: flex-start;
    background-color: rgba(255, 255, 255, 0.6);
    color: #202124;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.chat-input-area {
    padding: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    gap: 8px;
    background-color: rgba(255, 255, 255, 0.2);
}

.chat-input-area input {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid rgba(0, 0, 0, 0.06);
    border-radius: 20px;
    font-family: inherit;
    font-size: 0.85rem;
    background-color: rgba(255, 255, 255, 0.5);
    outline: none;
    transition: all 0.2s ease;
}

.chat-input-area input:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.chat-input-area button {
    padding: 10px 18px;
    border: none;
    border-radius: 20px;
    background: linear-gradient(135deg, #1a73e8, #4285f4);
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-input-area button:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(26, 115, 232, 0.25);
}

/* ========== 强加密双列布局 ========== */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 20px;
}

.two-col .col h4 {
    font-size: 1rem;
    font-weight: 500;
    color: #202124;
    margin-bottom: 12px;
    text-align: center;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .two-col {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .tool-workspace {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr auto;
        padding: 16px;
        gap: 8px;
    }

    .tool-workspace.has-sidebar {
        grid-template-columns: 1fr;
    }

    .sr-tabs {
        grid-column: 1 / 2;
        grid-row: 1 / 2;
        justify-content: center;
        padding-left: 0;
    }

    .step-tabs {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
        flex-direction: row;
        justify-content: center;
        padding-top: 0;
        gap: 24px;
    }

    .main-card {
        grid-column: 1 / 2;
        grid-row: 3 / 4;
        padding: 24px 18px;
        border-radius: 16px;
    }

    .chat-sidebar {
        grid-column: 1 / 2;
        grid-row: 4 / 5;
        height: 280px;
    }

    .mode-toggle {
        position: static;
        margin-top: 8px;
        justify-content: center;
    }
}
