/* gnuboard5/docs/css/docs.css */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f8fafc;
    color: #334155;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    border: none;
    background: none;
    cursor: pointer;
}

/* Accessibility */
#to_content {
    position: absolute;
    top: -9999px;
    left: 0;
    width: 100%;
    height: 30px;
    line-height: 30px;
    text-align: center;
    background: #000;
    color: #fff;
    text-decoration: none;
    z-index: 10000;
}

#to_content:focus {
    top: 0;
}

/* Main Wrapper */
#docs-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
#docs-header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 64px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 2rem;
    height: 100%;
}

.logo-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.logo a {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

.logo a:hover {
    color: #10b981;
}

/* Main Navigation */
.main-nav {
    display: flex;
    gap: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: block;
    padding: 1rem 1.5rem;
    color: #64748b;
    font-weight: 500;
    transition: color 0.2s;
    cursor: pointer;
}

.nav-link:hover,
.nav-link.active {
    color: #10b981;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 1001;
}

.nav-item:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 0.75rem 1rem;
    color: #64748b;
    transition: all 0.2s;
    border-bottom: 1px solid #f1f5f9;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover,
.dropdown-item.active {
    background: #f0fdf4;
    color: #10b981;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-btn,
.admin-btn,
.back-btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
}

.search-btn {
    color: #64748b;
}

.search-btn:hover {
    color: #10b981;
}

.admin-btn,
.back-btn {
    background: #10b981;
    color: white;
}

.admin-btn:hover,
.back-btn:hover {
    background: #059669;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background-color: #475569;
    margin: 3px 0;
    transition: 0.3s;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* Mobile Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
}

.mobile-overlay.active {
    display: block;
}

/* Main Container */
.main-container {
    display: flex;
    margin-top: 64px;
    min-height: calc(100vh - 64px);
}

.main-container.single-doc {
    flex-direction: column;
}

/* Sidebar */
.sidebar {
    width: 350px;
    background: white;
    border-right: 1px solid #e2e8f0;
    padding: 2rem 0;
    overflow-y: auto;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    transition: transform 0.3s ease;
}

.sidebar.mobile-open {
    position: fixed;
    top: 64px;
    left: 0;
    z-index: 1002;
    transform: translateX(0);
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
    padding: 0 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.5rem;
    color: #64748b;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    font-size: 14px;
}

.sidebar-item:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.sidebar-item.active {
    background: #f0fdf4;
    color: #10b981;
    border-left-color: #10b981;
}

.sidebar-empty {
    padding: 0.5rem 1.5rem;
    color: #94a3b8;
    font-style: italic;
    font-size: 0.875rem;
}

.new-badge {
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    text-transform: uppercase;
}

/* Content Area */
.content {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
}

.content.full-width {
    max-width: none;
    margin: 0 auto;
    width: 100%;
    max-width: 1200px;
}

/* Document Header */
.doc-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.breadcrumb {
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 1rem;
}

.breadcrumb a {
    color: #10b981;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.separator {
    margin: 0 0.5rem;
}

.current {
    color: #94a3b8;
}

.doc-title {
    font-size: 2.25rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.doc-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}

.doc-info {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.875rem;
    color: #64748b;
}

.doc-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.print-btn {
    background: #6366f1;
    color: white;
}

.print-btn:hover {
    background: #4f46e5;
}

.pdf-btn {
    background: #dc2626;
    color: white;
}

.pdf-btn:hover {
    background: #b91c1c;
}

.edit-btn {
    background: #f59e0b;
    color: white;
}

.edit-btn:hover {
    background: #d97706;
}

/* Document Content */
.doc-content {
    color: #475569;
    line-height: 1.7;
    margin-bottom: 3rem;
}

.doc-content h1,
.doc-content h2,
.doc-content h3,
.doc-content h4,
.doc-content h5,
.doc-content h6 {
    color: #1e293b;
    margin: 2rem 0 1rem 0;
    line-height: 1.3;
}

.doc-content h1 {
    font-size: 2rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

.doc-content h2 {
    font-size: 1.5rem;
}

.doc-content h3 {
    font-size: 1.25rem;
}

.doc-content p {
    margin-bottom: 1rem;
}

.doc-content ul,
.doc-content ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.doc-content li {
    margin-bottom: 0.5rem;
}

.doc-content blockquote {
    border-left: 4px solid #10b981;
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: #64748b;
    font-style: italic;
}

.doc-content code {
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.875rem;
}

.doc-content pre {
    border-radius: 8px;
    padding: 1rem;
    margin: 1.5rem 0;
    overflow-x: auto;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.875rem;
}

.doc-content pre code {
    background: none;
    padding: 0;
}

.doc-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.doc-content th,
.doc-content td {
    border: 1px solid #e2e8f0;
    padding: 0.75rem;
    text-align: left;
}

.doc-content th {
    background: #f8fafc;
    font-weight: 600;
}

.doc-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}

/* Document Navigation */
.doc-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e2e8f0;
}

