/* ============================================================
   DOME Herbal Dictionary - Frontend Styles
   ============================================================ */

/* ---------- RESET & VARIABLES ---------- */
.dome-herbal {
    --dome-primary: #064e3b;
    --dome-primary-light: #059669;
    --dome-primary-50: #ecfdf5;
    --dome-primary-100: #d1fae5;
    --dome-bg: #f1f5f9;
    --dome-surface: #ffffff;
    --dome-text: #1e293b;
    --dome-text-muted: #94a3b8;
    --dome-border: #e2e8f0;
    --dome-border-light: #f1f5f9;
    --dome-radius: 0.75rem;
    --dome-radius-lg: 1rem;
    --dome-radius-xl: 1.5rem;
    --dome-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --dome-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --dome-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --dome-font: 'Arial', 'Helvetica Neue', Helvetica, sans-serif !important;
    font-family: var(--dome-font) !important;
    color: var(--dome-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.dome-herbal *,
.dome-herbal *::before,
.dome-herbal *::after,
.dome-herbal h1,
.dome-herbal h2,
.dome-herbal h3,
.dome-herbal h4,
.dome-herbal h5,
.dome-herbal h6,
.dome-herbal p,
.dome-herbal span,
.dome-herbal a {
    font-family: var(--dome-font);
}

.dome-herbal[data-columns="3"] {
    --dome-cols: 3;
}

.dome-herbal[data-columns="4"] {
    --dome-cols: 4;
}

.dome-herbal[data-columns="5"] {
    --dome-cols: 5;
}

.dome-herbal[data-columns="6"] {
    --dome-cols: 6;
}

.dome-herbal[data-columns="7"] {
    --dome-cols: 7;
}

.dome-herbal[data-columns="8"] {
    --dome-cols: 8;
}

.dome-herbal *,
.dome-herbal *::before,
.dome-herbal *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ---------- HERO SEARCH ---------- */
.dome-hero-search {
    background: linear-gradient(135deg, var(--dome-primary), #065f46);
    padding: 4rem 2rem;
    border-radius: var(--dome-radius-xl);
    text-align: center;
    margin-bottom: 2rem;
    color: #fff;
    box-shadow: 0 10px 25px -5px rgba(2, 44, 34, 0.2);
}

.dome-hero-title {
    font-size: 2.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
    color: #fff;
    font-family: var(--dome-font);
}

.dome-hero-subtitle {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 2.5rem;
    color: #d1fae5;
    text-align: center !important;
}

@media (max-width: 768px) {
    .dome-hero-search {
        padding: 2.5rem 1rem;
    }

    .dome-hero-title {
        font-size: 1.5rem;
    }

    .dome-hero-subtitle {
        font-size: 0.875rem;
        margin-bottom: 1.5rem;
    }
}

.dome-herbal .dome-search-wrap {
    display: flex !important;
    align-items: stretch !important;
    width: 100% !important;
    max-width: 1024px;
    /* Will be overridden by inline settings CSS */
    margin: 0 auto !important;
    padding: 0 !important;
    gap: 0 !important;
    border-radius: 999px !important;
    overflow: hidden !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
    border: 2px solid rgba(255, 255, 255, 0.25) !important;
    background: #fff !important;
    height: 3.5rem !important;
    position: relative !important;
}

.dome-herbal .dome-search-wrap .dome-search-input,
.dome-herbal .dome-search-wrap input[type="text"].dome-search-input,
.dome-herbal input#dome-search-input {
    flex: 1 !important;
    padding: 0 1.75rem !important;
    border: none !important;
    border-radius: 0 !important;
    font-size: 1.0625rem !important;
    font-family: Arial, sans-serif !important;
    background: #fff !important;
    color: #1e293b !important;
    outline: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    height: 100% !important;
    line-height: normal !important;
    max-width: none !important;
    width: auto !important;
    float: none !important;
    display: block !important;
}

.dome-herbal .dome-search-wrap .dome-search-input:focus,
.dome-herbal input#dome-search-input:focus {
    box-shadow: none !important;
    outline: none !important;
    border: none !important;
}

.dome-herbal .dome-search-wrap .dome-search-btn,
.dome-herbal button#dome-search-btn {
    padding: 0 2.25rem !important;
    border: none !important;
    border-radius: 0 !important;
    background: var(--dome-primary-light) !important;
    color: #fff !important;
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    font-family: Arial, sans-serif !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    margin: 0 !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    height: 100% !important;
    line-height: normal !important;
    float: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s !important;
}

