/**
 * Chironex Studio Editor - Zengin Metin Düzenleyici CSS
 * %100 Vanilla & Tailwind Uyumlu Tasarım
 */

/* Ana Kapsayıcı */
.cx-editor-container {
    display: flex;
    flex-direction: column;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    background-color: #ffffff;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.dark .cx-editor-container {
    border-color: #334155;
    background-color: #0f172a;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2);
}

.cx-editor-container:focus-within {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Tam Ekran (Zen Mode) */
.cx-editor-container.cx-fullscreen {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    z-index: 99999 !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

.cx-editor-container.cx-fullscreen .cx-editor-content,
.cx-editor-container.cx-fullscreen .cx-editor-source {
    flex: 1 1 auto;
    height: calc(100vh - 90px) !important;
    max-height: none !important;
}

/* Araç Çubuğu (Toolbar) */
.cx-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.625rem;
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 20;
    user-select: none;
}

.dark .cx-editor-toolbar {
    background-color: #1e293b;
    border-color: #334155;
}

/* Toolbar Ayırıcı */
.cx-tb-separator {
    width: 1px;
    height: 1.25rem;
    background-color: #cbd5e1;
    margin: 0 0.25rem;
}

.dark .cx-tb-separator {
    background-color: #475569;
}

/* Toolbar Butonları */
.cx-tb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.875rem;
    height: 1.875rem;
    padding: 0 0.375rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.dark .cx-tb-btn {
    color: #94a3b8;
}

.cx-tb-btn:hover {
    background-color: #e2e8f0;
    color: #0f172a;
}

.dark .cx-tb-btn:hover {
    background-color: #334155;
    color: #f8fafc;
}

.cx-tb-btn.active {
    background-color: #6366f1 !important;
    color: #ffffff !important;
    box-shadow: 0 1px 2px rgba(99, 102, 241, 0.2);
}

.cx-tb-btn i {
    font-size: 0.8125rem;
}

/* Dropdown Grupları */
.cx-tb-group {
    position: relative;
    display: inline-flex;
}

.cx-tb-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.25rem;
    min-width: 10rem;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    padding: 0.375rem;
    display: none;
    flex-direction: column;
    z-index: 50;
}

.dark .cx-tb-dropdown-menu {
    background-color: #1e293b;
    border-color: #334155;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.cx-tb-group.open .cx-tb-dropdown-menu {
    display: flex;
}

.cx-tb-dd-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.375rem 0.625rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #334155;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s;
}

.dark .cx-tb-dd-item {
    color: #cbd5e1;
}

.cx-tb-dd-item:hover {
    background-color: #f1f5f9;
    color: #6366f1;
}

.dark .cx-tb-dd-item:hover {
    background-color: #334155;
    color: #818cf8;
}

/* Renk Seçici Paleti */
.cx-color-palette {
    display: grid;
    grid-template-columns: repeat(6, 1.375rem);
    gap: 0.375rem;
    padding: 0.375rem;
}

.cx-color-swatch {
    width: 1.375rem;
    height: 1.375rem;
    border-radius: 0.375rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.15s;
}

.cx-color-swatch:hover {
    transform: scale(1.15);
}

/* İçerik Düzenleme Alanı */
.cx-editor-content {
    min-height: 20rem;
    max-height: 42rem;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    color: #1e293b;
    background-color: #ffffff;
    outline: none;
    font-size: 0.875rem;
    line-height: 1.7;
}

.dark .cx-editor-content {
    color: #e2e8f0;
    background-color: #0f172a;
}

/* Editör İçi Tipografi */
.cx-editor-content h1 { font-size: 1.875rem; font-weight: 800; margin: 1.25rem 0 0.75rem; line-height: 1.25; }
.cx-editor-content h2 { font-size: 1.5rem; font-weight: 700; margin: 1.125rem 0 0.625rem; line-height: 1.3; }
.cx-editor-content h3 { font-size: 1.25rem; font-weight: 700; margin: 1rem 0 0.5rem; line-height: 1.35; }
.cx-editor-content h4 { font-size: 1.125rem; font-weight: 600; margin: 0.875rem 0 0.5rem; }
.cx-editor-content p { margin: 0.625rem 0; }
.cx-editor-content ul { list-style-type: disc; padding-left: 1.5rem; margin: 0.625rem 0; }
.cx-editor-content ol { list-style-type: decimal; padding-left: 1.5rem; margin: 0.625rem 0; }
.cx-editor-content li { margin: 0.25rem 0; }

