/* ===== GLOBAL STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --background-box: #ffffffa5;
    /* Default colors - will be overridden by logo colors */
    --primary-color: #128bb1;
    --primary-dark: #0e6a8a;
    --primary-light: #e8f4f8;
    --text-dark: #2c3e50;
    --text-light: #666666;
    --border-color: #d0e8f0;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #ffffff;
    color: var(--text-dark);
    line-height: 1.6;
}

/* Background Logo - Faded */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--logo-url) no-repeat center center;
    background-size: contain;
    opacity: 0.08;
    z-index: 0;
    transform: scale(0.8);
}

.guide-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    gap: 40px;
}

/* ===== NAVIGATION SIDEBAR ===== */
.guide-nav-sidebar {
    width: 240px;
    min-width: 240px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    position: sticky;
    top: 100px;
    height: fit-content;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding: 20px 0;
    margin-top: 100px;
    z-index: 100;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.guide-nav-menu {
    list-style: none;
}

.guide-nav-item {
    margin: 0;
}

.guide-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    background: transparent;
    border: none;
    width: 100%;
}

.guide-nav-link:hover {
    background: var(--primary-light);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

.guide-nav-link.guide-active {
    background: var(--primary-light);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

.guide-nav-title {
    flex: 1;
    text-align: left;
    cursor: pointer;
}

.guide-nav-title:hover {
    color: var(--primary-color);
}

.guide-nav-arrow {
    font-size: 1.1rem;
    transition: transform var(--transition);
    color: var(--text-light);
    cursor: pointer;
    padding: 0 5px;
}

.guide-nav-arrow:hover {
    color: var(--primary-color);
}

.guide-nav-link.guide-expanded .guide-nav-arrow {
    transform: rotate(90deg);
}

.guide-nav-submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition);
    background: #ffffff;
}

.guide-nav-submenu.guide-show {
    max-height: 500px;
}

.guide-nav-subitem {
    margin: 0;
}

.guide-nav-sublink {
    display: block;
    padding: 8px 15px 8px 30px;
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.8rem;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.guide-nav-sublink:hover {
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    background: rgba(18, 139, 177, 0.05);
}

.guide-nav-sublink.guide-active {
    color: var(--primary-color);
    font-weight: 600;
    border-left-color: var(--primary-color);
    background: rgba(18, 139, 177, 0.1);
}

/* ===== MAIN CONTENT AREA ===== */
.guide-header {
    background: transparent;
    padding: 20px 40px;
    top: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.guide-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

.guide-hamburger span {
    width: 24px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px;
    transition: var(--transition);
}

.guide-hamburger.guide-open span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.guide-hamburger.guide-open span:nth-child(2) {
    opacity: 0;
}

.guide-hamburger.guide-open span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.guide-header h1 {
    color: var(--primary-color);
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.5px;
}

.guide-main-content {
    flex: 1;
    padding: 40px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

/* ===== ERROR STATE ===== */
.error-message {
    background: #fee;
    border: 1px solid #fcc;
    border-left: 4px solid #e74c3c;
    color: #c0392b;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.error-message h2 {
    color: #c0392b;
    margin-bottom: 10px;
}

.error-message p {
    margin-bottom: 8px;
}

/* ===== CONTENT SECTIONS ===== */

.guide-content {
    width: 100%;
}
.guide-content img {
    display: block;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.guide-content img.guide-zoomable-image {
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.guide-content img.guide-zoomable-image:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 3px;
}

.guide-content img.guide-zoomable-image:hover {
    transform: scale(1.01);
    box-shadow: var(--shadow);
}

.guide-image-zoom-open {
    overflow: hidden;
}

.guide-image-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.85);
    z-index: 3000;
    cursor: zoom-out;
}

.guide-image-overlay[hidden] {
    display: none;
}

.guide-image-overlay-content {
    max-width: min(1200px, 100%);
    max-height: 100%;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    cursor: zoom-out;
}

.guide-content-section {
    margin-bottom: 50px;
}

.guide-content-section, .guide-subsection-box {
    scroll-margin-top: 20px;
}

.guide-content-section h2 {
    color: var(--primary-color);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--primary-light);
    letter-spacing: -0.5px;
}

.guide-subsection-title {
    color: var(--primary-dark);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
    letter-spacing: -0.3px;
}

.guide-subsection-box {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--background-box) 100%);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    padding: 25px;
    margin-bottom: 25px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.guide-subsection-box:hover {
    box-shadow: var(--shadow-lg);
    border-left-color: var(--primary-dark);
}

.guide-subsection-box h4 {
    color: var(--primary-color);
    font-size: 1rem;
    margin: 15px 0 10px 0;
    font-weight: 600;
}

.guide-subsection-box p {
    color: var(--text-dark);
    margin-bottom: 12px;
}

.guide-subsection-box ul,
.guide-subsection-box ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.guide-subsection-box li {
    margin-bottom: 8px;
    color: var(--text-dark);
}