.dome-herbal .dome-search-wrap .dome-search-btn:hover,
.dome-herbal button#dome-search-btn:hover {
    background: var(--dome-primary) !important;
}

/* ---------- ALPHABET NAV ---------- */
.dome-alphabet-nav {
    position: sticky;
    top: 2rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 0.75rem;
    border-radius: 999px;
    margin: -1rem auto 3rem;
    max-width: fit-content;
    z-index: 100;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--dome-border-light);
}

.dome-alphabet-inner {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.dome-alphabet-inner::-webkit-scrollbar {
    display: none;
}

.dome-alpha-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--dome-text);
    text-decoration: none;
    transition: all 0.2s;
}

.dome-alpha-link:hover {
    background: var(--dome-primary-50);
    color: var(--dome-primary-light);
}

.active-alpha-link {
    background: var(--dome-primary-light) !important;
    color: #fff !important;
}

/* ---------- DICTIONARY BODY ---------- */
.dome-alphabet-group {
    margin-bottom: 4rem;
    scroll-margin-top: 6rem;
}

.dome-group-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--dome-primary-light);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--dome-primary-100);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dome-group-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--dome-border-light);
}

/* ---------- GRID ---------- */
.dome-grid {
    display: grid;
    grid-template-columns: repeat(var(--dome-cols, 5), 1fr);
    gap: 1.5rem;
}

@media (max-width: 1200px) {
    .dome-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .dome-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 640px) {
    .dome-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

/* ---------- CARD ---------- */
.dome-card-item {
    background: var(--dome-surface);
    border-radius: var(--dome-radius-lg);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    border: 1px solid var(--dome-border-light);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.dome-card-item:hover {
    border-color: var(--dome-primary-light);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(-8px);
}

.dome-card-img {
    aspect-ratio: 1/1;
    height: auto;
    background: var(--dome-bg);
    overflow: hidden;
    position: relative;
}

.dome-card-img-bg {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.5s ease;
}

.dome-card-item:hover .dome-card-img-bg {
    transform: scale(1.15);
}

.dome-card-noimg {
    display: flex;
    height: 100%;
    align-items: center;
    justify-content: center;
    color: var(--dome-text-muted);
    opacity: 0.3;
}

.dome-card-noimg svg {
    width: 3rem;
    height: 3rem;
}

.dome-card-body {
    padding: 1.25rem;
    flex: 1;
    border-top: 1px solid var(--dome-border-light);
    background: #fff;
}

.dome-card-name {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--dome-text);
    line-height: 1.3;
    margin: 0 0 0.25rem;
    font-family: var(--dome-font);
    word-wrap: break-word;
}

.dome-card-han {
    display: block;
    font-size: 0.875rem;
    color: var(--dome-primary-light);
    font-weight: 500;
    margin-top: 0.125rem;
    opacity: 0.8;
}

.dome-card-latin {
    font-size: 0.8125rem;
    color: var(--dome-text-muted);
    font-style: italic;
    margin: 0.5rem 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    word-wrap: break-word;
}

/* ---------- MODAL OVERLAY ---------- */
.dome-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
}

/* Fix WP Media Uploader z-index conflict */
.media-modal { z-index: 1000100 !important; }
.media-modal-backdrop { z-index: 1000050 !important; }

.dome-modal {
    width: 100%;
    max-width: 64rem;
    margin: auto;
}

.dome-modal-inner {
    background: var(--dome-surface);
    border-radius: var(--dome-radius-xl);
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: domeZoomIn 0.5s ease;
}

@keyframes domeZoomIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ---------- DETAIL LAYOUT ---------- */
.dome-detail {
    display: flex;
    max-height: 92vh;
}

