/* ============================================
   SDC4 Reference Model Documentation Styles
   Modern CSS for schema documentation wrapper
   ============================================ */

/* Import existing schema styles */
@import url('docHtml.css');

/* Base Variables */
:root {
    --sdc-deep-blue: #0a2342;
    --sdc-teal: #2ca58d;
    --sdc-gold: #f0a500;
    --sdc-light-blue: #8db9d9;
    --sdc-off-white: #f7f9fb;
    --sdc-gray: #e1e6ea;
    --sdc-dark-gray: #333333;
}

/* Global Styles */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--sdc-off-white);
    color: var(--sdc-dark-gray);
    margin: 0;
    padding: 0;
}

/* Dropdown Navigation Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.dropdown-toggle svg {
    width: 1rem;
    height: 1rem;
    transition: transform 0.2s ease;
}

.dropdown:hover .dropdown-toggle svg,
.dropdown.active .dropdown-toggle svg {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    min-width: 200px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 100;
    margin-top: 0.5rem;
}

.dropdown:hover .dropdown-menu,
.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1.25rem;
    color: var(--sdc-deep-blue);
    text-decoration: none;
    transition: background-color 0.2s ease;
    border-left: 3px solid transparent;
}

.dropdown-menu a:hover {
    background-color: var(--sdc-off-white);
    border-left-color: var(--sdc-teal);
}

.dropdown-menu a:first-child {
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
}

.dropdown-menu a:last-child {
    border-bottom-left-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
}

/* Mobile dropdown styles */
.mobile-dropdown-content {
    display: none;
    padding-left: 1rem;
    margin-top: 0.5rem;
}

.mobile-dropdown-content.active {
    display: block;
}

.mobile-dropdown-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.mobile-dropdown-toggle svg {
    width: 1rem;
    height: 1rem;
    transition: transform 0.2s ease;
}

.mobile-dropdown-toggle.active svg {
    transform: rotate(180deg);
}

/* Sidebar Styles */
#sidebar {
    background: white;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
}

#sidebar h2 {
    color: var(--sdc-deep-blue);
}

/* Search Box */
#schema-search {
    font-family: 'Inter', sans-serif;
}

#schema-search:focus {
    ring-color: var(--sdc-teal);
    border-color: var(--sdc-teal);
}

/* Schema Navigation Tree */
#schema-nav a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--sdc-dark-gray);
    text-decoration: none;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

#schema-nav a:hover {
    background-color: var(--sdc-off-white);
    color: var(--sdc-teal);
}

#schema-nav a.active {
    background-color: #e8f5f2;
    color: var(--sdc-teal);
    font-weight: 600;
    border-left: 3px solid var(--sdc-teal);
}

/* Schema Nav Groups */
.schema-group-title {
    font-weight: 700;
    color: var(--sdc-deep-blue);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    padding: 0 0.75rem;
}

.schema-group-title:first-child {
    margin-top: 0;
}

/* Mobile Sidebar */
@media (max-width: 768px) {
    #sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        width: 80%;
        max-width: 320px;
        z-index: 50;
        transition: left 0.3s ease;
        overflow-y: auto;
    }

    #sidebar.mobile-open {
        left: 0;
    }

    /* Overlay when sidebar is open */
    body.sidebar-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 40;
    }
}

/* Content Area */
#content-area {
    background: white;
}

#schema-frame {
    width: 100%;
    min-height: calc(100vh - 16rem);
    border: none;
}

/* Iframe Content Styling Overrides */
#schema-frame {
    /* Ensure iframe content uses Inter font */
    font-family: 'Inter', sans-serif !important;
}

/* Back to Top Button */
#back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--sdc-teal);
    color: white;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(44, 165, 141, 0.4);
    transition: all 0.3s ease;
    z-index: 30;
}

#back-to-top:hover {
    background-color: #248a73;
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(44, 165, 141, 0.5);
}

#back-to-top.visible {
    display: flex;
}

/* Loading State */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.loading-spinner {
    border: 3px solid var(--sdc-gray);
    border-top: 3px solid var(--sdc-teal);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 1024px) {
    #content-area {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    #content-area {
        padding: 1rem;
    }

    #sidebar-toggle {
        display: flex;
    }
}

/* Print Styles */
@media print {
    header,
    footer,
    #sidebar,
    #sidebar-toggle,
    #back-to-top {
        display: none !important;
    }

    #content-area {
        padding: 0;
    }

    #schema-frame {
        border: none;
    }
}

/* Accessibility Improvements */
.focus-visible:focus {
    outline: 2px solid var(--sdc-teal);
    outline-offset: 2px;
}

/* Skip to Content Link */
.skip-to-content {
    position: absolute;
    left: -9999px;
    z-index: 999;
    padding: 1rem;
    background-color: var(--sdc-deep-blue);
    color: white;
    text-decoration: none;
}

.skip-to-content:focus {
    left: 50%;
    transform: translateX(-50%);
    top: 1rem;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Enhanced Table Styles (for schema documentation) */
#schema-frame table {
    font-family: 'Inter', sans-serif;
}

/* Code Block Improvements */
#schema-frame pre,
#schema-frame code {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
}

#schema-frame pre {
    background-color: #f8f9fa;
    border: 1px solid var(--sdc-gray);
    border-radius: 0.375rem;
    padding: 1rem;
    overflow-x: auto;
}

/* Syntax Highlighting for XML */
.tEl { color: #000096; } /* Element tags */
.tAN { color: #F5844C; } /* Attribute names */
.tAV { color: #993300; } /* Attribute values */
.tC { color: #006400; } /* Comments */
.qname { color: #000096; } /* Qualified names */

/* Improve Link Styles */
a {
    color: var(--sdc-teal);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #248a73;
    text-decoration: underline;
}

/* Badge/Pill Styles */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-required {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-optional {
    background-color: #e0e7ff;
    color: #3730a3;
}

.badge-deprecated {
    background-color: #fef3c7;
    color: #92400e;
}
