/* استایل های صفحه API Demo */

/* متغیرهای رنگ برای تم روشن و تیره */
:root {
    /* Light Mode */
    --body-bg: #f8f9fa;
    --text-color: #333;
    --heading-color: #0a1a35;
    --sidebar-bg: #ffffff;
    --sidebar-link-color: #666;
    --sidebar-link-hover-bg: rgba(0, 102, 204, 0.05);
    --sidebar-link-hover-color: #0066CC;
    --sidebar-link-active-bg: rgba(0, 102, 204, 0.1);
    --sidebar-link-active-color: #0066CC;
    --sidebar-heading-color: #0a1a35;
    --section-bg: #ffffff;
    --section-border-color: #e9ecef;
    --card-bg: #ffffff;
    --card-border-color: #e9ecef;
    --table-header-bg: #f8f9fa;
    --table-border-color: #e9ecef;
    --code-bg: #f4f4f4; /* Default light mode code background */    --code-text: #333;
    --border-color: #ddd;
    --input-bg: #ffffff;
    --input-border: #ced4da;
    --input-group-text-bg: #f8f9fa;
    --input-group-text-color: #666;
    --alert-info-bg: #d1ecf1;
    --alert-info-color: #0c5460;
    --alert-warning-bg: #fff3cd;
    --alert-warning-color: #856404;
    --button-outline-primary-color: #0066CC;
    --button-outline-primary-border: #0066CC;
    --button-outline-primary-hover-bg: #0066CC;
    --button-outline-primary-hover-color: #ffffff;
    --button-outline-secondary-color: #6c757d;
    --button-outline-secondary-border: #6c757d;
    --button-outline-secondary-hover-bg: #6c757d;
    --button-outline-secondary-hover-color: #ffffff;
    --badge-secondary-bg: #6c757d;
    --badge-secondary-color: #ffffff;
     --flowchart-bg: #e9ecef;
}

/* Dark Mode */
body.dark-mode {    --body-bg: #1e1e1e;
    --text-color: #cccccc;
    --heading-color: #ffffff;
    --sidebar-bg: #252526;
    --sidebar-link-color: #cccccc;
    --sidebar-link-hover-bg: rgba(0, 102, 204, 0.2);
    --sidebar-link-hover-color: #4dabf7; /* A lighter blue for dark mode */
    --sidebar-link-active-bg: rgba(0, 102, 204, 0.3);
    --sidebar-link-active-color: #4dabf7;
    --sidebar-heading-color: #ffffff;
    --section-bg: #2d2d30;
    --section-border-color: #3a3a3d;
    --card-bg: #3c3c3c;
    --card-border-color: #4a4a4a;
    --table-header-bg: #3a3a3d;
    --table-border-color: #4a4a4a;
    --code-bg: #1a1a1a; /* Dark mode code background from theme */
    --code-text: #cccccc; /* Should be handled by highlight.js theme */
    --border-color: #4a4a4a;
    --input-bg: #3c3c3c;
    --input-border: #4a4a4a;
    --input-group-text-bg: #2d2d30;
    --input-group-text-color: #cccccc;
     --alert-info-bg: #1a3a4a; /* Darker info */
    --alert-info-color: #7ac1d3;
    --alert-warning-bg: #4a3a1a; /* Darker warning */
    --alert-warning-color: #d3c17a;
     --button-outline-primary-color: #4dabf7;
    --button-outline-primary-border: #4dabf7;
    --button-outline-primary-hover-bg: #4dabf7;
    --button-outline-primary-hover-color: #ffffff;
     --button-outline-secondary-color: #b0b0b0;
    --button-outline-secondary-border: #b0b0b0;
    --button-outline-secondary-hover-bg: #b0b0b0;
    --button-outline-secondary-hover-color: #1e1e1e;
    --badge-secondary-bg: #b0b0b0;
    --badge-secondary-color: #1e1e1e;
    --flowchart-bg: #3a3a3d;
}


body {
    background-color: var(--body-bg);
    color: var(--text-color);
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--heading-color);
}

/* API Container Layout */
.api-container {
    display: flex;
    width: 100%;
    min-height: calc(100vh - 70px); /* Adjust based on header height */
}

/* Sidebar */
.api-sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
    position: fixed;
    top: 70px; /* Height of the sticky header */
    right: 0;
    bottom: 0;
    z-index: 100;
    transition: all 0.3s ease;
    overflow-y: auto;
    padding: 20px 0;
}

.api-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.api-nav-item {
    margin-bottom: 5px;
}

.api-nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--sidebar-link-color);
    text-decoration: none;    transition: all 0.3s ease;
    border-right: 3px solid transparent;
    font-size: 15px;
}

.api-nav-link i {
    margin-left: 15px;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.api-nav-link:hover {
    background-color: var(--sidebar-link-hover-bg);
    color: var(--sidebar-link-hover-color);
}

.api-nav-link.active {
    background-color: var(--sidebar-link-active-bg);
    color: var(--sidebar-link-active-color);
    border-right-color: var(--sidebar-link-active-color);
    font-weight: 600;
}

.api-nav-heading {
    display: flex;
    align-items: center;
    padding: 15px 20px 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--sidebar-heading-color);
    text-transform: uppercase;
}

