/* PraxisMS Documentation Styles */

:root {
    /* Brand Colors */
    --primary: #20a8d8;
    --primary-dark: #177fa3;
    --primary-light: #63c2de;

    /* Backgrounds */
    --bg-body: #f5f7fa;
    --bg-sidebar: #ffffff;
    --bg-content: #ffffff;
    --bg-code: #1e1e1e;
    --bg-code-inline: rgba(32, 168, 216, 0.1);

    /* Text */
    --text-primary: #212529;
    --text-secondary: #495057;
    --text-muted: #6c757d;
    --text-light: #adb5bd;

    /* Borders */
    --border-color: #dee2e6;
    --border-light: #e9ecef;

    /* Callouts */
    --callout-info-bg: rgba(32, 168, 216, 0.1);
    --callout-info-border: #20a8d8;
    --callout-warning-bg: rgba(255, 193, 7, 0.1);
    --callout-warning-border: #ffc107;
    --callout-tip-bg: rgba(40, 167, 69, 0.1);
    --callout-tip-border: #28a745;
    --callout-danger-bg: rgba(220, 53, 69, 0.1);
    --callout-danger-border: #dc3545;

    /* Layout */
    --sidebar-width: 280px;
    --header-height: 60px;
    --content-max-width: 1400px;

    /* Grays (for browser mockup) */
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --white: #ffffff;
}

/* Base Styles */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 20px);
}

body {
    font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-body);
    margin: 0;
    padding: 0;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    color: var(--text-primary);
}

h1 { font-size: 2rem; margin-top: 0; }
h2 { font-size: 1.5rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--primary); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p {
    margin-bottom: 1rem;
}

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

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Header */
.docs-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-content);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
}

.docs-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.docs-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

.docs-logo-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.docs-logo-text span {
    color: var(--text-muted);
    font-weight: 400;
}

/* Search */
.docs-search {
    flex: 1;
    max-width: 400px;
    margin: 0 2rem;
}

.docs-search-input {
    width: 100%;
    padding: 0.5rem 1rem;
    padding-left: 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    background: var(--bg-body);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.docs-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(32, 168, 216, 0.15);
}

.docs-search-wrapper {
    position: relative;
}

.docs-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* Header Actions */
.docs-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.docs-header-link {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.docs-header-link:hover {
    background: var(--bg-body);
    color: var(--primary);
    text-decoration: none;
}

/* Mobile Menu Toggle */
.docs-mobile-toggle {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-primary);
}

/* Sidebar */
.docs-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 1.5rem 0;
    z-index: 900;
}

.docs-sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.docs-nav-section {
    padding: 0.75rem 1.5rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.docs-nav-link {
    display: block;
    padding: 0.4rem 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}

.docs-nav-link:hover {
    color: var(--primary);
    background: var(--bg-body);
    text-decoration: none;
}

.docs-nav-link.active {
    color: var(--primary);
    background: var(--callout-info-bg);
    border-left-color: var(--primary);
    font-weight: 600;
}

.docs-nav-link.sub-item {
    padding-left: 2.5rem;
    font-size: 0.85rem;
}

/* Main Content */
.docs-main {
    margin-left: var(--sidebar-width);
    padding: calc(var(--header-height) + 2rem) 2rem 3rem;
    min-height: 100vh;
}

.docs-content {
    max-width: var(--content-max-width);
    margin: 0 auto;
    background: var(--bg-content);
    border-radius: 8px;
    padding: 2rem 2.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: opacity 0.15s ease;
}

.docs-content.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Breadcrumb */
.docs-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.docs-breadcrumb a {
    color: var(--text-muted);
}

.docs-breadcrumb a:hover {
    color: var(--primary);
}

.docs-breadcrumb-separator {
    color: var(--text-light);
}

/* Page Header */
.docs-page-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.docs-page-header h1 {
    margin-bottom: 0.5rem;
}

.docs-page-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin: 0;
}

/* In-Page Navigation */
.docs-toc {
    background: var(--bg-body);
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin-bottom: 2rem;
}

