/* --- 1. Base Variables & Box Model --- */
:root {
    --sidebar-width: 240px;
    --header-height: 70px; /* Unified height variable */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --accent: #2563eb;
    --inactive: #94a3b8;
    --text-main: #1e293b;
    --text-muted: #475569;
    --bg-light: #f8fafc;
    --border: #e2e8f0;
    --white: #ffffff;
    --shadow: 0 2px 8px rgba(0,0,0,0.05);
}

* { 
    box-sizing: border-box; 
}

/* Core Fix: Disable whole-page scrolling, lock viewport height */
html, body {
    height: 100%;
    margin: 0;
    overflow: hidden; 
}

body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    display: flex; 
    color: var(--text-main); 
    background: var(--white); 
    line-height: 1.6;
}

/* --- 2. Responsive Visibility Helpers --- */
.mobile-only { display: none !important; }
.desktop-only { display: block; }

/* --- 3. Sidebar (Flex item instead of Fixed for local scrolling) --- */
#sidebar {
    width: var(--sidebar-width); 
    height: 100vh; 
    background: #fafafa;
    border-right: 1px solid var(--border); 
    display: flex; 
    flex-direction: column;
    flex-shrink: 0; /* Prevent compression by content */
    z-index: 1000;
}

/* Fix: Ensure height strictly matches the content Header and align borders */
.sidebar-header { 
    height: var(--header-height);
    min-height: var(--header-height);
    padding: 0 25px; 
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border); 
    flex-shrink: 0;
}

.sidebar-nav {
    flex-grow: 1;
    overflow-y: auto; /* Internal scroll if menu items exceed height */
    padding: 20px 0;
}

.sidebar-brand, .mobile-brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { width: 26px; height: 26px; color: var(--primary); }
.brand-logo {
    width: 28px;      /* Adjust width as needed */
    height: 28px;     /* Adjust height as needed */
    object-fit: contain; /* Ensure image scales proportionally without stretching */
    flex-shrink: 0;   /* Prevent image shrinking during layout compression */
}
.brand-name {
    /* Basic Styling */
    font-weight: 800;
    font-size: 19px;
    letter-spacing: -0.8px; /* Tight letter spacing for a designed feel */
    text-decoration: none;
    
    /* Premium Deep Grey-Blue */
    color: #1e293b;
    
    /* Animation Preparation */
    display: flex;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

/* Hover Effect: Lighter color + subtle lift */
.brand-name:hover {
    color: var(--primary); /* Uses defined #2563eb */
    transform: translateY(-1px); /* Slight upward float */
}

.nav-label { 
    padding: 0 25px; 
    font-size: 11px; 
    color: var(--inactive); 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    margin: 10px 0; 
}

#platform-menu { list-style: none; padding: 0; margin: 0; }
#platform-menu a { 
    display: block; padding: 12px 25px; text-decoration: none; 
    color: var(--text-main); font-weight: 500; font-size: 14px; 
    transition: 0.2s;
}
#platform-menu a:hover { background: #f1f5f9; color: var(--primary); }
#platform-menu li.active-menu a { 
    background: #eff6ff; color: var(--primary); border-right: 3px solid var(--primary); 
}

/* --- 4. Main Content Layout --- */
#main-content { 
    flex-grow: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevent parent scrolling */
}

/* Fixed Top Header */
.content-header {
    height: var(--header-height);
    min-height: var(--header-height);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    padding: 0 30px;
    flex-shrink: 0;
    z-index: 900;
}

#header-title { 
    font-size: 22px; margin: 0; color: #0f172a; font-weight: 700; flex: 1; 
}

.lang-switcher {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 600;
    background: #f1f5f9; padding: 6px 14px;
    border-radius: 20px; border: 1px solid var(--border);
}
.lang-option { cursor: pointer; color: var(--text-muted); transition: 0.2s; }
.active-lang { color: var(--primary) !important; font-weight: 800; }

/* Core: Independently Scrollable Body */
.scroll-body { 
    flex-grow: 1;
    overflow-y: auto; 
    padding: 40px 5% 100px; 
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

/* --- 5. Card Layout (Grid) --- */
.card-container, #cards-wrapper { 
    display: grid; 
    /* Use auto-fill with a fixed minimum value */
    grid-template-columns: repeat(auto-fill, minmax(300px, 400px)); 
    gap: 20px; 
    margin-bottom: 40px; 
    width: 100%;
}

/* Block Cards: Limited max-width to prevent infinite stretching */
.card { 
    padding: 24px; 
    background: var(--bg-light); 
    border-radius: 12px; 
    border: 1px solid var(--border); 
    transition: 0.2s;
    
    width: 100%;
    max-width: 400px;
}