@media (max-width: 768px) {
    .dome-detail {
        flex-direction: column;
        max-height: none;
    }
}

/* ---------- SIDEBAR ---------- */
.dome-detail-sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--dome-bg);
    border-right: 1px solid var(--dome-border-light);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .dome-detail-sidebar {
        width: 100%;
        min-width: auto;
    }
}

.dome-detail-image-wrap {
    height: 14rem;
    position: relative;
    background: #cbd5e1;
    overflow: hidden;
}

.dome-detail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dome-detail-noimg {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.1;
}

.dome-detail-noimg svg {
    width: 2.5rem;
    height: 2.5rem;
}

.dome-edit-image-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 23, 42, 0.75);
    color: #fff;
    border: none;
    border-radius: var(--dome-radius);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
    z-index: 10;
}

.dome-detail-image-wrap:hover .dome-edit-image-btn {
    opacity: 1;
}

.dome-edit-image-btn:hover {
    background: var(--dome-primary);
    transform: translate(-50%, -50%) scale(1.05);
}

.dome-detail-image-actions {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    display: flex;
    gap: 0.5rem;
}

.dome-img-action {
    background: rgba(255, 255, 255, 0.9);
    padding: 0.375rem;
    border-radius: 0.5rem;
    box-shadow: var(--dome-shadow-sm);
    color: var(--dome-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.2s;
}

.dome-img-action:hover {
    background: #fff;
}

.dome-detail-sidebar-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.dome-detail-sidebar-body::-webkit-scrollbar {
    width: 3px;
}

.dome-detail-sidebar-body::-webkit-scrollbar-track {
    background: transparent;
}

.dome-detail-sidebar-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* ---------- IDENTITY ---------- */
.dome-identity-block {
    position: relative;
    margin-bottom: 1.5rem;
    padding-right: 1.5rem;
}

.dome-detail-name-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.dome-detail-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dome-text);
    line-height: 1.3;
    margin: 0;
}

.dome-detail-han {
    font-size: 1.125rem;
    font-family: serif;
    color: #cbd5e1;
}

.dome-detail-latin {
    font-size: 0.6875rem;
    color: var(--dome-primary-light);
    font-style: italic;
    font-weight: 500;
    margin: 0;
}

/* ---------- SIDEBAR FIELDS ---------- */
.dome-sidebar-field {
    background: var(--dome-surface);
    padding: 0.75rem;
    border-radius: var(--dome-radius-lg);
    border: 1px solid var(--dome-border-light);
    box-shadow: var(--dome-shadow-sm);
    position: relative;
    margin-bottom: 0.75rem;
    transition: all 0.2s;
}

.dome-sidebar-field-dark {
    background: var(--dome-primary);
    color: #fff;
    border-color: transparent;
}

.dome-sidebar-field-label {
    font-size: 0.5rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--dome-text-muted);
    margin-bottom: 0.25rem;
}

.dome-sidebar-field-dark .dome-sidebar-field-label {
    color: rgba(167, 243, 208, 0.6);
}

.dome-sidebar-field-value {
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    text-align: justify;
}

.dome-sidebar-field-value b,
.dome-sidebar-field-value strong {
    font-weight: 700;
    color: inherit;
}

/* ---------- EDIT ICON ---------- */
.dome-edit-icon {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--dome-primary-light);
    opacity: 0;
    transition: opacity 0.2s;
    padding: 0.25rem;
    display: flex;
    border-radius: 0.25rem;
}

.dome-identity-block:hover .dome-edit-icon,
.dome-identity-block:hover .dome-edit-identity,
.dome-sidebar-field:hover .dome-edit-icon,
.dome-section:hover > .dome-section-header .dome-edit-icon,
.dome-section:hover .dome-section-actions,
.dome-summary-item:hover .dome-summary-actions,
.dome-safety-item:hover .dome-edit-icon {
    opacity: 1 !important;
}

.dome-sidebar-field-dark .dome-edit-icon {
    color: #a7f3d0;
    background: rgba(0, 0, 0, 0.2);
}

.dome-edit-icon:hover {
    background: var(--dome-primary-50);
}

