/* ==========================================================================
   ADMIN DIAGNOSTIK STYLES
   ========================================================================== */

/* Quill editor custom height */
.ql-container {
    min-height: 150px;
    font-size: 14px;
}

.ql-editor {
    min-height: 150px;
}

/* Force KaTeX formulas to be inline */
.ql-editor .ql-formula,
#questionPreview .ql-formula,
.ql-snow .ql-editor .ql-formula {
    display: inline-block !important;
    vertical-align: middle !important;
    margin: 0 2px !important;
    white-space: nowrap !important;
}

/* Ensure katex output is inline */
.katex,
.katex-html {
    display: inline !important;
}

/* Prevent line breaks around formulas */
.ql-editor span.ql-formula::before,
.ql-editor span.ql-formula::after {
    content: none !important;
}

/* Preview area styles */
#questionPreview {
    min-height: 100px;
}

/* 3-Column Bulk Modal Styles */
.bulk-modal-container {
    display: flex;
    height: calc(100vh - 120px);
    overflow: hidden;
}

.bulk-sidebar {
    width: 320px;
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.bulk-center {
    flex: 1;
    background: white;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border-right: 1px solid #e2e8f0;
}

.bulk-right {
    width: 320px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

.bulk-side-item {
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid transparent;
}

.bulk-side-item:hover {
    background: #f1f5f9;
}

.bulk-side-item.active {
    background: #f0fdf4;
    border-left-color: #10b981;
    color: #059669;
}

.bulk-side-item.has-error {
    border-left-color: #ef4444;
}

.bulk-error-indicator {
    width: 8px;
    height: 8px;
    background-color: #ef4444;
    border-radius: 50%;
    display: inline-block;
    margin-left: 4px;
}

.is-invalid {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
}

.error-message {
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    font-weight: 600;
}

.bulk-center-alert {
    margin: 1rem;
    padding: 1rem;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.compact-quill-toolbar .ql-toolbar {
    padding: 4px !important;
}

.compact-quill-toolbar .ql-formats {
    margin-right: 8px !important;
}

/* ── Mobile Responsive Quill Toolbar Optimization ── */
@media (max-width: 767px) {
    .ql-toolbar.ql-snow {
        padding: 4px 6px !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 2px !important;
        background: #f8fafc !important;
    }

    .ql-toolbar.ql-snow .ql-formats {
        margin-right: 4px !important;
        margin-bottom: 2px !important;
        display: flex !important;
        align-items: center !important;
        gap: 1px !important;
    }

    /* Standard Toolbar Buttons */
    .ql-toolbar.ql-snow button {
        width: 24px !important;
        height: 24px !important;
        padding: 3px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .ql-toolbar.ql-snow button svg {
        width: 14px !important;
        height: 14px !important;
    }

    /* Pickers (Font, Size, Header) */
    .ql-toolbar.ql-snow .ql-picker {
        height: 24px !important;
        font-size: 11px !important;
    }

    .ql-toolbar.ql-snow .ql-picker-label {
        padding-left: 4px !important;
        padding-right: 14px !important;
        display: flex !important;
        align-items: center !important;
    }

    /* Specific Widths for Pickers */
    .ql-toolbar.ql-snow .ql-font {
        width: 100px !important;
    }

    .ql-toolbar.ql-snow .ql-size {
        width: 65px !important;
    }

    /* Ensure pickers don't overflow */
    .ql-toolbar.ql-snow .ql-picker-options {
        font-size: 12px !important;
    }
}

.auto-height-quill .ql-container {
    min-height: 100px;
    height: auto;
}

.bulk-editor-detached {
    display: none;
}

/* Modern Diagnostik Unified Segmented Tabs */
.diagnostik-unified-tab-bar {
    max-width: 100%;
}

.diagnostik-unified-tab-bar .tab-button {
    white-space: nowrap;
}

.tab-button.active {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}

/* ── Dark Mode: Bulk Create Modal (Diagnostik) ── */
.dark .bulk-sidebar {
    background: #0f172a !important;
    border-right-color: #1e293b !important;
}

.dark .bulk-center {
    background: #1e293b !important;
    border-right-color: #1e293b !important;
}

.dark .bulk-right {
    background: #0f172a !important;
}

.dark .bulk-side-item {
    border-bottom-color: #1e293b !important;
    color: #94a3b8 !important;
}

.dark .bulk-side-item:hover {
    background: #1e293b !important;
}

.dark .bulk-side-item.active {
    background: rgba(6, 78, 59, 0.4) !important;
    border-left-color: #10b981 !important;
    color: #10b981 !important;
}

.dark .bulk-center-header, 
.dark .bulk-right-header {
    background: #1e293b !important;
    border-bottom-color: #334155 !important;
    color: #f1f5f9 !important;
}

.dark .ql-toolbar.ql-snow {
    background-color: #334155 !important;
    border-color: #475569 !important;
}

.dark .ql-container.ql-snow {
    background-color: #1e293b !important;
    border-color: #475569 !important;
    color: #f1f5f9 !important;
}

.dark .ql-editor {
    color: #f1f5f9 !important;
}

.dark .ql-editor.ql-blank::before {
    color: #64748b !important;
}

.dark .ql-stroke {
    stroke: #f1f5f9 !important;
}

.dark .ql-fill {
    fill: #f1f5f9 !important;
}

.dark .ql-picker {
    color: #f1f5f9 !important;
}

.dark .ql-picker-options {
    background-color: #334155 !important;
    border-color: #475569 !important;
    color: #f1f5f9 !important;
}

.dark .ql-snow.ql-toolbar button .ql-stroke,
.dark .ql-snow.ql-toolbar button .ql-stroke * {
    stroke: #f1f5f9 !important;
}

.dark .ql-snow.ql-toolbar button .ql-fill,
.dark .ql-snow.ql-toolbar button .ql-fill * {
    fill: #f1f5f9 !important;
}

/* Explicit Equation/Formula Icon fix */
.dark .ql-snow.ql-toolbar button.ql-formula svg * {
    stroke: #f1f5f9 !important;
}

.dark .ql-snow.ql-toolbar .ql-picker {
    color: #f1f5f9 !important;
}

.dark .ql-snow.ql-toolbar .ql-picker :hover .ql-stroke {
    stroke: #10b981 !important;
}

.dark .ql-snow.ql-toolbar .ql-picker-options {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

/* Quill Tooltip (Formula, Link, etc.) */
.dark .ql-snow .ql-tooltip {
    background-color: #334155 !important;
    border-color: #475569 !important;
    color: #f1f5f9 !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5) !important;
    border-radius: 8px !important;
}

.dark .ql-snow .ql-tooltip input[type=text] {
    background-color: #1e293b !important;
    border-color: #475569 !important;
    color: #f1f5f9 !important;
    border-radius: 6px !important;
    padding: 4px 8px !important;
}

.dark .ql-snow .ql-tooltip::before {
    content: "Masukkan Rumus:" !important;
    color: #cbd5e1 !important;
    margin-right: 8px !important;
    font-size: 13px !important;
}

.dark .ql-snow .ql-tooltip[data-mode=link]::before {
    content: "Masukkan Link:" !important;
}

.dark .ql-snow .ql-tooltip a.ql-action::after {
    content: "Simpan" !important;
    color: #10b981 !important;
    font-weight: 700 !important;
    margin-left: 10px !important;
}

.dark .ql-snow .ql-tooltip a.ql-preview {
    color: #10b981 !important;
}

.dark .bg-gray-50, 
.dark .bg-emerald-50 {
    background-color: #1e293b !important;
    color: #cbd5e1 !important;
}

.dark .text-gray-800, 
.dark .text-gray-700, 
.dark .text-gray-600 {
    color: #cbd5e1 !important;
}

.dark .border-gray-200, 
.dark .border-gray-300 {
    border-color: #334155 !important;
}

/* ===== Mobile Responsive: bulkCreateModal ===== */
#bulkMobileTabs {
    display: none;
}

@media (max-width: 767px) {
    #bulkCreateModal .bulk-modal-header-title {
        font-size: 0.85rem !important;
    }
    #bulkCreateModal #bulkStats {
        display: none !important;
    }
    #bulkCreateModal .bulk-header-divider {
        display: none !important;
    }

    .bulk-modal-container {
        flex-direction: column;
        height: calc(100vh - 110px);
        overflow: hidden;
        position: relative;
    }

    .bulk-sidebar,
    .bulk-center,
    .bulk-right {
        width: 100% !important;
        flex-shrink: 0;
        border-right: none !important;
        border-left: none !important;
        border-bottom: 1px solid #e2e8f0;
        display: none;
    }

    .bulk-sidebar.mobile-active,
    .bulk-center.mobile-active,
    .bulk-right.mobile-active {
        display: flex;
        flex: 1;
        overflow-y: auto;
    }

    #bulkMobileTabs {
        display: flex;
        border-top: 1px solid #e2e8f0;
        background: #fff;
        flex-shrink: 0;
    }

    .dark #bulkMobileTabs {
        border-top-color: #1e293b !important;
        background-color: #0f172a !important;
    }

    #bulkMobileTabs button {
        flex: 1;
        padding: 10px 4px;
        font-size: 0.7rem;
        font-weight: 700;
        color: #64748b;
        border: none;
        background: transparent;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        transition: background 0.15s;
    }

    #bulkMobileTabs button.active {
        color: #10b981;
        background: #f0fdf4;
    }

    .dark #bulkMobileTabs button.active {
        background-color: rgba(6, 78, 59, 0.4) !important;
        color: #10b981 !important;
    }

    #bulkMobileTabs button i {
        font-size: 1rem;
    }
}