.docs-toc-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.docs-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.docs-toc-list li {
    margin-bottom: 0.4rem;
}

.docs-toc-list a {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.docs-toc-list a:hover {
    color: var(--primary);
}

/* Callouts */
.callout {
    padding: 1rem 1.25rem;
    border-left: 4px solid;
    border-radius: 0 6px 6px 0;
    margin: 1.5rem 0;
}

.callout-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.callout p:last-child {
    margin-bottom: 0;
}

.callout-info {
    background: var(--callout-info-bg);
    border-color: var(--callout-info-border);
}

.callout-warning {
    background: var(--callout-warning-bg);
    border-color: var(--callout-warning-border);
}

.callout-tip {
    background: var(--callout-tip-bg);
    border-color: var(--callout-tip-border);
}

.callout-danger {
    background: var(--callout-danger-bg);
    border-color: var(--callout-danger-border);
}

/* Permission Badges */
.badge-permission {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 3px;
    vertical-align: middle;
    margin-left: 0.5rem;
}

.badge-all-users {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-supervisor {
    background: #e8eaf6;
    color: #283593;
}

.badge-admin {
    background: #e3f2fd;
    color: #1565c0;
}

.badge-billing {
    background: #fce4ec;
    color: #c2185b;
}

/* Feature Module Badge */
.badge-module {
    background: #fff3e0;
    color: #e65100;
}

/* Code Blocks */
.code-block {
    position: relative;
    background: var(--bg-code);
    border-radius: 6px;
    margin: 1rem 0;
}

.code-block pre {
    margin: 0;
    padding: 1rem 1.25rem;
    padding-right: 4rem;
    overflow-x: auto;
    color: #e0e0e0;
    font-size: 0.875rem;
    line-height: 1.5;
}

.code-block code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    color: inherit;
}

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #888;
    padding: 0.35rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.copy-btn.copied {
    background: #28a745;
    color: #fff;
}

/* Inline Code */
code:not(pre code) {
    background: var(--bg-code-inline);
    color: var(--primary-dark);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
    font-family: 'Consolas', 'Monaco', monospace;
}

/* Code Tabs */
.code-tabs .nav-tabs {
    border-bottom: none;
    margin-bottom: -1px;
    position: relative;
    z-index: 1;
}

.code-tabs .nav-link {
    background: #2d2d2d;
    border: none;
    border-radius: 6px 6px 0 0;
    color: #888;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    margin-right: 2px;
}

.code-tabs .nav-link:hover {
    color: #ccc;
}

.code-tabs .nav-link.active {
    background: var(--bg-code);
    color: #fff;
}

.code-tabs .tab-content .code-block {
    margin-top: 0;
    border-radius: 0 6px 6px 6px;
}

/* Tables */
.docs-table {
    width: 100%;
    margin: 1rem 0;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.docs-table th {
    background: var(--bg-body);
    font-weight: 600;
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--border-color);
}

.docs-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}

.docs-table tr:last-child td {
    border-bottom: none;
}

.param-name {
    font-family: 'Consolas', 'Monaco', monospace;
    font-weight: 600;
    color: var(--primary-dark);
}

.param-required {
    color: #dc3545;
    font-size: 0.75rem;
    font-weight: 600;
}

.param-optional {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Browser Mockup */
.browser-mockup {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--gray-200);
    margin: 1.5rem 0;
    max-width: 65%;
}

.browser-bar {
    background: linear-gradient(to bottom, var(--gray-100), var(--gray-200));
    padding: 10px 0 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--gray-300);
}

/* Navigation buttons - back, forward, refresh */
.browser-bar::before {
    content: '\2190 \2192 \21BB';
    font-size: 14px;
    color: var(--gray-500);
    letter-spacing: 10px;
    margin-right: 4px;
}

.browser-controls {
    display: flex;
    gap: 0;
    order: 2;
}

.browser-controls span {
    width: 40px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    transition: background-color 0.1s ease;
    position: relative;
}

.browser-controls span:hover {
    background: var(--gray-200);
}

/* Minimize - horizontal line */
.browser-controls span:nth-child(1)::before {
    content: '';
    width: 10px;
    height: 1px;
    background: var(--gray-600);
}