/* ---------- MAIN CONTENT ---------- */
.dome-detail-main {
    flex: 1;
    overflow-y: auto;
    background: var(--dome-surface);
    padding: 1.5rem;
    position: relative;
}

@media (max-width: 768px) {
    .dome-detail-main {
        padding: 1rem;
    }
}

.dome-detail-main::-webkit-scrollbar {
    width: 3px;
}

.dome-detail-main::-webkit-scrollbar-track {
    background: transparent;
}

.dome-detail-main::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.dome-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--dome-bg);
    border: none;
    cursor: pointer;
    color: var(--dome-text-muted);
    padding: 0.5rem;
    border-radius: 50%;
    z-index: 20;
    transition: all 0.3s;
    display: flex;
}

.dome-modal-close:hover {
    background: var(--dome-border);
    transform: rotate(90deg);
}

.dome-modal-back {
    position: absolute;
    top: 1rem;
    right: 3.25rem;
    background: var(--dome-primary-50);
    border: 1px solid var(--dome-primary-100);
    cursor: pointer;
    color: var(--dome-primary);
    font-weight: 600;
    font-size: 0.8125rem;
    padding: 0.375rem 0.875rem;
    border-radius: 999px;
    z-index: 20;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.dome-modal-back:hover {
    background: var(--dome-primary-100);
    transform: translateX(-3px);
}

/* ---------- SECTIONS ---------- */
.dome-detail-sections {
    width: 100%;
    margin: 0 auto;
}

.dome-section {
    margin-bottom: 2.5rem;
    position: relative;
}

.dome-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.dome-section-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: var(--dome-primary-50);
    border-radius: var(--dome-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dome-primary-light);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.dome-section-icon .dashicons {
    font-size: 1.25rem;
    width: 1.25rem;
    height: 1.25rem;
}

.dome-icon-danger {
    background: #fef2f2;
    color: #dc2626;
}

.dome-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--dome-text);
    border-bottom: 2px solid var(--dome-border-light);
    padding-bottom: 0.25rem;
    flex: 1;
    margin: 0;
    letter-spacing: -0.01em;
}

.dome-section-content {
    font-size: 0.9375rem;
    line-height: 1.8;
    color: #475569;
    text-align: justify;
    padding: 0.5rem;
}

.dome-section-content b,
.dome-section-content strong {
    font-weight: 700;
    color: inherit;
}

.dome-section-content h4 {
    background: var(--dome-primary-50);
    border-left: 4px solid var(--dome-primary-light);
    padding: 0.5rem 1rem;
    margin: 1.5rem 0 0.75rem 0;
    border-radius: 0 0.5rem 0.5rem 0;
    color: var(--dome-primary);
    font-size: 1rem;
    font-weight: 700;
}

/* Table styling for AI generated content */
.dome-section-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9375rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-radius: var(--dome-radius-md);
    overflow: hidden;
    background: white;
    table-layout: auto;
}

.dome-section-content th,
.dome-section-content td {
    border: 1px solid var(--dome-border-light);
    padding: 0.875rem 1rem;
    text-align: left;
    vertical-align: top;
    line-height: 1.6;
}

/* Ensure data doesn't get squished unnecessarily */
.dome-section-content td {
    min-width: 120px;
}

.dome-section-content th {
    background-color: var(--dome-primary);
    color: white;
    font-weight: 600;
    white-space: nowrap;
    padding: 1rem;
}

/* Let the first column (STT) be small */
.dome-section-content td:first-child,
.dome-section-content th:first-child {
    min-width: 50px;
    width: 1%;
    white-space: nowrap;
    text-align: center;
}

.dome-section-content tr:nth-child(even) {
    background-color: #f8fafc;
}

/* Let the table grow and stretch to container */
.dome-section-content table {
    width: 100%;
    table-layout: auto;
}

@media (max-width: 767px) {

    .dome-section-content th,
    .dome-section-content td {
        padding: 0.5rem;
    }
}

