/* 
 * BIM-Watson Documentation Portal Style
 * Two-Column Layout with Fixed Sidebar
 */

/* ===== CSS Variables ===== */
:root {
    --sidebar-width: 250px;
    --sidebar-bg: #4a4047;
    --banner-bg: #234d75;
    --content-bg: #f5f5f0;
    --text-color: #333;
    --link-hover: #ffd700;
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Microsoft JhengHei", "微軟正黑體", "Segoe UI", Tahoma, sans-serif;
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-color);
    background-color: var(--content-bg);
}

/* ===== Custom Scrollbar ===== */
*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

*::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) rgba(255, 255, 255, 0.1);
}

/* Sidebar specific scrollbar */
.left-sidebar::-webkit-scrollbar {
    width: 4px;
}

.left-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

.left-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* ===== Left Sidebar (Fixed) ===== */
.left-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    overflow-y: auto;
    z-index: 1000;
}

.logo-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 15px 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 10px;
}

.left-sidebar .logo {
    color: white;
    font-size: 1.3rem;
    font-weight: bold;
    white-space: nowrap;
}

.edit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.edit-btn svg {
    width: 14px;
    height: 14px;
}

.edit-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.sidebar-search {
    width: calc(100% - 30px);
    margin: 0 15px 15px;
    padding: 10px 12px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 4px;
    font-size: 0.9rem;
}

.sidebar-search::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.sidebar-search:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
}

.main-menu {
    list-style: none;
    padding: 0 10px;
}

.main-menu li {
    margin-bottom: 2px;
}

/* Menu Category (Parent-Child) */
.menu-category {
    margin-bottom: 5px;
}

.category-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.08);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.15s ease-out;
    text-align: left;
}

.category-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
}

.toggle-icon {
    font-size: 0.7rem;
    transition: transform 0.2s ease-out;
}

.menu-category.open .toggle-icon {
    transform: rotate(180deg);
}

.main-category-toggle {
    background: rgba(255, 215, 0, 0.15) !important;
    color: #ffd700 !important;
    font-weight: 700 !important;
    border-bottom: 1px solid rgba(255, 215, 0, 0.3) !important;
}

.group-header-item {
    margin-top: 8px;
    padding-left: 0 !important;
}

.category-group-toggle {
    width: 100%;
    text-align: left;
    padding: 6px 12px 6px 12px !important;
    background: transparent !important;
    border: none;
    color: #b8c6db !important;
    font-weight: 600 !important;
    font-size: 0.78rem !important;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.15s ease-out, color 0.15s ease-out;
}

.category-group-toggle:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #e0e8f0 !important;
}

.group-header-item .toggle-icon {
    font-size: 0.65rem;
    transition: transform 0.2s ease-out;
}

.group-header-item.open > .category-group-toggle .toggle-icon {
    transform: rotate(90deg);
}

.group-header-item:not(.open) > .category-group-toggle .toggle-icon {
    transform: rotate(0deg);
}

.group-content {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding-left: 20px;
    margin-top: 4px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.group-header-item.open > .group-content {
    max-height: 500px;
    transition: max-height 0.4s ease-in;
}

.group-content li {
    margin-bottom: 1px;
    opacity: 0;
    transform: translateX(-5px);
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

.group-header-item.open > .group-content li {
    opacity: 1;
    transform: translateX(0);
}

.submenu a {
    padding-left: 18px !important;
    font-size: 0.85rem !important;
    color: #d0dbe6 !important;
}

.submenu a:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
}

.main-menu li.active > a {
    border-left-color: #ffd700 !important;
    background-color: transparent !important;
    font-weight: 600 !important;
    color: #ffd700 !important;
}

.group-header-item.open > .category-group-toggle {
    color: #e0e8f0 !important;
}

.main-menu a {
    display: block;
    padding: 10px 15px;
    color: white;
    text-decoration: none;
    transition: background-color 0.15s ease-out, border-color 0.15s ease-out;
    font-size: 0.95rem;
    border-left: 4px solid transparent;
}

.main-menu a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.main-menu li.active > a {
    border-left-color: var(--link-hover);
    background-color: rgba(255, 215, 0, 0.15);
    font-weight: 600;
}

/* ===== Main Wrapper ===== */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* ===== Hero Banner ===== */
.hero-banner {
    background: var(--banner-bg);
    color: white;
    padding: 40px 30px;
    position: relative;
    border-bottom: 3px solid rgba(255, 255, 255, 0.1);
}

.hero-banner h1 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    text-align: center;
}