/* Maximize - square outline */
.browser-controls span:nth-child(2)::before {
    content: '';
    width: 9px;
    height: 9px;
    border: 1px solid var(--gray-600);
}

/* Close - X shape */
.browser-controls span:nth-child(3)::before,
.browser-controls span:nth-child(3)::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 1px;
    background: var(--gray-600);
}

.browser-controls span:nth-child(3)::before {
    transform: rotate(45deg);
}

.browser-controls span:nth-child(3)::after {
    transform: rotate(-45deg);
}

.browser-controls span:nth-child(3):hover {
    background: #c42b1c;
}

.browser-controls span:nth-child(3):hover::before,
.browser-controls span:nth-child(3):hover::after {
    background: white;
}

.browser-url {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 11px;
    color: var(--gray-600);
    background: var(--white);
    padding: 6px 16px;
    border-radius: 6px;
    flex: 1;
    text-align: center;
    border: 1px solid var(--gray-300);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.browser-url::before {
    content: '\1F512 ';
    font-size: 10px;
}

.browser-content {
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.browser-content img {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
}

/* Lightbox modal for screenshot enlargement */
.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox-overlay img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.8;
}

.lightbox-close:hover {
    opacity: 1;
}

.browser-content .screenshot-placeholder {
    color: var(--gray-500);
    font-size: 0.9rem;
    text-align: center;
    padding: 2rem;
}

/* Steps/Numbered List */
.docs-steps {
    counter-reset: step-counter;
    list-style: none;
    padding: 0;
}

.docs-steps li {
    position: relative;
    padding-left: 3rem;
    margin-bottom: 1.5rem;
    counter-increment: step-counter;
}

.docs-steps li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 2rem;
    height: 2rem;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Related Articles */
.docs-related {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
}

.docs-related-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.docs-related-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.docs-related-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-body);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: background 0.15s;
}

.docs-related-link:hover {
    background: var(--callout-info-bg);
    text-decoration: none;
}

/* Footer */
.docs-footer {
    margin-left: var(--sidebar-width);
    padding: 2rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-content);
}

.docs-footer-inner {
    max-width: var(--content-max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.docs-footer-links {
    display: flex;
    gap: 1.5rem;
}

.docs-footer-links a {
    color: var(--text-muted);
}

.docs-footer-links a:hover {
    color: var(--primary);
}

/* Search Results */
.search-results {
    list-style: none;
    padding: 0;
}

.search-result-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-title {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.search-result-excerpt {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.search-result-excerpt mark {
    background: #fff3cd;
    padding: 0 2px;
}

/* Sidebar Overlay (mobile) */
.docs-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 850;
}

/* Mobile Responsive */
@media (max-width: 991.98px) {
    .docs-mobile-toggle {
        display: block;
    }

    .docs-search {
        display: none;
    }

    .docs-header-link {
        display: none;
    }

    .docs-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .docs-sidebar.show {
        transform: translateX(0);
    }

    .docs-sidebar-overlay.show {
        display: block;
    }

    .docs-main {
        margin-left: 0;
        padding: calc(var(--header-height) + 1rem) 1rem 2rem;
    }

    .docs-content {
        padding: 1.5rem;
    }

    .docs-footer {
        margin-left: 0;
    }

    .docs-footer-inner {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

@media (max-width: 575.98px) {
    .docs-content {
        padding: 1rem;
    }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }

    .browser-mockup {
        border-radius: 8px;
    }

    .browser-bar {
        padding: 8px 0 8px 12px;
    }

    .browser-bar::before {
        font-size: 12px;
        letter-spacing: 6px;
    }

    .browser-controls span {
        width: 32px;
        height: 26px;
    }
}

/* Print Styles */
@media print {
    .docs-header,
    .docs-sidebar,
    .docs-footer,
    .copy-btn,
    .docs-toc {
        display: none !important;
    }

    .docs-main {
        margin-left: 0;
        padding: 0;
    }

    .docs-content {
        box-shadow: none;
        max-width: 100%;
    }
}