/* Section variants */
.dome-section-story .dome-section-content {
    padding: 1.5rem;
    background: rgba(251, 191, 36, 0.05);
    border-left: 4px solid #f59e0b;
    border-radius: 0 var(--dome-radius-lg) var(--dome-radius-lg) 0;
    font-style: italic;
}

.dome-section-boxed .dome-section-content {
    padding: 2rem;
    background: var(--dome-bg);
    border-radius: var(--dome-radius-xl);
    border: 1px solid var(--dome-border-light);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

/* ---------- USAGE ALERTS ---------- */
.dome-section-wiki .dome-wiki-content {
    font-size: 0.875rem;
    line-height: 1.9;
    color: #475569;
    white-space: pre-wrap;
    background: #f8fafc;
    padding: 2rem;
    border-radius: var(--dome-radius-xl);
    border: 1px solid var(--dome-border-light);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
    text-align: justify;
}

/* ---------- CROSS-LINK ---------- */
.dome-herb-link {
    color: var(--dome-primary-light);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: #a7f3d0;
    cursor: pointer;
    transition: all 0.2s;
}

.dome-herb-link:hover {
    color: var(--dome-primary);
    text-decoration-color: var(--dome-primary);
}

/* ---------- INLINE EDITOR ---------- */
.dome-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    background: var(--dome-bg);
    border-bottom: 1px solid var(--dome-border);
    position: sticky;
    top: 0;
    z-index: 30;
    border-radius: var(--dome-radius-lg) var(--dome-radius-lg) 0 0;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.05);
}

/* ---------- FIND & REPLACE PANEL ---------- */
.dome-find-replace-panel {
    background: #f8fafc;
    border-bottom: 1px solid var(--dome-border);
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.dome-fr-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.dome-fr-find, .dome-fr-replace {
    flex: 1;
    padding: 0.3rem 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.25rem;
    font-size: 0.8125rem;
    font-family: var(--dome-font);
    outline: none;
    transition: border-color 0.2s;
    min-width: 0;
}

.dome-fr-find:focus, .dome-fr-replace:focus {
    border-color: var(--dome-primary);
    box-shadow: 0 0 0 2px rgba(var(--dome-primary-rgb, 59, 130, 246), 0.15);
}

.dome-fr-count {
    font-size: 0.6875rem;
    color: #94a3b8;
    min-width: 2.5rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.dome-fr-btn {
    padding: 0.2rem 0.5rem;
    border: 1px solid #cbd5e1;
    background: #fff;
    cursor: pointer;
    border-radius: 0.25rem;
    font-size: 0.6875rem;
    color: var(--dome-text);
    transition: all 0.15s;
    white-space: nowrap;
    font-family: var(--dome-font);
}

.dome-fr-btn:hover {
    background: var(--dome-surface);
    border-color: var(--dome-primary);
    color: var(--dome-primary);
}

.dome-fr-prev, .dome-fr-next {
    padding: 0.2rem 0.35rem;
    font-size: 0.625rem;
    line-height: 1;
}

.dome-fr-one {
    background: var(--dome-primary);
    color: #fff;
    border-color: var(--dome-primary);
}

.dome-fr-one:hover {
    opacity: 0.9;
    color: #fff;
}

.dome-fr-all {
    background: #f97316;
    color: #fff;
    border-color: #f97316;
}

.dome-fr-all:hover {
    opacity: 0.9;
    color: #fff;
}

.dome-fr-options {
    font-size: 0.75rem;
    color: #64748b;
}

.dome-fr-options label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}

.dome-fr-options input[type="checkbox"] {
    margin: 0;
}

/* Find & Replace highlights */
mark.dome-fr-highlight {
    background: #fef08a;
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}

mark.dome-fr-highlight.dome-fr-active {
    background: #f97316;
    color: #fff;
}

.dome-tb-find-replace {
    gap: 0.2rem;
}

.dome-tb-find-replace svg {
    pointer-events: none;
}

.dome-tb-btn {
    padding: 0.25rem 0.375rem;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    color: var(--dome-text);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    font-family: var(--dome-font);
}

.dome-tb-btn:hover {
    background: var(--dome-surface);
    border-color: var(--dome-border);
}

.dome-tb-sep {
    width: 1px;
    height: 1rem;
    background: #cbd5e1;
    margin: 0 0.25rem;
}

.dome-formula-val {
    flex: 1;
    color: #475569;
    font-size: 0.875rem;
}

.dome-formula-ingredient-list {
    margin: 0 !important;
    padding-left: 1.25rem !important;
    list-style-type: disc !important;
}

.dome-formula-ingredient-list li {
    margin-bottom: 0.25rem;
    color: #475569;
}

.dome-formula-ingredient-list li:last-child {
    margin-bottom: 0;
}

.dome-tb-spacer {
    flex: 1;
}

.dome-tb-cancel {
    font-size: 0.5625rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--dome-text-muted);
}