.card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.card h4 { margin: 0 0 15px 0; font-size: 17px; color: #0f172a; }

/* Inline (Full-width) Cards: Spans entire row and handles mobile overflow */
.card-inline { 
    padding: 18px 24px; 
    background: var(--bg-light); 
    border-radius: 12px; 
    border: 1px solid var(--border); 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    gap: 15px; 
    margin-bottom: 20px;

    width: 100%;
    max-width: 600px; /* Upper limit for large screens */
    
    /* Core Fix: Force it to span the full row if inside a Grid container */
    grid-column: 1 / -1; 
}

/* --- 6. Button Components --- */
.btn-group, .btn-group-inline { display: flex; gap: 10px; flex-shrink: 0; }
.btn-group a, 
.btn-group-inline a {
    /* 1. Layout & Sizing */
    flex: 1;                         /* Grow to fill equal space within the flex container */
    display: inline-block;           /* Allows padding and width to be applied (consider flex if centering text) */
    padding: 10px 16px;              /* Vertical and horizontal internal spacing */
    
    /* 2. Typography & Alignment */
    text-align: center;              /* Centers the text horizontally */
    text-decoration: none;           /* Removes the default link underline */
    font-size: 13px;                 /* Sets the text size */
    font-weight: 600;                /* Makes the text semi-bold */
    line-height: 1.5;                /* Improves readability (optional but recommended) */
    
    /* 3. Colors & Borders */
    color: var(--primary);           /* Uses the blue theme color for the text */
    background-color: var(--white);  /* White button background */
    border: 1px solid var(--primary);/* Solid border matching the text color */
    border-radius: 8px;              /* Rounds the corners for a modern look */
    
    /* 4. Behavior & State */
    transition: all 0.2s ease;       /* Smooth transition for hover effects */
    white-space: nowrap;             /* Forces text to stay on one line (can cause mobile overflow) */
    cursor: pointer;                 /* Changes the mouse cursor to a hand on hover */
    word-break: break-word;      /* Ensures long words don't break the layout */
}
.btn-group a:hover, .btn-group-inline a:hover { background: var(--primary); color: var(--white); }

/* --- 7. Guide Step Component --- */
.step-p {
    position: relative;
    padding-left: 45px;
    margin: 35px 0;
    font-size: 16px;
    line-height: 1.8;
}

.no {
    position: absolute; 
    left: 0; 
    top: 2px;
    color: var(--white);
    background-color: var(--primary);
    font-weight: 700;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.step-btn-ui {
    display: inline-block;
    background-color: var(--primary);
    color: var(--white);
    padding: 3px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    margin: 0 4px;
    cursor: pointer;
    border: none;
    transition: 0.2s;
}
.step-btn-ui:hover { background-color: var(--primary-hover); transform: translateY(-1px); }

.main-img { 
    max-width: 100%; border-radius: 12px; border: 1px solid var(--border); 
    margin: 20px 0; display: block; box-shadow: var(--shadow);
}

.step-copy {
    background: #f1f5f9; color: var(--primary); padding: 2px 8px;
    border: 1px dashed var(--primary); border-radius: 6px; cursor: pointer;
    font-family: monospace; font-size: 0.9em; transition: 0.2s;
}

/* --- 8. Responsive Adjustments (Mobile) --- */
@media (max-width: 768px) {
	.btn-group a, .btn-group-inline a {
        white-space: normal;       /* Allows text to wrap to the next line */
        word-break: break-word;    /* Forces long words/URLs to break to prevent overflow */
        line-height: 1.2;          /* Keeps multi-line text compact and readable */
        display: flex;             /* Enables Flexbox for alignment */
        align-items: center;       /* Vertically centers text within the button */
        justify-content: center;   /* Horizontally centers text within the button */
        min-height: 40px;          /* Ensures a consistent, accessible touch target size */
        padding: 8px 12px;         /* Adds internal spacing for wrapped text */
    }
    .mobile-only { display: flex !important; }
    .desktop-only { display: none !important; }
    
    #sidebar { 
        display: flex; /* Overrides previous display: none */
        position: fixed;
        left: -100%; /* Initially hidden to the left */
        top: 0;
        transition: left 0.3s ease; /* Smooth slide-in animation */
        box-shadow: 10px 0 30px rgba(0,0,0,0.1);
    }

    /* Move into viewport when active */
    #sidebar.active {
        left: 0;
    }
    
    #sidebar.active .desktop-only {
        display: flex !important; /* Restore visibility when open */
    }

    /* Overlay: Dim background when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 999;
    }
    .sidebar-overlay.active { display: block; }
    
    #header-title {
        /* Core: Limit width and handle overflow */
        white-space: nowrap;      /* Force single line */
        overflow: hidden;         /* Hide overflow */
        text-overflow: ellipsis;  /* Show ellipsis (...) */
        
        /* Layout Tweaks */
        max-width: 60%;           /* Leave space for side icons and lang switcher */
        font-size: 18px;          /* Reduce font size for mobile */
        margin: 0 10px;           /* Add horizontal spacing */
    }

    .content-header {
        /* Ensure Header elements stay centered and uncompressed */
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
    }
}