.api-nav-heading i {
     margin-left: 10px;
     font-size: 14px;
     width: 20px;
     text-align: center;
}

.api-nav-submenu {
    list-style: none;
    padding: 0 0 0 20px;
    margin: 0;
}

.api-nav-submenu li a {
    padding: 8px 20px;
    font-size: 14px;}


/* Main Content */
.api-main-content {
    margin-right: 280px; /* Width of the sidebar */
    padding: 30px;
    width: calc(100% - 280px);
    transition: all 0.3s ease;
}

.api-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 10px;
}

.api-subtitle {
    font-size: 18px;
    color: var(--text-color);
    margin-bottom: 20px;
}

.api-section {
    margin-bottom: 50px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--section-border-color);
}

.api-section:last-child {
    border-bottom: none;
    margin-bottom: 30px;
}

.api-section-heading {
    font-size: 24px;
    font-weight: 700;
    margin: 30px 0 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--section-border-color);
}

.api-subsection-heading {
    font-size: 20px;
    font-weight: 600;
    margin: 25px 0 15px;
    color: var(--heading-color);
}

/* Flowchart Placeholder */
.api-flowchart {
    background-color: var(--flowchart-bg);
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    text-align: center;
}
.api-flowchart img {
    max-width: 100%;
    height: auto;
}


/* Code Blocks */
.api-code-block-wrapper {
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    background-color: var(--code-bg);
}

.api-code-header {
    background-color: rgba(0, 0, 0, 0.1); /* Slightly darker header */
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-color);
}

.api-code-block-wrapper pre {
    margin: 0;    padding: 15px;
    overflow-x: auto;
    background-color: transparent; /* Use parent wrapper background */
    color: var(--code-text); /* Fallback color, highlight.js will override */
    font-size: 13px;
    line-height: 1.5;
}

.api-code-block-wrapper code {
     /* Highlight.js styles will handle most of this */
     font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
     background: none !important; /* Prevent highlight.js setting its own bg */
     color: inherit !important; /* Inherit color from pre */
     padding: 0 !important;
}


.copy-code-btn {
    font-size: 12px;
    padding: 4px 8px;
}

/* Code Tabs */
.api-code-tabs {
    margin-bottom: 20px;
}

.api-code-tabs .tab-header {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 15px;
}

.api-code-tabs .tab-item {
    background: none;
    border: none;
    padding: 10px 15px;
    font-size: 14px;
    font-weight: 500;
    color: var(--sidebar-link-color);
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px; /* To overlap with the border */
}

.api-code-tabs .tab-item.active {
    color: var(--sidebar-link-active-color);
    border-bottom-color: var(--sidebar-link-active-color);
    font-weight: 600;
}.api-code-tabs .tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.api-code-tabs .tab-pane.active {
    display: block;}

/* Parameters Table */
.api-params-table {
    width: 100%;
    margin-top: 20px;
    margin-bottom: 20px;
    border-collapse: collapse;
     border: 1px solid var(--table-border-color);
     border-radius: 6px;
     overflow: hidden;
}

.api-params-table th,
.api-params-table td {
    padding: 12px 15px;
    border: 1px solid var(--table-border-color);
    text-align: right;
    font-size: 14px;
    color: var(--text-color);
}

.api-params-table th {
    background-color: var(--table-header-bg);
    font-weight: 600;
    color: var(--heading-color);
}

.api-params-table tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.02); /* Subtle stripe */
}

/* Interactive Console */
.api-console {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border-color);
    border-radius: 8px;
    padding: 20px;
    margin-top: 30px;
}

.api-console-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--heading-color);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.api-console-form .form-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 5px;
}

.api-console-form .form-control,
.api-console-form .form-select {
     background-color: var(--input-bg);
     border-color: var(--input-border);
     color: var(--text-color);
     font-size: 14px;
}

.api-console-form .form-control:focus,
.api-console-form .form-select:focus {
    border-color: var(--sidebar-link-active-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 102, 204, 0.25);
}

.api-console-form .input-group-text {
    background-color: var(--input-group-text-bg);
    border-color: var(--input-border);
    color: var(--input-group-text-color);
}


.api-console-response {
    margin-top: 20px;
}

.api-console-response .response-status {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;}

.api-console-response pre {
    background-color: var(--code-bg);
    border-radius: 6px;
    padding: 15px;
    overflow-x: auto;    font-size: 13px;
    line-height: 1.5;
}