/* Premium Tooltip System */
[data-tooltip-pt] {
    position: relative;
    cursor: pointer;
}
[data-tooltip-pt]:before {
    content: attr(data-tooltip-pt);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    padding: 6px 12px;
    background: rgba(15, 23, 42, 0.95);
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: none;
}
[data-tooltip-pt]:after {
    content: '';
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: rgba(15, 23, 42, 0.95) transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    pointer-events: none;
}
[data-tooltip-pt]:hover:before, 
[data-tooltip-pt]:hover:after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 640px) {
    [data-tooltip-pt]:before, [data-tooltip-pt]:after { display: none !important; }
}

/* Bottom Tooltip Variant */
[data-tooltip-pt-bottom] {
    position: relative;
    cursor: pointer;
}
[data-tooltip-pt-bottom]:before {
    content: attr(data-tooltip-pt-bottom);
    position: absolute;
    top: 125%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    padding: 6px 12px;
    background: rgba(15, 23, 42, 0.95);
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: none;
}
[data-tooltip-pt-bottom]:after {
    content: '';
    position: absolute;
    top: 110%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    border-width: 0 6px 6px 6px;
    border-style: solid;
    border-color: transparent transparent rgba(15, 23, 42, 0.95) transparent;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    pointer-events: none;
}
[data-tooltip-pt-bottom]:hover:before, 
[data-tooltip-pt-bottom]:hover:after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}
@media (max-width: 640px) {
    [data-tooltip-pt-bottom]:before, [data-tooltip-pt-bottom]:after { display: none !important; }
}