.dome-tb-save {
    font-size: 0.5625rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--dome-primary-light);
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    box-shadow: var(--dome-shadow-sm);
}

.dome-tb-save:hover {
    background: var(--dome-primary);
}

.dome-tb-html {
    font-family: monospace;
    font-weight: 700;
}

.dome-tb-html.active {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.dome-editor-wrap {
    border: 1px solid var(--dome-primary-light);
    border-radius: var(--dome-radius-lg);
    overflow: hidden;
    box-shadow: var(--dome-shadow-lg);
    background: var(--dome-surface);
    animation: domeZoomIn 0.2s ease;
}

.dome-editor-content {
    padding: 1rem;
    outline: none;
    font-size: 0.9375rem;
    line-height: 1.8;
    min-height: 6rem;
    text-align: justify;
}

.dome-editor-html {
    width: 100%;
    min-height: 8rem;
    padding: 1rem;
    font-size: 0.8125rem;
    font-family: 'Consolas', 'Monaco', monospace;
    border: none;
    outline: none;
    resize: vertical;
    background: #0f172a;
    color: #34d399;
}

/* ---------- FADE ANIMATION ---------- */
.dome-fade-in {
    animation: domeFadeIn 0.3s ease;
}

@keyframes domeFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- HIDDEN CARDS ---------- */
.dome-card-item.dome-hidden {
    display: none;
}

/* ---------- INLINE EDITOR IN SIDEBAR ---------- */
.dome-sidebar-editor {
    margin-top: 0.5rem;
}

.dome-sidebar-editor .dome-editor-content {
    font-size: 0.875rem;
    min-height: 4rem;
    padding: 0.5rem;
}

/* ---------- IDENTITY EDITOR ---------- */
.dome-identity-editor {
    border: 1px solid var(--dome-primary-light);
    border-radius: var(--dome-radius-lg);
    overflow: hidden;
    box-shadow: var(--dome-shadow-lg);
    background: var(--dome-surface);
    animation: domeZoomIn 0.2s ease;
}

.dome-identity-editor-fields {
    padding: 0.5rem;
}

.dome-identity-editor-field {
    border-bottom: 1px solid var(--dome-border-light);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

.dome-identity-editor-field:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.dome-identity-editor-label {
    display: block;
    font-size: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--dome-text-muted);
    margin-bottom: 0.125rem;
}

.dome-identity-editor-input {
    width: 100%;
    border: none;
    outline: none;
    font-family: var(--dome-font);
    padding: 0.25rem 0;
}

.dome-identity-editor-input.dome-input-name {
    font-size: 0.875rem;
    font-weight: 700;
}

.dome-identity-editor-input.dome-input-latin {
    font-size: 0.6875rem;
    font-style: italic;
    color: var(--dome-primary-light);
}

.dome-identity-editor-input.dome-input-han {
    font-size: 1rem;
    font-family: serif;
    color: var(--dome-text-muted);
}

/* ---------- FOOTER CREDIT ---------- */
.dome-footer-credit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.5rem 1rem;
    margin-top: 2rem;
    font-size: 0.8125rem;
    color: var(--dome-text-muted);
    border-top: 1px solid var(--dome-border-light);
    flex-wrap: wrap;
}

.dome-footer-text {
    opacity: 0.8;
}

.dome-donate-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 1rem;
    border: 1px solid var(--dome-primary-light);
    background: transparent;
    color: var(--dome-primary-light);
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: Arial, sans-serif !important;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s;
}