.hero-banner .subtitle {
    font-size: 1rem;
    opacity: 0.9;
    text-align: center;
}

/* ===== Sub Navigation ===== */
.sub-nav {
    background: white;
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 100;
}

.sub-nav a {
    display: inline-block;
    margin: 0 20px;
    color: var(--text-color);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.2s;
}

.sub-nav a:hover {
    background-color: #f0f0f0;
    color: var(--banner-bg);
}

.sub-nav a.active {
    background-color: var(--banner-bg);
    color: white;
}

/* ===== Main Content Area ===== */
.content-area {
    background: var(--content-bg);
    padding: 40px 30px;
    max-width: 900px;
    margin: 0 auto;
}

.content-area h2 {
    font-family: Georgia, "Times New Roman", serif;
    text-align: center;
    color: var(--text-color);
    font-size: 1.8rem;
    margin-bottom: 25px;
    padding-bottom: 10px;
}

.content-area h3 {
    font-family: "Microsoft JhengHei", sans-serif;
    color: var(--banner-bg);
    font-size: 1.2rem;
    margin: 25px 0 15px;
    font-weight: 600;
}

.content-area p {
    text-align: justify;
    margin-bottom: 15px;
    line-height: 1.8;
}

/* ===== Major Section Divider ===== */
.major-section {
    border-top: 1px solid #ccc;
    padding-top: 40px;
    margin-top: 40px;
}

/* ===== Tip Box ===== */
.tip-box {
    background: linear-gradient(135deg, #ebf8ff 0%, #bee3f8 100%);
    border-left: 4px solid #4299e1;
    padding: 20px 25px;
    border-radius: 0 8px 8px 0;
    margin: 20px 0;
}

.tip-box h4 {
    margin-bottom: 10px;
    font-size: 1rem;
    color: #2c5282;
}

.tip-box.warning {
    background: linear-gradient(135deg, #fffaf0 0%, #feebc8 100%);
    border-left-color: #ed8936;
}

.tip-box.warning h4 {
    color: #c05621;
}

.tip-box.danger {
    background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%);
    border-left-color: #e53e3e;
}

.tip-box.danger h4 {
    color: #c53030;
}

.tip-box.success {
    background: linear-gradient(135deg, #f0fff4 0%, #c6f6d5 100%);
    border-left-color: #48bb78;
}

.tip-box.success h4 {
    color: #2f855a;
}

/* ===== Feature Grid ===== */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 25px 0;
}

.feature-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.feature-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.feature-card h4 {
    color: var(--banner-bg);
    margin-bottom: 10px;
    font-size: 1.1rem;
}

/* ===== Lists ===== */
.content-area ol,
.content-area ul {
    margin-left: 25px;
    margin-bottom: 20px;
}

.content-area ol li,
.content-area ul li {
    margin-bottom: 10px;
}

/* ===== Steps ===== */
.steps {
    counter-reset: step-counter;
    list-style: none;
    margin-left: 0;
}

.steps li {
    position: relative;
    padding-left: 50px;
    margin-bottom: 25px;
}

.steps li::before {
    counter-increment: step-counter;
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, var(--banner-bg) 0%, #4299e1 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.steps li strong {
    display: block;
    color: var(--banner-bg);
    font-size: 1.1rem;
    margin-bottom: 8px;
}

/* ===== Tables ===== */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
}

th,
td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

th {
    background-color: var(--banner-bg);
    color: white;
    font-weight: 600;
}

tr:hover {
    background-color: #f7fafc;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .left-sidebar {
        display: none;
    }

    .main-wrapper {
        margin-left: 0;
    }

    .hero-banner {
        padding: 30px 20px;
    }

    .hero-banner h1 {
        font-size: 1.4rem;
    }

    .content-area {
        padding: 30px 20px;
    }

    .sub-nav a {
        display: block;
        margin: 5px 0;
    }
}
