/*
 * ============================================================
 * NOTE COMPILER STYLES
 * ============================================================
 * - CSS Variables
 * - Base styles and resets
 * - Banner styles and animations
 * - Prose styling for contentEditable
 * - Preview pane (Word document appearance)
 * - UI animations
 */

/* CSS Variables */
:root {
    --purple-deep: #4A3F6B;
    --purple-mid: #6B5B95;
    --purple-light: #9B8DC2;
    --teal: #2A9D8F;
    --teal-light: #40B9A9;
    --orange-pdf: #E76F51;
    --blue-doc: #5DA9E9;
    --green-file: #52B788;
    --cream: #FAF9F6;
    --dark: #1A1A2E;
    --gradient-primary: linear-gradient(135deg, #4A3F6B 0%, #2A9D8F 100%);
}

/* Base */
body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#root { height: 100vh; overflow: hidden; }

/* ============================================================
 * BANNER STYLES
 * ============================================================ */

/* Main Banner Container */
.app-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: var(--gradient-primary);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    box-shadow: 0 4px 20px rgba(74, 63, 107, 0.3);
    animation: bannerSlideIn 0.5s ease-out;
}

@keyframes bannerSlideIn {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Banner Shimmer Effect */
.app-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    animation: shimmer 10s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { left: -100%; }
    50% { left: 100%; }
}

/* Logo Section */
.banner-logo {
    display: flex;
    flex-direction: column;
    color: white;
    z-index: 1;
}

.banner-logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.banner-logo p {
    font-size: 0.85rem;
    opacity: 0.9;
    margin: 0;
    font-weight: 400;
}

/* Floating Documents Animation */
.banner-documents {
    position: relative;
    width: 400px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.floating-doc {
    position: absolute;
    width: 80px;
    height: 100px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Scale all documents together when hovering the container */
.banner-documents:hover .floating-doc {
    transform: scale(1.1) translateY(-5px);
    z-index: 10;
}

.banner-documents:hover .floating-doc.docx {
    transform: scale(1.1) translateX(-50%) translateY(-5px);
}

.floating-doc.pdf {
    left: 20%;
    border-left: 4px solid var(--orange-pdf);
    animation: floatDoc1 6s ease-in-out infinite;
}

.floating-doc.docx {
    left: 50%;
    transform: translateX(-50%);
    border-left: 4px solid var(--blue-doc);
    animation: floatDoc2 5s ease-in-out infinite;
    z-index: 2;
}

.floating-doc.txt {
    right: 20%;
    border-left: 4px solid var(--green-file);
    animation: floatDoc3 7s ease-in-out infinite;
}

@keyframes floatDoc1 {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50% { transform: translateY(-15px) rotate(-3deg); }
}

@keyframes floatDoc2 {
    0%, 100% { transform: translateX(-50%) translateY(0) rotate(2deg); }
    50% { transform: translateX(-50%) translateY(-12px) rotate(2deg); }
}

@keyframes floatDoc3 {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-18px) rotate(-2deg); }
}

.doc-type-badge {
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    display: inline-block;
}

.doc-type-badge.pdf { 
    background: rgba(231, 111, 81, 0.15); 
    color: var(--orange-pdf); 
}

.doc-type-badge.docx { 
    background: rgba(93, 169, 233, 0.15); 
    color: var(--blue-doc); 
}

.doc-type-badge.txt { 
    background: rgba(82, 183, 136, 0.15); 
    color: var(--green-file); 
}

