/* ========================================================
   VOICE OF ANATOLIA - ADVANCED WYSIWYG RICH TEXT & HTML EDITOR
   Professional Multi-Tool Editor with Live Formatting & Emojis
   ======================================================== */

.rich-editor-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-top: 6px;
    margin-bottom: 12px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.25s ease;
    border: 1.5px solid #d4af37;
    background: #ffffff;
}

.rich-editor-wrapper:focus-within {
    box-shadow: 0 6px 25px rgba(212, 175, 55, 0.25);
    border-color: #b8972f;
}

/* Fullscreen Mode */
.rich-editor-wrapper.rich-fullscreen {
    position: fixed !important;
    inset: 0 !important;
    z-index: 999999 !important;
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
}

.rich-editor-wrapper.rich-fullscreen .rich-contenteditable-area,
.rich-editor-wrapper.rich-fullscreen .rich-source-textarea {
    height: calc(100vh - 120px) !important;
    max-height: none !important;
}

/* TOOLBAR CONTAINER */
.rich-editor-toolbar {
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
    user-select: none;
    z-index: 10;
}

.rich-toolbar-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    flex-wrap: wrap;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.rich-toolbar-row:last-child {
    border-bottom: none;
}

/* TOOLBAR BUTTONS */
.rich-tool-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #e2e8f0;
    min-width: 30px;
    height: 30px;
    padding: 0 6px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.rich-tool-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    color: #f3c64f;
    border-color: rgba(212, 175, 55, 0.4);
    transform: translateY(-1px);
}

.rich-tool-btn.active {
    background: #d4af37;
    color: #0f172a;
    font-weight: 800;
    border-color: #d4af37;
}

/* DROPDOWN SELECTS IN TOOLBAR */
.rich-tool-select {
    background: #1e293b;
    color: #f8fafc;
    border: 1px solid rgba(212, 175, 55, 0.35);
    height: 30px;
    border-radius: 6px;
    padding: 0 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.rich-tool-select:hover,
.rich-tool-select:focus {
    border-color: #d4af37;
    background: #0f172a;
}

/* SEPARATOR */
.rich-tool-sep {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0 4px;
}

/* COLOR PICKER TRIGGER */
.rich-color-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.rich-color-btn input[type="color"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    left: 0;
    top: 0;
}

/* EMOJI TRIGGER BUTTON */
.rich-emoji-trigger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(212, 175, 55, 0.18);
    border: 1px solid rgba(212, 175, 55, 0.45);
    color: #f3c64f;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: auto;
}

.rich-emoji-trigger:hover {
    background: #d4af37;
    color: #000;
    transform: scale(1.04);
}

/* WYSIWYG CONTENTEDITABLE AREA */
.rich-contenteditable-area {
    width: 100%;
    min-height: 240px;
    max-height: 550px;
    overflow-y: auto;
    padding: 18px 20px;
    outline: none;
    background: #ffffff;
    color: #0f172a;
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.95rem;
    line-height: 1.65;
    box-sizing: border-box;
    cursor: text;
}

.rich-contenteditable-area[contenteditable="true"]:empty:before {
    content: attr(data-placeholder);
    color: #94a3b8;
    font-style: italic;
    cursor: text;
    pointer-events: none;
}

/* Typography Inside Content Area */
.rich-contenteditable-area h1 {
    font-size: 1.85rem;
    font-weight: 800;
    color: #0f172a;
    margin: 1rem 0 0.5rem 0;
    line-height: 1.25;
}

.rich-contenteditable-area h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0.85rem 0 0.45rem 0;
    line-height: 1.3;
}

.rich-contenteditable-area h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0.75rem 0 0.4rem 0;
}

.rich-contenteditable-area h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0.65rem 0 0.35rem 0;
}

.rich-contenteditable-area p {
    margin: 0.5rem 0;
}

.rich-contenteditable-area blockquote {
    border-left: 4px solid #d4af37;
    background: rgba(212, 175, 55, 0.08);
    padding: 10px 16px;
    margin: 12px 0;
    border-radius: 0 8px 8px 0;
    color: #334155;
    font-style: italic;
}

