/* ==========================================================================
   Creator.razor.css - Isolated Styles for Zen Mode Creator Workspace
   ========================================================================== */

/* 1. BOUNDARY & SCROLLING RE-ENGINEERING */

/* Strict flexbox layout context eliminating global browser scrollbars */
.creator-fullscreen-wrapper {
    width: 100% !important;
    max-width: 100% !important; /* Likwidujemy sztuczne ograniczenia szerokości */
    margin: 0;
    padding: 1.5rem; /* Elastyczny, bezpieczny margines od krawędzi bocznych menu i ekranu */
    display: flex;
    flex-direction: column;
    height: calc(100vh - 4rem); 
    box-sizing: border-box;
    overflow: hidden;
    gap: 1.25rem;
}

.creator-header {
    flex-shrink: 0;
    padding-left: 0.5rem;
}

.creator-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 0.25rem 0;
}

.creator-header .subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
}

/* 2. Full Viewport Workspace Card stretching smoothly */
.creator-workspace-card {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    flex-grow: 1; 
    width: 100% !important;
    box-sizing: border-box;
    overflow: hidden; 
}

.editor-growing-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 3. Deep Cascading Overrides to target dynamic editor components */

.creator-fullscreen-wrapper ::deep .markdown-editor-container {
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    flex-grow: 1 !important;
    overflow: hidden !important;
}

.creator-fullscreen-wrapper ::deep .milkdown-editor-wrapper {
    display: flex !important;
    flex-direction: column !important;
    flex-grow: 1 !important;
    overflow: hidden !important;
}

/* Force crepe and milkdown inner wrappers to stretch */
.creator-fullscreen-wrapper ::deep .crepe,
.creator-fullscreen-wrapper ::deep .milkdown {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    flex-grow: 1 !important;
    overflow: hidden !important;
    background-color: transparent !important;
    background: transparent !important;
}

/* Pin the toolbar at the top */
.creator-fullscreen-wrapper ::deep .crepe .toolbar,
.creator-fullscreen-wrapper ::deep .milkdown-menu,
.creator-fullscreen-wrapper ::deep .crepe-menu-wrapper {
    flex-shrink: 0 !important;
    background-color: var(--bg-base) !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
    padding: 0.5rem !important;
    margin-bottom: 1rem !important;
}

.creator-fullscreen-wrapper ::deep .crepe .toolbar button:hover,
.creator-fullscreen-wrapper ::deep .milkdown-menu button:hover,
.creator-fullscreen-wrapper ::deep .crepe-menu-wrapper button:hover,
.creator-fullscreen-wrapper ::deep .crepe .toolbar .button:hover,
.creator-fullscreen-wrapper ::deep .milkdown-menu .button:hover {
    color: var(--accent) !important;
    background-color: rgba(16, 185, 129, 0.1) !important;
    border-radius: var(--radius-sm, 4px) !important;
}

