/* 
 * Paperwork Factory Specialized Styles
 * Focuses on the split-view layout and the high-fidelity document preview.
 */

.paperwork-viewport {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Split View Layout */
.paperwork-split-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 0;
    background: hsl(var(--background));
}

/* Left Sidebar - Editor */
.paperwork-editor-sidebar {
    width: 420px;
    background: hsla(var(--h), 25%, 8%, 0.8);
    backdrop-filter: blur(20px);
    border-right: 1px solid hsl(var(--border-light));
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: 20px 0 50px rgba(0,0,0,0.3);
}

.editor-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.editor-scrollbox {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.editor-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    background: rgba(0,0,0,0.2);
    display: flex;
    gap: 1rem;
}

/* Right Content - Preview */
.paperwork-preview-area {
    flex: 1;
    background: #05070a;
    background-image: 
        radial-gradient(circle at 50% 50%, hsla(var(--h), var(--s), 60%, 0.03) 0%, transparent 70%),
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 100% 100%, 40px 40px, 40px 40px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 4rem 2rem;
    overflow-y: auto;
    position: relative;
}

/* Virtual Paper Sheet */
.paper-sheet {
    width: 210mm;
    min-height: 297mm;
    background: white;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(0,0,0,0.1);
    padding: 2.5rem;
    color: #1a1a1a;
    position: relative;
    transform-origin: top center;
    animation: paperSlideIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes paperSlideIn {
    from { opacity: 0; transform: translateY(40px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.paper-sheet::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0.02) 0%, transparent 50%);
    pointer-events: none;
}

/* Sheet Internal Content Styles */
.paper-sheet-content {
    font-family: 'Helvetica', Arial, sans-serif;
    line-height: 1.5;
    font-size: 11pt;
}

.paper-sheet-content h1, 
.paper-sheet-content h2, 
.paper-sheet-content h3 {
    color: #000;
    margin-bottom: 0.5rem;
}

/* Form Decorations */
.doc-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.hud-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.hud-form-sub-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-top: 0.5rem;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.2);
}

/* Formatting Help Panel */
.editor-help-panel {
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
    animation: slideDown 0.3s ease-out;
    max-height: 400px;
    overflow-y: auto;
}

.sub-help-title {
    font-size: 0.65rem;
    font-weight: 700;
    color: rgba(255,255,255,0.3);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    margin-top: 1rem;
}

.help-section:first-child .sub-help-title {
    margin-top: 0;
}

.tool-btn.color-warning:hover { background: #f59e0b; }
.tool-btn.color-note:hover { background: #64748b; }
.tool-btn.color-info:hover { background: #3b82f6; }
.tool-btn.color-important:hover { background: #ef4444; }
.tool-btn.color-legal:hover { background: #8b5cf6; }

@keyframes slideDown {
    from { max-height: 0; opacity: 0; }
    to { max-height: 400px; opacity: 1; }
}

.help-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
}

.formatting-toolbar {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.tool-btn {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    color: white;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: hsl(var(--primary));
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.help-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.75rem;
}

.help-grid div {
    display: flex;
    justify-content: space-between;
    background: rgba(0,0,0,0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.help-grid code {
    color: hsl(var(--primary));
}

.form-section-divider {
    height: 1px;
    background: linear-gradient(90deg, hsl(var(--primary)) 0%, transparent 100%);
    margin: 2rem 0 1rem 0;
    opacity: 0.3;
}

.form-section-title {
    font-size: 0.7rem;
    font-weight: 800;
    color: hsl(var(--primary));
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1rem;
}

/* Template Browser Grid Overlay */
.template-browser-overlay {
    position: absolute;
    inset: 0;
    background: hsl(var(--background));
    z-index: 20;
    padding: 3rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.browser-header {
    margin-bottom: 3rem;
    max-width: 1200px;
    width: 100%;
    margin-inline: auto;
}

.browser-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    width: 100%;
    margin-inline: auto;
}

/* Loader in Preview */
.preview-loader-overlay {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    padding: 0.75rem;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.1);
    display: none;
}

.preview-loader-overlay.active {
    display: block;
}