.dome-donate-btn:hover {
    background: var(--dome-primary-light);
    color: #fff;
}

/* ---------- DONATE POPUP ---------- */
.dome-donate-popup {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.dome-donate-popup-inner {
    background: #fff;
    border-radius: var(--dome-radius-xl);
    padding: 2.5rem;
    max-width: 24rem;
    width: 100%;
    text-align: center;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: domeZoomIn 0.3s ease;
}

.dome-donate-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: var(--dome-bg);
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--dome-text-muted);
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.dome-donate-close:hover {
    background: var(--dome-border);
    color: var(--dome-text);
}

.dome-donate-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dome-text);
    margin: 0 0 1.25rem;
    font-family: var(--dome-font);
}

.dome-donate-qr-img {
    max-width: 200px;
    border-radius: var(--dome-radius-lg);
    border: 1px solid var(--dome-border);
    margin-bottom: 1rem;
}

.dome-donate-info {
    font-size: 0.875rem;
    color: #475569;
    line-height: 1.7;
    margin: 0;
}

/* SERVER-SIDE ANTI-SCRAPING VIA CSS */
body.dome-anti-copy-enabled,
body.dome-anti-copy-enabled .dome-herbal {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

body.dome-anti-copy-enabled input,
body.dome-anti-copy-enabled textarea,
body.dome-anti-copy-enabled .dome-herbal input,
body.dome-anti-copy-enabled .dome-herbal textarea {
    -webkit-user-select: auto !important;
    -moz-user-select: auto !important;
    -ms-user-select: auto !important;
    user-select: auto !important;
}

/* ---------- AI REGENERATE BUTTON ---------- */
.dome-ai-regenerate-btn {
    opacity: 0;
    transition: opacity 0.2s, background 0.2s, color 0.2s, transform 0.2s;
}

.dome-section:hover .dome-ai-regenerate-btn,
.dome-sidebar-field:hover .dome-ai-regenerate-btn,
.dome-summary-item:hover .dome-ai-regenerate-btn,
.dome-identity-block:hover .dome-ai-regenerate-btn {
    opacity: 1;
}

.dome-section-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
    margin-left: auto;
    flex-shrink: 0;
}

.dome-sidebar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s;
    margin-top: 4px;
}

.dome-section:hover .dome-section-actions,
.dome-sidebar-field:hover .dome-sidebar-actions {
    opacity: 1 !important;
}

/* Common styling for both action buttons */
.dome-ai-regenerate-btn, .dome-edit-icon {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 28px;
    padding: 0 10px;
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,0.1);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--dome-font, -apple-system, sans-serif);
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: all 0.2s;
    position: relative !important;
    top: auto !important;
    right: auto !important;
}

.dome-ai-regenerate-btn svg, .dome-edit-icon svg {
    width: 12px !important;
    height: 12px !important;
    display: block;
    flex-shrink: 0;
}

/* AI Regenerate Button - Green Theme */
.dome-ai-regenerate-btn {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    color: #059669;
    border-color: #a7f3d0;
}

.dome-ai-regenerate-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    color: #fff;
    border-color: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(5, 150, 105, 0.25);
}

/* Edit Button - Gray/Blue Theme */
.dome-edit-icon {
    background: #fff;
    color: #64748b;
    border-color: #e2e8f0;
}

.dome-edit-icon:hover {
    background: #f1f5f9;
    color: #3b82f6;
    border-color: #93c5fd;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.15);
}

/* Sidebar compact variant */
.dome-sidebar-actions .dome-ai-regenerate-btn,
.dome-sidebar-actions .dome-edit-icon {
    height: 24px;
    padding: 0 8px;
    font-size: 10px;
    border-radius: 12px;
}

.dome-sidebar-actions .dome-ai-regenerate-btn svg,
.dome-sidebar-actions .dome-edit-icon svg {
    width: 10px !important;
    height: 10px !important;
}

.dome-summary-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}

.dome-summary-item:hover .dome-summary-actions {
    opacity: 1 !important;
}