/* Relocate scrolling directly to ProseMirror editor layer and fix text clipping */
.creator-fullscreen-wrapper ::deep .ProseMirror,
.creator-fullscreen-wrapper ::deep .crepe .editor,
.creator-fullscreen-wrapper ::deep .milkdown .editor {
    position: relative !important;
    top: 0 !important;
    transform: none !important;
    flex-grow: 1 !important;
    overflow-y: auto !important;
    padding: 1.5rem !important;
    padding-right: 15px !important;
    background-color: var(--bg-surface) !important;
    color: var(--text-main) !important;
    font-size: 1.1rem !important;
    line-height: 1.7 !important;
    outline: none !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Custom narrow scrollbar mapped to var(--border) */
.creator-fullscreen-wrapper ::deep .ProseMirror::-webkit-scrollbar,
.creator-fullscreen-wrapper ::deep .crepe .editor::-webkit-scrollbar,
.creator-fullscreen-wrapper ::deep .milkdown .editor::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.creator-fullscreen-wrapper ::deep .ProseMirror::-webkit-scrollbar-track,
.creator-fullscreen-wrapper ::deep .crepe .editor::-webkit-scrollbar-track,
.creator-fullscreen-wrapper ::deep .milkdown .editor::-webkit-scrollbar-track {
    background: transparent;
}

.creator-fullscreen-wrapper ::deep .ProseMirror::-webkit-scrollbar-thumb,
.creator-fullscreen-wrapper ::deep .crepe .editor::-webkit-scrollbar-thumb,
.creator-fullscreen-wrapper ::deep .milkdown .editor::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.creator-fullscreen-wrapper ::deep .ProseMirror::-webkit-scrollbar-thumb:hover,
.creator-fullscreen-wrapper ::deep .crepe .editor::-webkit-scrollbar-thumb:hover,
.creator-fullscreen-wrapper ::deep .milkdown .editor::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Editorial Typography */
.creator-fullscreen-wrapper ::deep .milkdown .editor h1,
.creator-fullscreen-wrapper ::deep .crepe h1,
.creator-fullscreen-wrapper ::deep .ProseMirror h1 {
    margin-top: 1.8rem !important;
    margin-bottom: 1rem !important;
    font-size: 2.25rem !important;
    font-weight: 700 !important;
    color: var(--text-main) !important;
    line-height: 1.25 !important;
}

.creator-fullscreen-wrapper ::deep .milkdown .editor h2,
.creator-fullscreen-wrapper ::deep .crepe h2,
.creator-fullscreen-wrapper ::deep .ProseMirror h2 {
    margin-top: 1.5rem !important;
    margin-bottom: 0.8rem !important;
    font-size: 1.6rem !important;
    font-weight: 700 !important;
    color: var(--text-main) !important;
    line-height: 1.3 !important;
}

.creator-fullscreen-wrapper ::deep .milkdown .editor h3,
.creator-fullscreen-wrapper ::deep .crepe h3,
.creator-fullscreen-wrapper ::deep .ProseMirror h3 {
    margin-top: 1.3rem !important;
    margin-bottom: 0.7rem !important;
    font-size: 1.3rem !important;
    font-weight: 700 !important;
    color: var(--text-main) !important;
    line-height: 1.35 !important;
}

.creator-fullscreen-wrapper ::deep .milkdown .editor code,
.creator-fullscreen-wrapper ::deep .crepe code,
.creator-fullscreen-wrapper ::deep .ProseMirror code {
    background-color: rgba(16, 185, 129, 0.1) !important;
    color: var(--accent) !important;
    padding: 0.2rem 0.4rem !important;
    border-radius: var(--radius-sm, 4px) !important;
    font-family: var(--nexus-font-mono) !important;
    font-size: 0.85em !important;
}

/* Premium GFM Table Layouts */
.creator-fullscreen-wrapper ::deep .milkdown-premium-container table,
.creator-fullscreen-wrapper ::deep .crepe table,
.creator-fullscreen-wrapper ::deep .milkdown table,
.creator-fullscreen-wrapper ::deep .ProseMirror table {
    width: 100% !important;
    max-width: 100% !important;
    border-collapse: collapse !important;
    margin: 1.5rem 0 !important;
}

.creator-fullscreen-wrapper ::deep .milkdown-premium-container th,
.creator-fullscreen-wrapper ::deep .crepe th,
.creator-fullscreen-wrapper ::deep .milkdown th,
.creator-fullscreen-wrapper ::deep .ProseMirror th,
.creator-fullscreen-wrapper ::deep .milkdown-premium-container td,
.creator-fullscreen-wrapper ::deep .crepe td,
.creator-fullscreen-wrapper ::deep .milkdown td,
.creator-fullscreen-wrapper ::deep .ProseMirror td {
    padding: 14px 18px !important;
    border: 1px solid var(--border) !important;
}

.creator-fullscreen-wrapper ::deep .milkdown-premium-container th,
.creator-fullscreen-wrapper ::deep .crepe th,
.creator-fullscreen-wrapper ::deep .milkdown th,
.creator-fullscreen-wrapper ::deep .ProseMirror th {
    background-color: var(--bg-base) !important;
    color: var(--text-main) !important;
    font-weight: 700 !important;
    text-align: left !important;
}

.creator-fullscreen-wrapper ::deep .milkdown-premium-container td,
.creator-fullscreen-wrapper ::deep .crepe td,
.creator-fullscreen-wrapper ::deep .milkdown td,
.creator-fullscreen-wrapper ::deep .ProseMirror td {
    color: var(--text-main) !important;
}

/* Zebra row background tints (Dark Mode default) */
.creator-fullscreen-wrapper ::deep .milkdown-premium-container tr:nth-child(even),
.creator-fullscreen-wrapper ::deep .crepe tr:nth-child(even),
.creator-fullscreen-wrapper ::deep .milkdown tr:nth-child(even),
.creator-fullscreen-wrapper ::deep .ProseMirror tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.01) !important;
}

/* Zebra row background tints (Light Mode override) */
.theme-light .creator-fullscreen-wrapper ::deep .milkdown-premium-container tr:nth-child(even),
.theme-light .creator-fullscreen-wrapper ::deep .crepe tr:nth-child(even),
.theme-light .creator-fullscreen-wrapper ::deep .milkdown tr:nth-child(even),
.theme-light .creator-fullscreen-wrapper ::deep .ProseMirror tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.015) !important;
}

/* Lists and Task Lists */
.creator-fullscreen-wrapper ::deep .crepe ul,
.creator-fullscreen-wrapper ::deep .crepe ol,
.creator-fullscreen-wrapper ::deep .milkdown ul,
.creator-fullscreen-wrapper ::deep .milkdown ol,
.creator-fullscreen-wrapper ::deep .ProseMirror ul,
.creator-fullscreen-wrapper ::deep .ProseMirror ol {
    line-height: 1.7 !important;
}

/* 4. Bottom Actions Panel locked at floor zone of the card structure */
.creator-actions-bar {
    display: flex;
    justify-content: flex-end; 
    margin-top: 1.5rem;
    padding: 1rem 0 0 0;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    width: 100%;
}

.btn-nexus-premium {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: var(--accent) !important;
    background: var(--accent) !important;
    color: #000000 !important;
    border: none;
    border-radius: var(--radius-md);
    padding: 8px 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--nexus-font-sans);
    font-size: 0.9rem;
    min-height: 36px;
}

.btn-nexus-premium:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-nexus-premium:hover .arrow-icon {
    transform: translateX(4px);
}

.arrow-icon {
    transition: transform 0.2s ease;
}

/* 5. Dedicated Preview Card */
.creator-preview-card {
    background: #121214;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    flex-shrink: 0;
    max-height: 180px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

.preview-header h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
    font-family: var(--nexus-font-sans);
}

.pre-wrapper {
    overflow-y: auto;
    overflow-x: auto;
    flex-grow: 1;
}

.code-preview-block {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: 'Azeret Mono', SFMono-Regular, Consolas, Menlo, monospace;
    font-size: 0.85rem;
    color: #e4e4e7;
    line-height: 1.6;
}