.cx-editor-content blockquote {
    border-left: 4px solid #6366f1;
    padding: 0.5rem 1rem;
    margin: 1rem 0;
    font-style: italic;
    background-color: #f8fafc;
    border-radius: 0 0.75rem 0.75rem 0;
    color: #475569;
}

.dark .cx-editor-content blockquote {
    background-color: #1e293b;
    color: #94a3b8;
}

.cx-editor-content pre {
    background-color: #0f172a;
    color: #f8fafc;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    overflow-x: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8125rem;
    margin: 1rem 0;
    border: 1px solid #334155;
}

.cx-editor-content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background-color: #f1f5f9;
    color: #6366f1;
    padding: 0.125rem 0.375rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
}

.dark .cx-editor-content code {
    background-color: #1e293b;
    color: #a5b4fc;
}

.cx-editor-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

.cx-editor-content hr {
    border: 0;
    border-top: 1px solid #e2e8f0;
    margin: 1.5rem 0;
}

.dark .cx-editor-content hr {
    border-color: #334155;
}

.cx-editor-content a {
    color: #6366f1;
    text-decoration: underline;
    font-weight: 500;
}

.cx-editor-content a:hover {
    color: #4f46e5;
}

/* Editör İçi Tablolar */
.cx-editor-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    border-radius: 0.75rem;
    overflow: hidden;
    font-size: 0.8125rem;
}

.cx-editor-content th,
.cx-editor-content td {
    border: 1px solid #e2e8f0;
    padding: 0.625rem 0.875rem;
    text-align: left;
}

.dark .cx-editor-content th,
.dark .cx-editor-content td {
    border-color: #334155;
}

.cx-editor-content th {
    background-color: #f8fafc;
    font-weight: 700;
}

.dark .cx-editor-content th {
    background-color: #1e293b;
}

/* Editör İçi Görseller ve Videolar */
.cx-editor-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.75rem;
    margin: 1rem auto;
    display: block;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.cx-editor-content video,
.cx-editor-content iframe {
    max-width: 100%;
    border-radius: 0.75rem;
    margin: 1rem auto;
    display: block;
}

/* Resim / Medya Yerleşim Sınıfları */
.cx-editor-content img.cx-align-left,
.cx-editor-content .cx-media-left {
    float: left;
    margin: 0.5rem 1rem 0.5rem 0;
}

.cx-editor-content img.cx-align-right,
.cx-editor-content .cx-media-right {
    float: right;
    margin: 0.5rem 0 0.5rem 1rem;
}

.cx-editor-content img.cx-align-center,
.cx-editor-content .cx-media-center {
    display: block;
    margin: 1rem auto;
}

/* HTML Kaynak Kodu Alanı */
.cx-editor-source {
    width: 100%;
    min-height: 20rem;
    padding: 1.25rem 1.5rem;
    background-color: #090d16;
    color: #38bdf8;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    border: none;
    outline: none;
    resize: vertical;
    display: none;
    box-sizing: border-box;
}

/* Alt Çubuk (Footer / İstatistikler) */
.cx-editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem 0.75rem;
    background-color: #f8fafc;
    border-top: 1px solid #e2e8f0;
    font-size: 0.6875rem;
    color: #64748b;
    user-select: none;
}

.dark .cx-editor-footer {
    background-color: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

.cx-editor-footer .cx-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 600;
    color: #6366f1;
}

/* Modal Pencereleri (Link, Görsel, Video, Tablo) */
.cx-modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: cxFadeIn 0.2s ease-out;
}

.cx-modal-card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 1.25rem;
    max-width: 32rem;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: cxScaleIn 0.2s ease-out;
}

.dark .cx-modal-card {
    background-color: #0f172a;
    border-color: #334155;
}

.cx-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    background-color: #f8fafc;
}

.dark .cx-modal-header {
    border-color: #334155;
    background-color: #1e293b;
}

.cx-modal-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dark .cx-modal-title {
    color: #ffffff;
}

.cx-modal-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cx-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    background-color: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.dark .cx-modal-footer {
    background-color: #1e293b;
    border-color: #334155;
}

/* Sürükle Bırak Yükleme Alanı */
.cx-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 1rem;
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    background-color: #f8fafc;
    transition: all 0.2s;
}

.dark .cx-dropzone {
    border-color: #475569;
    background-color: #1e293b/50;
}

.cx-dropzone.dragover,
.cx-dropzone:hover {
    border-color: #6366f1;
    background-color: rgba(99, 102, 241, 0.05);
}

@keyframes cxFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes cxScaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