/* Alerts */
.alert {
    display: flex;
    align-items: flex-start;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert i {
    margin-left: 10px;
    font-size: 18px;
    margin-top: 2px;
}

.alert-info {
    background-color: var(--alert-info-bg);
    color: var(--alert-info-color);
    border-color: rgba(0, 102, 204, 0.3); /* Border slightly darker */
}

.alert-warning {
     background-color: var(--alert-warning-bg);
    color: var(--alert-warning-color);
    border-color: rgba(255, 107, 0, 0.3); /* Border slightly darker */
}


/* SDK Links */
.api-sdk-links {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
}

.api-sdk-links .btn {
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    padding: 8px 15px;
}

.api-sdk-links .btn i {
    margin-left: 8px;
}

.btn-outline-primary {
     color: var(--button-outline-primary-color);
    border-color: var(--button-outline-primary-border);
}
.btn-outline-primary:hover {
     background-color: var(--button-outline-primary-hover-bg);
     color: var(--button-outline-primary-hover-color);
     border-color: var(--button-outline-primary-hover-bg); /* Match hover background */
}

.btn-outline-secondary {     color: var(--button-outline-secondary-color);
    border-color: var(--button-outline-secondary-border);
}
.btn-outline-secondary:hover {
     background-color: var(--button-outline-secondary-hover-bg);
     color: var(--button-outline-secondary-hover-color);
     border-color: var(--button-outline-secondary-hover-bg); /* Match hover background */
}


/* Sidebar Toggle Button (Mobile) */
.api-sidebar-toggle {
    display: none; /* Hidden by default */
    position: fixed;
    top: 80px; /* Below header */
    right: 15px;
    background-color: #0066CC;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 101; /* Above sidebar when collapsed */
    box-shadow: 0 2px 10px rgba(0, 102, 204, 0.3);
    cursor: pointer;
    transition: right 0.3s ease;
}/* Theme Toggle Button */
.theme-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--sidebar-bg); /* Match sidebar background */
    color: var(--text-color);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    z-index: 102; /* Above sidebar toggle */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

body.dark-mode .theme-toggle-btn i.fa-sun {
    display: none;
}

body:not(.dark-mode) .theme-toggle-btn i.fa-moon {
    display: none;
}


/* Responsive */
@media (max-width: 992px) {
    .api-sidebar {
        width: 250px;
        right: -250px; /* Hide sidebar initially */
        top: 60px; /* Adjust for smaller header */
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }

    .api-sidebar.active {
        right: 0; /* Show sidebar */
    }

    .api-main-content {
        margin-right: 0;
        width: 100%;
        padding: 20px;
    }

    .api-sidebar-toggle {
         display: flex; /* Show toggle button */
         top: 15px; /* Position in header area */
         right: 15px;
         z-index: 1001; /* Above mobile menu toggle */
    }

     /* Hide mobile menu toggle on API page when sidebar toggle is visible */
    .api-sidebar-toggle + .mobile-menu-toggle {
         display: none;
    }

     /* Adjust main nav position when sidebar is active */
    .api-sidebar.active + .api-main-content {
        /* No margin needed as sidebar is fixed and overlays */
    }

     .api-title {
        font-size: 28px;
    }

    .api-subtitle {
        font-size: 16px;
    }

    .api-section-heading {
        font-size: 20px;
    }

     .api-subsection-heading {
        font-size: 18px;
    }

     .api-params-table th,
    .api-params-table td {
        padding: 10px;
        font-size: 13px;
    }

     .api-sdk-links {
        flex-direction: column;
        gap: 10px;
    }

     .api-sdk-links .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .api-sidebar {
        width: 220px;
        right: -220px;
        top: 60px;
    }
     .api-sidebar.active {
        right: 0;
    }
     .api-main-content {
        padding: 15px;
    }

     .api-title {
        font-size: 24px;
    }
     .api-subtitle {
        font-size: 14px;
    }
     .api-section-heading {
        font-size: 18px;
    }
     .api-subsection-heading {
        font-size: 16px;
    }
     .api-console-title {
        font-size: 16px;
    }
     .api-console-form .form-label {
        font-size: 13px;
    }
     .api-console-form .form-control,
    .api-console-form .form-select {
        font-size: 13px;
    }
     .alert {
        font-size: 13px;
    }
     .alert i {
        font-size: 16px;
    }
     .theme-toggle-btn {
        bottom: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

@media (max-width: 576px) {
    .api-sidebar {
        width: 200px;
        right: -200px;
        top: 60px;
    }
     .api-sidebar.active {
        right: 0;    }
     .api-main-content {
        padding: 10px;
    }
     .api-sidebar-toggle {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
     .api-title {
        font-size: 20px;
    }
     .api-subtitle {
        font-size: 12px;
    }
     .api-section-heading {
        font-size: 16px;
    }
     .api-subsection-heading {
        font-size: 15px;
    }
     .api-params-table th,
    .api-params-table td {
        padding: 8px;
        font-size: 12px;
    }
     .api-code-block-wrapper pre,
     .api-console-response pre {
        padding: 10px;
        font-size: 12px;
    }
     .api-console-form .btn {
        width: 100%;
        justify-content: center;
    }
     .theme-toggle-btn {
        bottom: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
}