/* Custom styles for MyApp */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}

/* Responsive container with max-width on large screens */
.container-responsive {
    width: 100%;
    padding-right: var(--bs-gutter-x, 0.75rem);
    padding-left: var(--bs-gutter-x, 0.75rem);
    margin-right: auto;
    margin-left: auto;
}

/* Navbar container that matches main content width */
.navbar-container-constrained {
    width: 100%;
    padding-right: var(--bs-gutter-x, 0.75rem);
    padding-left: var(--bs-gutter-x, 0.75rem);
    margin-right: auto;
    margin-left: auto;
}

/* Small screens (mobile): full width */
@media (max-width: 575.98px) {
    .navbar-container-constrained {
        max-width: none;
        padding-right: 1rem;
        padding-left: 1rem;
    }
}

/* Medium screens (tablets): full width */
@media (min-width: 576px) and (max-width: 991.98px) {
    .navbar-container-constrained {
        max-width: none;
        padding-right: 1.5rem;
        padding-left: 1.5rem;
    }
}

/* Large screens (desktops): constrained width */
@media (min-width: 992px) {
    .navbar-container-constrained {
        max-width: 1200px;
    }
}

/* Extra large screens: slightly larger max-width */
@media (min-width: 1400px) {
    .navbar-container-constrained {
        max-width: 1320px;
    }
}



/* Small screens (mobile): full width */
@media (max-width: 575.98px) {
    .container-responsive {
        max-width: none;
        padding-right: 1rem;
        padding-left: 1rem;
    }
}

/* Medium screens (tablets): full width */
@media (min-width: 576px) and (max-width: 991.98px) {
    .container-responsive {
        max-width: none;
        padding-right: 1.5rem;
        padding-left: 1.5rem;
    }
}

/* Large screens (desktops): constrained width */
@media (min-width: 992px) {
    .container-responsive {
        max-width: 1200px;
    }
}

/* Extra large screens: slightly larger max-width */
@media (min-width: 1400px) {
    .container-responsive {
        max-width: 1320px;
    }
}

/* Responsive improvements */
@media (max-width: 767.98px) {
    /* Mobile-specific adjustments */
    .card {
        margin-bottom: 1rem;
    }

    .btn-toolbar {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn-toolbar .btn-group,
    .btn-toolbar .btn {
        width: 100%;
    }

    /* Enhanced table mobile improvements */
    .table-responsive {
        border: none;
    }

    .pagination {
        justify-content: center !important;
        flex-wrap: wrap;
    }

    .pagination .page-item {
        margin: 0.125rem;
    }

    /* Stack form controls on mobile */
    .row.mb-3 .col-md-6 {
        margin-bottom: 0.75rem;
    }

    /* Adjust navbar spacing on mobile */
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    /* Tablet-specific adjustments */
    .container-responsive {
        padding-right: 2rem;
        padding-left: 2rem;
    }
}

/* Ensure tables are always responsive */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* Enhanced table responsive improvements */
@media (max-width: 767.98px) {
    /* Stack table controls vertically on mobile */
    .enhanced-table-controls {
        flex-direction: column;
        gap: 1rem;
    }

    .enhanced-table-controls .row {
        margin: 0;
    }

    .enhanced-table-controls .col-md-6 {
        padding: 0;
        margin-bottom: 0.75rem;
    }

    /* Make search input full width on mobile */
    .enhanced-table-controls .input-group {
        width: 100%;
    }

    /* Improve pagination on mobile */
    .pagination {
        font-size: 0.875rem;
    }

    .pagination .page-link {
        padding: 0.375rem 0.5rem;
    }

    /* Hide less important table columns on mobile */
    .table-mobile-hide {
        display: none;
    }

    /* Improve table action buttons on mobile */
    .btn-group-sm .btn {
        padding: 0.25rem 0.375rem;
        font-size: 0.75rem;
    }
}

@media (min-width: 768px) {
    .table-mobile-hide {
        display: table-cell;
    }
}

/* Improve card spacing on all screen sizes */
.card + .card {
    margin-top: 1.5rem;
}

/* Better button group spacing */
.btn-group + .btn-group,
.btn + .btn-group,
.btn-group + .btn {
    margin-left: 0.5rem;
}

@media (max-width: 575.98px) {
    .btn-group + .btn-group,
    .btn + .btn-group,
    .btn-group + .btn {
        margin-left: 0;
        margin-top: 0.5rem;
    }
}

.navbar-brand {
    font-weight: bold;
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.progress {
    height: 1rem;
}

.btn {
    border-radius: 0.375rem;
}

.table {
    background-color: white;
}

.breadcrumb {
    background-color: transparent;
    padding: 0;
}

/* Markdown Content Styles */
.markdown-content {
    line-height: 1.6;
    color: #333;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    line-height: 1.25;
}

.markdown-content h1 {
    font-size: 2rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.3rem;
}

.markdown-content h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 0.3rem;
}

.markdown-content h3 {
    font-size: 1.25rem;
}

.markdown-content h4 {
    font-size: 1rem;
}

.markdown-content h5 {
    font-size: 0.875rem;
}

.markdown-content h6 {
    font-size: 0.85rem;
    color: #6c757d;
}

.markdown-content p {
    margin-bottom: 1rem;
}

.markdown-content blockquote {
    padding: 0 1rem;
    margin: 0 0 1rem 0;
    color: #6c757d;
    border-left: 0.25rem solid #dee2e6;
}

.markdown-content blockquote p:last-child {
    margin-bottom: 0;
}

.markdown-content code {
    padding: 0.2rem 0.4rem;
    margin: 0;
    font-size: 85%;
    background-color: rgba(175, 184, 193, 0.2);
    border-radius: 6px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.markdown-content pre {
    padding: 1rem;
    overflow: auto;
    font-size: 85%;
    line-height: 1.45;
    background-color: #f6f8fa;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.markdown-content pre code {
    padding: 0;
    margin: 0;
    font-size: 100%;
    background-color: transparent;
    border-radius: 0;
}

.markdown-content table {
    border-spacing: 0;
    border-collapse: collapse;
    margin-bottom: 1rem;
    width: 100%;
}

.markdown-content table th,
.markdown-content table td {
    padding: 6px 13px;
    border: 1px solid #dee2e6;
}

.markdown-content table th {
    font-weight: 600;
    background-color: #f6f8fa;
}

.markdown-content table tr:nth-child(2n) {
    background-color: #f6f8fa;
}

.markdown-content ul,
.markdown-content ol {
    padding-left: 2rem;
    margin-bottom: 1rem;
}

.markdown-content li {
    margin-bottom: 0.25rem;
}

.markdown-content li > p {
    margin-bottom: 0.5rem;
}

.markdown-content hr {
    height: 0.25rem;
    padding: 0;
    margin: 1.5rem 0;
    background-color: #e1e4e8;
    border: 0;
}

.markdown-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}

.markdown-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 0.5rem 0;
}

