/* =====================================================
   在线图片压缩工具 - online_image_compression.css
   ===================================================== */

/* 容器 */
.oic-container {
    padding: 0 !important;
}

/* ===== Tab 导航 ===== */
.oic-tab-nav {
    display: flex;
    border-bottom: 2px solid #e8eaf6;
    background: #f8f9ff;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.oic-tab-btn {
    padding: 13px 26px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}

.oic-tab-btn:hover {
    color: #1565C0;
    background: rgba(25, 118, 210, 0.06);
}

.oic-tab-btn.active {
    color: #1565C0;
    border-bottom-color: #1565C0;
    font-weight: 600;
}

/* ===== Tab 内容 ===== */
.oic-tab-content {
    display: none;
    padding: 16px;
}

.oic-tab-content.oic-active {
    display: block;
    animation: oic-fadein 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes oic-fadein {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.oic-hidden {
    display: none !important;
}

/* ===== 上传区域 ===== */
#oicFileInput {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.oic-upload-area {
    text-align: center;
    border: 2px dashed #90CAF9;
    border-radius: 12px;
    padding: 46px 24px;
    background: linear-gradient(160deg, #f8fbff 0%, #eef4ff 100%);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.oic-upload-area:hover,
.oic-upload-area.drag-over {
    border-color: #1565C0;
    background: #e3f2fd;
    transform: scale(1.005);
    box-shadow: 0 6px 20px rgba(25, 118, 210, 0.12);
}

.oic-upload-icon {
    font-size: 54px;
    margin-bottom: 10px;
    line-height: 1;
}

.oic-upload-text {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.oic-upload-hint {
    font-size: 13px;
    color: #8a9bb0;
    margin-bottom: 16px;
}

.oic-upload-paste-hint {
    font-size: 12px;
    color: #a0b0c8;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* ===== 工作区 ===== */
.oic-workspace {
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: oic-fadein 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== 工具栏 ===== */
.oic-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f5f7fa 0%, #eef2fa 100%);
    border-radius: 8px;
    border: 1px solid #e0e6f0;
}

.oic-toolbar .button,
.oic-toolbar .secondary,
.oic-toolbar .third {
    padding: 5px 12px;
    font-size: 12px;
}

.oic-btn-active {
    background: #1565C0 !important;
    color: #fff !important;
    border-color: #1565C0 !important;
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.25) !important;
}

.oic-shortcut-hint {
    font-size: 11px;
    color: #aab;
    margin-left: 6px;
    white-space: nowrap;
}

/* ===== 统计栏 ===== */
.oic-stats-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #f0f5ff 0%, #e8f0fb 100%);
    border-radius: 10px;
    border: 1px solid #ccd8f0;
    border-left: 3px solid #5688d9;
    flex-wrap: wrap;
}

.oic-stats-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 130px;
}

.oic-stats-label {
    font-size: 11px;
    color: #8a9bb0;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.oic-stats-size {
    font-size: 17px;
    font-weight: 700;
    color: #1a2a4a;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.oic-stats-dim {
    font-size: 11px;
    color: #7a8fa8;
    font-variant-numeric: tabular-nums;
}

.oic-stats-arrow {
    font-size: 13px;
    color: #fff;
    flex-shrink: 0;
    font-weight: 700;
    background: linear-gradient(135deg, #5b8fdb, #7aabf0);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(91, 143, 219, 0.28);
    letter-spacing: 0;
}

.oic-savings-wrap {
    margin-left: auto;
}

.oic-savings-badge {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    background: #e8f5e9;
    color: #2e7d32;
    border: 1.5px solid #a5d6a7;
    white-space: nowrap;
    letter-spacing: 0.3px;
    transition: background 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}

.oic-savings-badge.oic-savings-warn {
    background: #fff3e0;
    color: #e65100;
    border-color: #ffcc80;
}

/* ===== 主体布局 ===== */
.oic-main {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.oic-preview-pane {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.oic-controls-pane {
    width: 290px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ===== Canvas 预览 ===== */
.oic-canvas-wrap {
    border-radius: 10px;
    overflow: hidden;
    text-align: center;
    line-height: 0;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.10);
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e6f0;
    /* 棋盘格背景（PNG透明区域标识） */
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #e8ecf3 25%, transparent 25%),
        linear-gradient(-45deg, #e8ecf3 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e8ecf3 75%),
        linear-gradient(-45deg, transparent 75%, #e8ecf3 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

#oicCanvas {
    max-width: 100%;
    display: block;
    margin: 0 auto;
}

.oic-preview-hint {
    font-size: 11px;
    color: #8a9bb0;
    text-align: center;
    padding: 4px 0 0;
    letter-spacing: 0.3px;
}

/* ===== 控制面板 section ===== */
.oic-section {
    border: 1px solid #e4e8f0;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.oic-section-title {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8edf8 100%);
    padding: 7px 10px 7px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #3a4a6b;
    border-bottom: 1px solid #dde3f0;
    border-left: 3px solid #5688d9;
    letter-spacing: 0.2px;
}

.oic-section-body {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ===== 控制行 ===== */
.oic-ctrl-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.oic-ctrl-label {
    font-size: 12px;
    color: #5a6a80;
    font-weight: 500;
    white-space: nowrap;
    width: 54px;
    flex-shrink: 0;
}

/* ===== 滑块 ===== */
.oic-slider-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.oic-slider {
    flex: 1;
    height: 4px;
    cursor: pointer;
    accent-color: #1976D2;
}

/* ===== 禁用态：质量滑块（PNG格式时自动禁用） ===== */
.oic-ctrl-row-disabled {
    opacity: 0.4;
    pointer-events: none;
}

.oic-slider:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.oic-slider-val {
    font-size: 11px;
    color: #1565C0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    background: #e8f0fe;
    border-radius: 8px;
    padding: 1px 6px;
    min-width: 36px;
    text-align: center;
    white-space: nowrap;
}

/* ===== 下拉框 ===== */
.oic-select {
    flex: 1;
    padding: 5px 8px;
    border: 1.5px solid #d0d8e8;
    border-radius: 6px;
    font-size: 12px;
    color: #3a4a6b;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s;
    min-width: 0;
}

.oic-select:focus {
    outline: none;
    border-color: #1976D2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
}

/* ===== 控制备注 ===== */
.oic-ctrl-note {
    font-size: 11px;
    color: #7a8fa8;
    line-height: 1.5;
    padding: 4px 7px;
    background: #f0f5ff;
    border-radius: 5px;
    border-left: 3px solid #5688d9;
}

/* ===== 尺寸调整 ===== */
.oic-resize-modes {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.oic-radio-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #4a5568;
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
}

.oic-radio-label input[type="radio"] {
    accent-color: #1976D2;
    cursor: pointer;
}

.oic-resize-section {
    padding-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    animation: oic-fadein 0.2s ease;
}

/* ===== 数字输入组 ===== */
.oic-input-group {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.oic-num-input {
    flex: 1;
    padding: 5px 8px;
    border: 1.5px solid #d0d8e8;
    border-radius: 6px;
    font-size: 12px;
    color: #3a4a6b;
    max-width: 90px;
    transition: border-color 0.2s;
}

.oic-num-input:focus {
    outline: none;
    border-color: #1976D2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
}

.oic-input-unit {
    font-size: 11px;
    color: #8a9bb0;
    font-weight: 500;
}

/* ===== 快捷预设网格 ===== */
.oic-presets-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

.oic-preset-btn {
    padding: 6px 6px;
    font-size: 11px;
    border: 1px solid #c5d0e8;
    background: linear-gradient(135deg, #f8faff 0%, #f2f6ff 100%);
    border-radius: 7px;
    cursor: pointer;
    color: #4a5568;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.oic-preset-btn:hover {
    border-color: #1976D2;
    color: #1565C0;
    background: #e8f0ff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.15);
}

/* ===== AI Tab ===== */
.oic-ai-intro {
    background: linear-gradient(135deg, #e8f0ff 0%, #f0f5ff 100%);
    border: 1px solid #c5d8f8;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    color: #3a4a6b;
    margin-bottom: 10px;
    line-height: 1.6;
}

.oic-ai-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.oic-form-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.oic-form-row label {
    font-size: 13px;
    color: #4a5568;
    font-weight: 600;
}

.oic-required {
    color: #e53935;
}

.oic-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #d0d8e8;
    border-radius: 8px;
    font-size: 13px;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1.5;
}

.oic-textarea:focus {
    outline: none;
    border-color: #1976D2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.12);
}

.oic-form-actions {
    display: flex;
    gap: 8px;
}

.oic-quick-scenes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    align-items: center;
    padding: 10px 12px;
    background: #f8f9ff;
    border-radius: 8px;
    border: 1px solid #e4e8f5;
}

.oic-quick-label {
    font-size: 12px;
    color: #8a9bb0;
    font-weight: 500;
    flex-basis: 100%;
    margin-bottom: 2px;
}

.oic-quick-btn {
    padding: 4px 12px;
    font-size: 12px;
    border: 1px solid #c5d0e8;
    background: #fff;
    border-radius: 14px;
    cursor: pointer;
    color: #4a5568;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}

.oic-quick-btn:hover {
    border-color: #1976D2;
    color: #1565C0;
    background: #e8f0ff;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(25, 118, 210, 0.15);
}

/* ===== AI 加载中 ===== */
.oic-ai-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    color: #5a6a80;
    font-size: 13px;
    background: #f8f9ff;
    border-radius: 8px;
    margin-top: 12px;
    border: 1px solid #e4e8f5;
}

.oic-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #c5d0e8;
    border-top-color: #1976D2;
    border-radius: 50%;
    animation: oic-spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes oic-spin {
    to { transform: rotate(360deg); }
}

/* ===== AI 推荐结果 ===== */
.oic-ai-result {
    border: 1px solid #c5d8f8;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 14px;
    box-shadow: 0 2px 10px rgba(25, 118, 210, 0.08);
}

.oic-ai-result-title {
    background: linear-gradient(135deg, #ddeaff 0%, #e8f0ff 100%);
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    color: #1565C0;
    border-bottom: 1px solid #c5d8f8;
    letter-spacing: 0.2px;
}

.oic-ai-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.oic-ai-item {
    padding: 10px 14px;
    border-right: 1px solid #eef2fb;
    border-bottom: 1px solid #eef2fb;
}

.oic-ai-item:nth-child(even) {
    border-right: none;
}

.oic-ai-item:nth-last-child(-n+2) {
    border-bottom: none;
}

.oic-ai-key {
    font-size: 11px;
    color: #8a9bb0;
    margin-bottom: 3px;
    font-weight: 500;
}

.oic-ai-val {
    font-size: 13px;
    color: #2c3e50;
    font-weight: 600;
}

.oic-ai-reason {
    padding: 10px 14px;
    border-top: 1px solid #eef2fb;
    font-size: 12px;
    color: #5a6a80;
    line-height: 1.6;
    background: #fafcff;
}

.oic-ai-apply {
    padding: 10px 14px;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid #eef2fb;
    background: #f8faff;
}

.oic-raw-wrap {
    padding: 6px 14px 10px;
    border-top: 1px solid #eef2fb;
    background: #fafbff;
}

.oic-raw-toggle-btn {
    background: none;
    border: none;
    color: #8a9bb0;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 0;
    transition: color 0.2s;
}

.oic-raw-toggle-btn:hover {
    color: #1976D2;
}

.oic-ai-raw {
    background: #f0f2f8;
    padding: 10px 12px;
    font-size: 11px;
    color: #5a6a80;
    white-space: pre-wrap;
    margin: 6px 0 0;
    border: 1px solid #dde3f0;
    border-radius: 6px;
    max-height: 140px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace;
}

/* ===== Toast 通知 ===== */
.oic-toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    color: #fff;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 320px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    font-weight: 500;
    letter-spacing: 0.2px;
}

.oic-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.oic-toast.success { background: linear-gradient(135deg, #2e7d32, #43a047); }
.oic-toast.warning { background: linear-gradient(135deg, #e65100, #fb8c00); }
.oic-toast.error   { background: linear-gradient(135deg, #c62828, #e53935); }
.oic-toast.info    { background: linear-gradient(135deg, #0277bd, #039be5); }

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
    .oic-controls-pane { width: 260px; }
}

@media (max-width: 768px) {
    .oic-main { flex-direction: column; }
    .oic-controls-pane { width: 100%; }
    .oic-stats-bar { flex-wrap: wrap; gap: 8px; }
    .oic-savings-wrap { margin-left: 0; width: 100%; text-align: center; }
    .oic-savings-badge { display: inline-block; }
}

@media (max-width: 640px) {
    .oic-tab-content { padding: 14px; }
    .oic-upload-area { padding: 40px 16px; }
    .oic-upload-icon { font-size: 48px; }
    .oic-upload-text { font-size: 15px; }
    .oic-presets-grid { grid-template-columns: 1fr 1fr 1fr; }
    .oic-toolbar { padding: 8px 10px; }
    .oic-ai-grid { grid-template-columns: 1fr; }
    .oic-toast { bottom: 14px; right: 12px; left: 12px; max-width: unset; }
    .oic-shortcut-hint { display: none; }
    .oic-stats-size { font-size: 16px; }
}