.nav-prev,
.nav-next {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-prev:hover,
.nav-next:hover {
    border-color: #10b981;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
}

.nav-next {
    text-align: right;
}

.nav-label {
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.nav-title {
    font-weight: 500;
    color: #1e293b;
}

/* Empty Content */
.empty-content {
    text-align: center;
    padding: 4rem 2rem;
    color: #64748b;
}

.empty-content h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #94a3b8;
}

/* Search Layer */
.search-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.search-layer.active {
    display: flex;
}

.search-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.search-header h3 {
    font-size: 1.25rem;
    color: #1e293b;
}

.search-close {
    font-size: 1.5rem;
    color: #64748b;
    padding: 0.25rem;
}

.search-close:hover {
    color: #1e293b;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-input-group {
    display: flex;
    gap: 0.5rem;
}

.search-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 1rem;
}

.search-input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.search-submit {
    padding: 0.75rem 1.5rem;
    background: #10b981;
    color: white;
    border-radius: 6px;
    font-weight: 500;
    transition: background 0.2s;
}

.search-submit:hover {
    background: #059669;
}

.search-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

/* Search Results */
.search-result-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.search-result-header h1 {
    font-size: 2rem;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.result-count {
    color: #64748b;
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.search-item {
    padding: 1.5rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s;
}

.search-item:hover {
    border-color: #10b981;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
}

.search-title {
    margin-bottom: 0.5rem;
}

.search-title a {
    color: #1e293b;
    font-size: 1.125rem;
    font-weight: 600;
}

.search-title a:hover {
    color: #10b981;
}

.search-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: #64748b;
}

.search-menu {
    background: #f0fdf4;
    color: #10b981;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.search-summary {
    color: #64748b;
    line-height: 1.6;
}

.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: #64748b;
}

.no-results h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: #94a3b8;
}

/* Print Styles */
@media print {
    #docs-header,
    .sidebar,
    .doc-actions,
    .doc-navigation {
        display: none !important;
    }
    
    .main-container {
        margin-top: 0;
    }
    
    .content {
        padding: 0;
        max-width: none;
    }
    
    .doc-title {
        font-size: 1.5rem;
    }
    
    .doc-content {
        font-size: 12pt;
        line-height: 1.4;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        padding: 0 1rem;
    }
    
    .main-nav {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        top: 64px;
        left: 0;
        z-index: 1002;
        height: calc(100vh - 64px);
    }
    
    .content {
        padding: 1rem;
    }
    
    .doc-title {
        font-size: 1.75rem;
    }
    
    .doc-meta {
        flex-direction: column;
        gap: 1rem;
    }
    
    .doc-info {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .doc-navigation {
        grid-template-columns: 1fr;
    }
    
    .nav-next {
        text-align: left;
    }
    
    .search-content {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .search-input-group {
        flex-direction: column;
    }
    
    .search-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .header-content {
        padding: 0 0.5rem;
    }
    
    .logo a {
        font-size: 1.25rem;
    }
    
    .content {
        padding: 0.5rem;
    }
    
    .doc-title {
        font-size: 1.5rem;
    }
    
    .action-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }
}