.rich-contenteditable-area pre {
    background: #0f172a;
    color: #f8fafc;
    padding: 12px 16px;
    border-radius: 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.88rem;
    overflow-x: auto;
    margin: 12px 0;
}

.rich-contenteditable-area table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
}

.rich-contenteditable-area table th,
.rich-contenteditable-area table td {
    border: 1px solid #cbd5e1;
    padding: 8px 12px;
    text-align: left;
}

.rich-contenteditable-area table th {
    background: #f1f5f9;
    font-weight: 700;
    color: #0f172a;
}

.rich-contenteditable-area table tr:hover td {
    background: #f8fafc;
}

.rich-contenteditable-area img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 10px 0;
    display: inline-block;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.rich-contenteditable-area hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #d4af37 50%, transparent 100%);
    margin: 20px 0;
}

.rich-contenteditable-area a {
    color: #2563eb;
    text-decoration: underline;
    font-weight: 600;
}

.rich-contenteditable-area a:hover {
    color: #1d4ed8;
}

/* RAW HTML SOURCE TEXTAREA (WHEN CODE VIEW ACTIVE) */
.rich-source-textarea {
    width: 100%;
    min-height: 240px;
    max-height: 550px;
    padding: 16px 18px;
    outline: none;
    background: #0f172a !important;
    color: #38bdf8 !important;
    font-family: 'Consolas', 'Fira Code', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    border: none;
    box-sizing: border-box;
    display: none;
    resize: vertical;
}

/* STATUS FOOTER BAR */
.rich-editor-statusbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 14px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    font-size: 0.75rem;
    color: #64748b;
    user-select: none;
}

.rich-statusbar-tags {
    display: flex;
    gap: 6px;
    align-items: center;
}

.rich-statusbar-counts {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* FLOATING POPOVER DIALOG (LINK, IMAGE, TABLE, EMOJI) */
.rich-floating-dialog {
    position: absolute;
    background: #0f172a;
    border: 1px solid #d4af37;
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7), 0 0 15px rgba(212, 175, 55, 0.25);
    z-index: 9999;
    padding: 16px;
    display: none;
    animation: dialogPop 0.2s ease-out;
    width: 340px;
}

@keyframes dialogPop {
    from { opacity: 0; transform: translateY(-8px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.rich-floating-dialog h4 {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    color: #f3c64f;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.rich-dialog-form-group {
    margin-bottom: 10px;
}

.rich-dialog-form-group label {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 4px;
    font-weight: 600;
}

.rich-dialog-input {
    width: 100%;
    height: 36px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 0 10px;
    color: #fff;
    font-size: 0.85rem;
    box-sizing: border-box;
    outline: none;
}

.rich-dialog-input:focus {
    border-color: #d4af37;
    background: #0f172a;
}

.rich-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.rich-dialog-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
}

.rich-dialog-btn.cancel {
    background: #334155;
    color: #cbd5e1;
}

.rich-dialog-btn.confirm {
    background: #d4af37;
    color: #000;
}

/* EMOJI POPOVER */
.rich-emoji-popover {
    position: absolute;
    top: 42px;
    right: 5px;
    width: 320px;
    background: #0f172a;
    border: 1px solid #d4af37;
    border-radius: 12px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7), 0 0 15px rgba(212, 175, 55, 0.2);
    z-index: 9999;
    padding: 10px;
    display: none;
    animation: dialogPop 0.2s ease-out;
}

.emoji-tabs-bar {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 6px;
    margin-bottom: 8px;
    overflow-x: auto;
}

.emoji-tab-item {
    background: transparent;
    border: none;
    font-size: 1.1rem;
    padding: 4px 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.emoji-tab-item:hover,
.emoji-tab-item.active {
    background: rgba(212, 175, 55, 0.25);
}

.emoji-grid-content {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
    padding: 4px;
}

.emoji-item-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 1.25rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}

.emoji-item-btn:hover {
    background: rgba(212, 175, 55, 0.3);
    transform: scale(1.15);
}

.emoji-footer-hint {
    font-size: 0.72rem;
    color: #94a3b8;
    text-align: center;
    margin-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 6px;
}