.doc-mini-lines {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.doc-mini-line {
    height: 4px;
    background: #eee;
    border-radius: 2px;
}

.doc-mini-line:nth-child(1) { width: 100%; }
.doc-mini-line:nth-child(2) { width: 80%; }
.doc-mini-line:nth-child(3) { width: 60%; }

/* Security Shield */
.banner-security {
    position: relative;
    width: 200px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.shield-container-mini {
    position: relative;
    width: 70px;
    height: 80px;
}

.security-shield {
    width: 100%;
    height: 100%;
    background: white;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: shieldPulse 3s ease-in-out infinite;
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.shield-container-mini:hover .security-shield {
    transform: scale(1.1);
}

@keyframes shieldPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.shield-icon {
    font-size: 2rem;
}

.orbit-mini {
    position: absolute;
    border: 1.5px dashed rgba(255, 255, 255, 0.4);
    border-radius: 50%;
}

.orbit-mini-1 {
    width: 100px;
    height: 100px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: orbitSpin 8s linear infinite;
}

.orbit-mini-2 {
    width: 130px;
    height: 130px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: orbitSpin 12s linear infinite reverse;
}

@keyframes orbitSpin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Tooltips */
.banner-tooltip {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: white;
    color: var(--dark);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    font-size: 0.85rem;
    line-height: 1.4;
    width: 320px;
    pointer-events: none;
    opacity: 0;
    transition: all 0.2s ease-out;
    z-index: 2000;
}

.banner-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: white;
}

.floating-doc:hover .banner-tooltip,
.shield-container-mini:hover .security-tooltip,
.banner-documents:hover > .banner-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Position adjustment for security tooltip */
.security-tooltip {
    top: calc(100% + 5px);
}

/* SEO-friendly screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.tooltip-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--purple-deep);
}

.tooltip-text {
    font-size: 0.8rem;
    color: #666;
    line-height: 1.3;
}

/* Adjust main content for banner */
.main-content-with-banner {
    padding-top: 100px;
    height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #888; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* Prose - Editor content styling */
.prose { color: #374151; line-height: 1.75; }
.prose p { margin: 1em 0; }
.prose h1 { font-size: 2em; font-weight: bold; margin: 0.67em 0; }
.prose h2 { font-size: 1.5em; font-weight: bold; margin: 0.75em 0; }
.prose h3 { font-size: 1.17em; font-weight: bold; margin: 0.83em 0; }
.prose ul { padding-left: 2em; margin: 1em 0; list-style-type: disc; }
.prose ol { padding-left: 2em; margin: 1em 0; list-style-type: decimal; }
.prose li { display: list-item; }
.prose strong { font-weight: bold; }
.prose em { font-style: italic; }
.prose u { text-decoration: underline; }

[contenteditable]:focus { outline: none; }
[contenteditable]:empty:before { content: attr(data-placeholder); color: #9ca3af; }

/* Preview Pane - Mimics Word document */
.preview-document {
    font-family: 'Times New Roman', Times, serif;
    font-size: 12pt;
    line-height: 1.5;
    color: #000000;
    background-color: #ffffff;
    padding: 1in;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    min-height: 11in;
    width: 8.5in;
    margin: 0 auto;
}
.preview-document h1 { font-size: 24pt; font-weight: bold; text-align: center; margin: 24pt 0 12pt 0; }
.preview-document h2 { font-size: 18pt; font-weight: bold; margin: 18pt 0 12pt 0; }
.preview-document h3 { font-size: 14pt; font-weight: bold; margin: 14pt 0 12pt 0; }
.preview-document p { margin: 12pt 0; }
.preview-document ul { margin: 12pt 0; padding-left: 40pt; list-style-type: disc; }
.preview-document ol { margin: 12pt 0; padding-left: 40pt; list-style-type: decimal; }
.preview-document li { margin: 6pt 0; display: list-item; }
.preview-document strong { font-weight: bold; }
.preview-document em { font-style: italic; }
.preview-document u { text-decoration: underline; }

/* PDF Section Styles */
.pdf-section-card {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    overflow: hidden;
}
.pdf-section-card.editing {
    border-color: #3b82f6;
    background: #eff6ff;
}
.pdf-page-canvas {
    display: block;
    margin: 0 auto;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.pdf-viewer-container {
    max-height: 500px;
    overflow-y: auto;
    background: #525659;
    padding: 16px;
}
.pdf-viewer-container canvas {
    display: block;
    margin: 0 auto 16px auto;
    background: white;
}
.pdf-viewer-container canvas:last-child {
    margin-bottom: 0;
}

/* Action menu slide-in animation */
.action-menu { animation: slideIn 0.15s ease-out; }
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Merge connector styling */
.merge-connector {
    opacity: 0;
    transition: opacity 0.2s ease;
}
.section-wrapper:hover + .merge-connector,
.merge-connector:hover {
    opacity: 1;
}

/* Drag and drop page styling */
.page-thumbnail {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.page-thumbnail.dragging {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

/* Banner Actions */
.banner-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Module status indicators */
.module-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.module-status-dot.loaded { background-color: #22c55e; }
.module-status-dot.disabled { background-color: #9ca3af; }
.module-status-dot.error { background-color: #ef4444; }