/* Table of Contents */
.markdown-content .toc {
    background-color: #f6f8fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.markdown-content .toc ul {
    list-style: none;
    padding-left: 1rem;
    margin-bottom: 0;
}

.markdown-content .toc > ul {
    padding-left: 0;
}

.markdown-content .toc li {
    margin-bottom: 0.25rem;
}

.markdown-content .toc a {
    color: #495057;
    text-decoration: none;
}

.markdown-content .toc a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Header links */
.markdown-content .headerlink {
    color: #dee2e6;
    font-size: 0.8em;
    margin-left: 0.5rem;
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.markdown-content h1:hover .headerlink,
.markdown-content h2:hover .headerlink,
.markdown-content h3:hover .headerlink,
.markdown-content h4:hover .headerlink,
.markdown-content h5:hover .headerlink,
.markdown-content h6:hover .headerlink {
    opacity: 1;
}

.markdown-content .headerlink:hover {
    color: var(--primary-color);
}

/* Admonitions */
.markdown-content .admonition {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 6px;
    border-left: 4px solid;
}

.markdown-content .admonition-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.markdown-content .admonition.note {
    background-color: #e7f3ff;
    border-left-color: var(--info-color);
    color: #0c5460;
}

.markdown-content .admonition.tip {
    background-color: #d1e7dd;
    border-left-color: var(--success-color);
    color: #0a3622;
}

.markdown-content .admonition.warning {
    background-color: #fff3cd;
    border-left-color: var(--warning-color);
    color: #664d03;
}

.markdown-content .admonition.danger {
    background-color: #f8d7da;
    border-left-color: var(--danger-color);
    color: #58151c;
}

/* Syntax highlighting */
.markdown-content .highlight {
    background-color: #f6f8fa;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    overflow-x: auto;
}

.markdown-content .highlight pre {
    background-color: transparent;
    padding: 0;
    margin: 0;
    border-radius: 0;
}

/* Footnotes */
.markdown-content .footnote {
    font-size: 0.9em;
    color: #6c757d;
}

.markdown-content .footnote-ref {
    text-decoration: none;
    font-weight: bold;
}

.markdown-content .footnote-backref {
    text-decoration: none;
    font-weight: bold;
}

/* Definition lists */
.markdown-content dl {
    margin-bottom: 1rem;
}

.markdown-content dt {
    font-weight: 600;
    margin-top: 1rem;
}

.markdown-content dd {
    margin-left: 2rem;
    margin-bottom: 0.5rem;
}

/* Abbreviations */
.markdown-content abbr[title] {
    border-bottom: 1px dotted #6c757d;
    cursor: help;
    text-decoration: none;
}

/* Code Highlighting Component Styles */
.code-highlight {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
    position: relative;
}

.code-header {
    background-color: #e9ecef;
    border-bottom: 1px solid #dee2e6;
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.code-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.code-title {
    font-weight: 600;
    color: #495057;
}

.code-filename {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.code-filename i {
    color: #007bff;
}

.code-actions {
    display: flex;
    gap: 0.25rem;
}

.copy-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    line-height: 1;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    transform: translateY(-1px);
}

.code-content {
    position: relative;
}

.code-highlight .highlight {
    margin: 0;
    background-color: transparent;
    border-radius: 0;
    padding: 1rem;
}

.code-highlight .highlight pre {
    margin: 0;
    background-color: transparent;
    border: none;
    padding: 0;
    font-size: 0.875rem;
    line-height: 1.5;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    overflow-x: auto;
}

.code-highlight .highlight code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

/* Line numbers styling */
.code-highlight .highlight .linenos {
    background-color: #f1f3f4;
    color: #6c757d;
    padding-right: 1rem;
    text-align: right;
    user-select: none;
    border-right: 1px solid #dee2e6;
}

.code-highlight .highlight .linenos pre {
    padding: 1rem 0.5rem;
    margin: 0;
}

/* Highlighted lines */
.code-highlight .highlight .hll {
    background-color: #fff3cd;
    display: block;
    margin: 0 -1rem;
    padding: 0 1rem;
}

/* Language-specific styling */
.code-highlight[data-language="python"] .code-header {
    background: linear-gradient(135deg, #3776ab 0%, #4b8bbe 100%);
    color: white;
}

.code-highlight[data-language="javascript"] .code-header {
    background: linear-gradient(135deg, #f7df1e 0%, #f0db4f 100%);
    color: #323330;
}

.code-highlight[data-language="html"] .code-header {
    background: linear-gradient(135deg, #e34c26 0%, #f06529 100%);
    color: white;
}

.code-highlight[data-language="css"] .code-header {
    background: linear-gradient(135deg, #1572b6 0%, #33a9dc 100%);
    color: white;
}

.code-highlight[data-language="json"] .code-header {
    background: linear-gradient(135deg, #000000 0%, #434343 100%);
    color: white;
}

.code-highlight[data-language="sql"] .code-header {
    background: linear-gradient(135deg, #336791 0%, #4e79a7 100%);
    color: white;
}

.code-highlight[data-language="bash"] .code-header {
    background: linear-gradient(135deg, #4eaa25 0%, #6cc04a 100%);
    color: white;
}

/* Responsive design */
@media (max-width: 768px) {
    .code-highlight .highlight pre {
        font-size: 0.75rem;
    }

    .code-header {
        padding: 0.375rem 0.75rem;
        font-size: 0.8125rem;
    }

    .copy-btn {
        padding: 0.1875rem 0.375rem;
        font-size: 0.6875rem;
    }
}

/* Dark mode support (if implemented) */
@media (prefers-color-scheme: dark) {
    .code-highlight {
        background-color: #1e1e1e;
        border-color: #404040;
    }

    .code-header {
        background-color: #2d2d2d;
        border-bottom-color: #404040;
        color: #e0e0e0;
    }

    .code-filename {
        color: #b0b0b0;
    }

    .code-title {
        color: #e0e0e0;
    }

    .code-highlight .highlight .linenos {
        background-color: #2a2a2a;
        color: #888;
        border-right-color: #404040;
    }

    .code-highlight .highlight .hll {
        background-color: #3a3a00;
    }
}

/* Scrollbar styling for code blocks */
.code-highlight .highlight pre::-webkit-scrollbar {
    height: 8px;
}

.code-highlight .highlight pre::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.code-highlight .highlight pre::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.code-highlight .highlight pre::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Animation for copy button feedback */
.copy-btn.btn-success {
    animation: copySuccess 0.3s ease;
}

@keyframes copySuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

footer {
    margin-top: auto;
}

/* Search highlighting styles */
.search-highlight {
    background-color: #fff3cd;
    color: #856404;
    padding: 0.1em 0.2em;
    border-radius: 0.25rem;
    font-weight: 500;
}

/* Search result cards */
.search-result-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.search-result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.12);
}

.search-result-card .card-title a {
    color: #0d6efd;
    text-decoration: none;
}

.search-result-card .card-title a:hover {
    color: #0a58ca;
    text-decoration: underline;
}

/* Search form in navbar */
.navbar .form-control {
    border-radius: 0.375rem;
}

.navbar .btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Custom utilities */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.shadow-sm-hover:hover {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .chart-container {
        height: 250px;
    }

    /* Responsive search form */
    .navbar .d-flex {
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
    }

    .navbar .form-control {
        width: 100% !important;
        margin-bottom: 0.5rem;
    }
}
