/* ═══════════════════════════════════════════════
   RichTextEditor — 富文本編輯器樣式
   ═══════════════════════════════════════════════ */

.rte-container {
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid #4a4a5a;
    border-radius: 6px;
    background: #1e1e2f;
}

/* ─── Toolbar ─── */
.rte-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 4px 6px;
    background: #252538;
    border-bottom: 1px solid #4a4a5a;
    border-radius: 6px 6px 0 0;
    align-items: center;
}
.rte-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #ccc;
    padding: 3px 7px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    line-height: 1.3;
    white-space: nowrap;
    transition: all 0.15s;
}
.rte-btn:hover { background: rgba(106,158,255,0.2); border-color: rgba(106,158,255,0.3); color: #fff; }
.rte-btn:active { background: rgba(106,158,255,0.35); }
.rte-btn.rte-btn-active { background: rgba(106,158,255,0.3); border-color: #6a9eff; color: #6a9eff; }
.rte-separator {
    display: inline-block; width: 1px; height: 18px;
    background: #4a4a5a; margin: 0 3px; flex-shrink: 0;
}

/* ─── Editable ─── */
.rte-editable {
    min-height: 80px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px 12px;
    color: #e8e8e8;
    font-size: 14px;
    line-height: 1.6;
    outline: none;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.rte-editable:empty::before {
    content: attr(data-placeholder);
    color: #666;
    pointer-events: none;
}
.rte-editable a { color: #6a9eff; text-decoration: underline; cursor: pointer; }
.rte-editable code { background: rgba(255,255,255,0.1); padding: 0 4px; border-radius: 3px; font-family: monospace; }
.rte-editable .rte-inline-img { height: 1.2em; vertical-align: middle; }
.rte-editable .rte-tooltip { border-bottom: 1px dashed #6adfff; cursor: help; }
.rte-editable ruby rt { font-size: 0.55em; color: #aaa; }

/* ─── Popup (掛在 body 上) ─── */
.rte-popup {
    position: fixed;
    z-index: 10000;
    background: #2a2a3e;
    border: 1px solid #5a5a6a;
    border-radius: 6px;
    padding: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    min-width: 200px;
    max-width: 360px;
}

/* ─── Dropdown ─── */
.rte-dropdown {
    display: flex;
    flex-direction: column;
    max-height: 250px;
    overflow-y: auto;
}
.rte-dropdown-item {
    padding: 5px 12px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 13px;
    color: #ddd;
    white-space: nowrap;
}
.rte-dropdown-item:hover { background: rgba(106,158,255,0.25); }

/* ─── Color Picker ─── */
.rte-color-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 3px;
    margin-bottom: 10px;
}
.rte-color-swatch {
    width: 22px; height: 22px;
    border-radius: 3px;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.15);
    transition: transform 0.1s;
}
.rte-color-swatch:hover { transform: scale(1.25); border-color: #fff; }
.rte-color-custom {
    display: flex;
    gap: 8px;
    align-items: center;
}
.rte-color-preview {
    flex-shrink: 0;
}

/* ─── Slider ─── */
.rte-slider-panel {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
}
.rte-range {
    flex: 1;
    min-width: 120px;
    accent-color: #6a9eff;
}
.rte-range-val {
    font-size: 12px;
    color: #aaa;
    min-width: 50px;
    text-align: right;
}

/* ─── Panel Grid (shadow/glow/stroke/gradient) ─── */
.rte-panel-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.rte-panel-grid label {
    font-size: 11px;
    color: #aaa;
    display: flex;
    align-items: center;
    gap: 4px;
}
.rte-num {
    width: 50px; padding: 3px 5px;
    background: #1a1a2a; border: 1px solid #4a4a5a;
    color: #ddd; border-radius: 3px; font-size: 12px;
}
.rte-panel-grid select {
    padding: 3px 5px;
    background: #1a1a2a; border: 1px solid #4a4a5a;
    color: #ddd; border-radius: 3px; font-size: 12px;
}

.rte-apply-btn {
    background: rgba(76,175,80,0.3) !important;
    border-color: rgba(76,175,80,0.5) !important;
    color: #81c784 !important;
}
.rte-apply-btn:hover { background: rgba(76,175,80,0.5) !important; }
.rte-clear-btn {
    background: rgba(244,67,54,0.2) !important;
    border-color: rgba(244,67,54,0.4) !important;
    color: #e57373 !important;
}

/* ═══════════════════════════════════════════════
   文字動畫效果 rte-fx-*
   ═══════════════════════════════════════════════ */

.rte-fx-shake {
    display: inline-block;
    animation: rteFxShake 0.3s ease-in-out infinite;
}
@keyframes rteFxShake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-2px) rotate(-1deg); }
    75%      { transform: translateX(2px) rotate(1deg); }
}

.rte-fx-wave-container { display: inline; }
.rte-fx-wave {
    display: inline-block;
    animation: rteFxWave 1.2s ease-in-out infinite;
}
@keyframes rteFxWave {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-4px); }
}

.rte-fx-pulse {
    display: inline-block;
    animation: rteFxPulse 1.5s ease-in-out infinite;
}
@keyframes rteFxPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.08); }
}

.rte-fx-blink {
    animation: rteFxBlink 1s ease-in-out infinite;
}
@keyframes rteFxBlink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.2; }
}

.rte-fx-rainbow {
    animation: rteFxRainbow 3s linear infinite;
}
@keyframes rteFxRainbow {
    0%   { color: #ff0000; }
    17%  { color: #ff7f00; }
    33%  { color: #ffff00; }
    50%  { color: #00ff00; }
    67%  { color: #0000ff; }
    83%  { color: #9400d3; }
    100% { color: #ff0000; }
}

.rte-fx-fadein {
    animation: rteFxFadeIn 0.8s ease-out forwards;
}
@keyframes rteFxFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