.guide-subsection-box a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

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

.guide-table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.guide-subsection-box table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    margin: 20px 0;
    border: 1px solid rgba(18, 139, 177, 0.2);
    border-radius: 6px;
    overflow: hidden;
}

.guide-subsection-box table.guide-table-fit {
    table-layout: fixed;
}

.guide-subsection-box table.guide-table-fit th,
.guide-subsection-box table.guide-table-fit td {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
}

.guide-subsection-box table.guide-table-wide {
    min-width: 640px;
}

.guide-subsection-box table th {
    background: var(--primary-color);
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

.guide-subsection-box table td {
    padding: 12px;
    border-bottom: 1px solid rgba(18, 139, 177, 0.15);
    color: var(--text-dark);
}

.guide-subsection-box table tr:last-child td {
    border-bottom: none;
}

.guide-subsection-box table tr:nth-child(even) {
    background: rgba(18, 139, 177, 0.05);
}

.guide-subsection-box blockquote {
    border-left: 4px solid var(--primary-color);
    padding: 15px 20px;
    margin: 20px 0;
    background: rgba(18, 139, 177, 0.08);
    border-radius: 4px 8px 8px 4px;
    font-style: italic;
    color: var(--text-dark);
}

.guide-subsection-box blockquote p {
    margin-bottom: 0;
}

.guide-subsection-box strong {
    color: var(--primary-dark);
    font-weight: 600;
}

/* ===== SCROLLBAR STYLING ===== */
.guide-nav-sidebar::-webkit-scrollbar {
    width: 6px;
}

.guide-nav-sidebar::-webkit-scrollbar-track {
    background: var(--primary-light);
}

.guide-nav-sidebar::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.92);
    z-index: 2000;
    transition: opacity 0.28s ease, visibility 0.28s ease;
}

.loading-overlay .loading-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px 22px;
    border-radius: 10px;
    background: rgba(255,255,255,0.98);
    box-shadow: var(--shadow-lg);
}

.spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 5px solid rgba(0,0,0,0.08);
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

.loading-text {
    color: var(--text-dark);
    font-weight: 600;
    font-size: 0.95rem;
}

.loading-overlay.loaded {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.guide-nav-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .guide-wrapper {
        padding: 0 20px;
        gap: 20px;
    }

    .guide-nav-sidebar {
        width: 200px;
        min-width: 200px;
    }

    .guide-main-content {
        padding: 30px;
    }

    .guide-header {
        padding: 15px 30px;
    }

    .guide-header h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    .guide-wrapper {
        flex-direction: column;
        padding: 0;
    }

    .guide-hamburger {
        display: flex;
    }

    .guide-content-section,
    .guide-subsection-box {
        scroll-margin-top: 120px;
    }

    .guide-nav-sidebar {
        width: 280px;
        min-width: 280px;
        max-width: 80%;
        position: fixed;
        left: 0;
        top: 56px;
        height: calc(100vh - 56px);
        max-height: calc(100vh - 56px);
        margin-top: 0;
        border-radius: 0;
        transform: translateX(-100%);
        box-shadow: none;
        border: none;
        padding-top: 40px;
    }

    .guide-nav-sidebar.guide-open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .guide-main-content {
        padding: 20px;
    }

    .guide-header {
        position: sticky;
        top: 0;
        background: #ffffff;
        z-index: 100;
        padding: 15px 20px;
        box-shadow: var(--shadow);
    }

    .guide-hamburger {
        position: static;
    }

    .guide-header h1 {
        font-size: 1.3rem;
    }

    .guide-content-section h2 {
        font-size: 1.5rem;
    }

    .guide-subsection-title {
        font-size: 1.2rem;
    }

    .guide-subsection-box {
        padding: 20px;
    }

    .guide-subsection-box table {
        font-size: 0.92rem;
    }

    .guide-subsection-box table.guide-table-fit {
        font-size: 0.84rem;
    }

    .guide-subsection-box table.guide-table-fit th,
    .guide-subsection-box table.guide-table-fit td {
        padding: 7px;
        line-height: 1.35;
    }

    body::before {
        display: none;
    }
}

@media (max-width: 480px) {
    .guide-header {
        gap: 10px;
    }

    .guide-header h1 {
        font-size: 1.1rem;
    }

    .guide-main-content {
        padding: 15px;
    }

    .guide-content-section h2 {
        font-size: 1.3rem;
    }

    .guide-subsection-box {
        padding: 15px;
        border-left-width: 3px;
    }

    .guide-subsection-box table {
        font-size: 0.9rem;
    }

    .guide-subsection-box table th,
    .guide-subsection-box table td {
        padding: 8px;
    }

    .guide-subsection-box table.guide-table-fit {
        font-size: 0.8rem;
    }

    .guide-subsection-box table.guide-table-fit th,
    .guide-subsection-box table.guide-table-fit td {
        padding: 6px;
    }
}
