/* Softrader Documentation - Document Viewer Styles */

:root {
    --primary: #0066b3;
    --primary-dark: #004d86;
    --primary-light: #e6f2fa;
    --secondary: #00a5e0;
    --success: #059669;
    --success-bg: #d1fae5;
    --error: #dc2626;
    --error-bg: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
}

.layout {
    min-height: 100vh;
}

/* Header */
.header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-logo {
    height: 32px;
    width: auto;
}

.header-left h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-user {
    color: var(--gray-500);
    font-size: 14px;
}

.header-nav a {
    padding: 8px 16px;
    color: var(--gray-600);
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}

.header-nav a:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

/* Main Content */
.main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px;
}

/* Content Card */
.content-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

.content-card h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 20px;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 14px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--gray-400);
}

/* File List */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--gray-800);
    transition: all 0.15s;
    border: 1px solid transparent;
}

.file-item:hover {
    background: var(--gray-50);
    border-color: var(--gray-200);
}

.file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    flex-shrink: 0;
}

.file-folder .file-icon {
    background: #fef3c7;
    color: #d97706;
}

.file-document .file-icon {
    background: var(--primary-light);
    color: var(--primary);
}

.file-pdf .file-icon {
    background: #fee2e2;
    color: #dc2626;
}

.file-excel .file-icon {
    background: #dcfce7;
    color: #16a34a;
}

.file-badge {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    background: #dc2626;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
}

.file-badge-excel {
    background: #16a34a;
}

.file-name {
    font-weight: 500;
}

/* Document Viewer */
.doc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-200);
}

.doc-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--gray-900);
}

.doc-meta {
    font-size: 13px;
    color: var(--gray-500);
}

.doc-actions {
    display: flex;
    gap: 12px;
}

.doc-actions a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--gray-100);
    color: var(--gray-700);
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}

.doc-actions a:hover {
    background: var(--gray-200);
}

.doc-actions a.primary {
    background: var(--primary);
    color: white;
}

.doc-actions a.primary:hover {
    background: var(--primary-dark);
}

/* Document Content */
.doc-content {
    line-height: 1.8;
}

.doc-content h1,
.doc-content h2,
.doc-content h3,
.doc-content h4,
.doc-content h5,
.doc-content h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
    color: var(--gray-900);
}

.doc-content h1 { font-size: 1.75em; }
.doc-content h2 { font-size: 1.5em; }
.doc-content h3 { font-size: 1.25em; }
.doc-content h4 { font-size: 1.1em; }

.doc-content p {
    margin-bottom: 1em;
}

.doc-content ul,
.doc-content ol {
    margin-bottom: 1em;
    padding-left: 2em;
}

.doc-content li {
    margin-bottom: 0.5em;
}

.doc-content a {
    color: var(--primary);
}

.doc-content a:hover {
    text-decoration: underline;
}

.doc-content code {
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.9em;
}

.doc-content pre {
    background: var(--gray-900);
    color: #e5e7eb;
    padding: 16px 20px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: 1em;
}

.doc-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.doc-content blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 20px;
    margin: 1em 0;
    color: var(--gray-600);
    font-style: italic;
}

.doc-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1em;
}

.doc-content th,
.doc-content td {
    padding: 10px 14px;
    border: 1px solid var(--gray-200);
    text-align: left;
}

.doc-content th {
    background: var(--gray-50);
    font-weight: 600;
}

.doc-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}

/* Events Panel (Admin) */
.events-panel {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-200);
}

.events-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--gray-100);
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.15s;
}

.events-toggle:hover {
    background: var(--gray-200);
}

.events-content {
    display: none;
    margin-top: 16px;
    padding: 16px;
    background: var(--gray-50);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: 'Monaco', 'Menlo', monospace;
    color: var(--gray-600);
    line-height: 1.8;
    max-height: 300px;
    overflow-y: auto;
}

.events-content.show {
    display: block;
}

/* Utilities */
.text-muted {
    color: var(--gray-500);
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 0 16px;
        height: auto;
        min-height: 64px;
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }
    
    .header-nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .main {
        padding: 16px;
    }
    
    .doc-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Excel Preview Styles */
.excel-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 0;
    overflow-x: auto;
}

.excel-tab {
    padding: 10px 20px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
    transition: all 0.2s;
    white-space: nowrap;
}

.excel-tab:hover {
    background: var(--gray-50);
    color: var(--gray-800);
}

.excel-tab.active {
    background: white;
    color: var(--primary);
    border-color: var(--gray-300);
    border-bottom: 2px solid white;
    margin-bottom: -2px;
}

.excel-sheet-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 12px;
}

.excel-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
}

.excel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 600px;
}

.excel-table th,
.excel-table td {
    padding: 10px 12px;
    text-align: left;
    border: 1px solid var(--gray-200);
    white-space: nowrap;
}

.excel-table th {
    background: var(--gray-100);
    font-weight: 600;
    color: var(--gray-700);
    position: sticky;
    top: 0;
}

.excel-table tr:nth-child(even) td {
    background: var(--gray-50);
}

.excel-table tr:hover td {
    background: var(--primary-light);
}

.excel-truncated {
    margin-top: 12px;
    padding: 12px;
    background: var(--gray-100);
    border-radius: var(--radius);
    color: var(--gray-600);
    font-size: 13px;
    text-align: center;
}

.excel-preview-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #fef9c3;
    border: 1px solid #fde047;
    border-radius: var(--radius);
    color: #854d0e;
    font-size: 13px;
    margin-bottom: 16px;
}

.excel-preview-notice svg {
    flex-shrink: 0;
}

.excel-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    color: var(--gray-500);
}

.excel-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.excel-error {
    padding: 16px;
    background: var(--error-bg);
    color: var(--error);
    border-radius: var(--radius);
    text-align: center;
}

/* PDF Viewer */
.pdf-viewer {
    width: 100%;
    height: calc(100vh - 200px);
    min-height: 800px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--gray-100);
    display: flex;
}

.pdf-iframe {
    width: 100%;
    height: 100%;
    min-height: 800px;
    border: none;
    flex: 1;
}