/* ===== DIAGNOSTIK DYNAMIC BACKGROUND & GLASSMORPHISM ===== */
body {
    background: linear-gradient(135deg, #f8fafc 0%, #e0f2fe 25%, #f0fdf4 50%, #e0f2fe 75%, #f8fafc 100%) !important;
    background-size: 400% 400% !important;
    animation: dashGradient 18s ease infinite !important;
}
html.dark body {
    background: linear-gradient(135deg, #020617 0%, #0f172a 25%, #1e1b4b 50%, #0f172a 75%, #020617 100%) !important;
}
@keyframes dashGradient {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.dash-wrapper {
    background: transparent !important;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    z-index: 1;
}
.dash-wrapper::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image: radial-gradient(rgba(99, 102, 241, 0.07) 1.5px, transparent 1.5px);
    background-size: 24px 24px;
}
html.dark .dash-wrapper::after {
    background-image: radial-gradient(rgba(139, 92, 246, 0.08) 1.5px, transparent 1.5px);
}
html.dark .dash-wrapper::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: 
        radial-gradient(circle at 10% 20%, rgba(99,102,241,0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(16,185,129,0.06) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(139,92,246,0.04) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}
.dash-panel {
    background: rgba(255, 255, 255, 0.35) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.50) !important;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}
html.dark .dash-panel {
    background: rgba(30, 41, 59, 0.45) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}
.dash-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image: radial-gradient(rgba(99, 102, 241, 0.06) 1.5px, transparent 1.5px);
    background-size: 18px 18px;
    border-radius: inherit;
}
html.dark .dash-panel::before {
    background-image: radial-gradient(rgba(139, 92, 246, 0.07) 1.5px, transparent 1.5px);
}
.card-bg-icon {
    position: absolute;
    right: -0.75rem;
    bottom: -0.75rem;
    opacity: 0.12;
    pointer-events: none;
    z-index: 0;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
html.dark .card-bg-icon {
    opacity: 0.04;
}
.group:hover .card-bg-icon {
    transform: scale(1.15) rotate(-5deg);
}

/* Mobile Responsive Compact Optimizations */
@media (max-width: 640px) {
    .dash-wrapper {
        padding-top: 0.5rem !important;
        padding-bottom: 1.5rem !important;
    }
    .card-bg-icon {
        opacity: 0.05 !important;
        transform: scale(0.65) !important;
        right: -1.25rem !important;
        bottom: -1.25rem !important;
    }
    .tab-button {
        padding: 0.5rem 0.25rem !important;
        font-size: 0.75rem !important;
    }
    .tab-button i {
        font-size: 1rem !important;
    }
}

