/* --- Cinematic Theme Variables --- */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Noto+Serif:ital,wght@0,400;1,300&family=Montserrat:wght@300;500;600&display=swap');

:root {
    --accent-red: #8ce59b;
    --accent-red-glow: rgba(142, 26, 26, 0.4);
    --ink-black: #050505;
    --panel-bg: #0d0d0d;
    --text-main: #e0ddd5;
    --text-dim: #777777;
    --gold-dim: #a68b5b;
    --green-accent: #1b4d2e;
    --sidebar-width: 340px;
}

.fog-of-war {
    position: fixed;
    inset: 0;
    background: #000;
    background-image: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(40, 40, 40, 0.3) 0%, rgba(0, 0, 0, 1) 70%);
    z-index: -1;
    pointer-events: none;
}

body {
    margin: 0;
    background-color: #000;
    font-family: 'Noto Serif', serif;
    overflow: hidden;
    zoom: 1.1;
}

.mode-header {
    position: absolute;
    top: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 30px 0;
    z-index: 1000;
}

.mode-toggle-container { display: flex; gap: 20px; }
.mode-btn {
    font-family: 'Cinzel', serif;
    background: transparent;
    color: var(--text-dim);
    border: 1px solid #222;
    padding: 10px 25px;
    text-decoration: none;
    font-size: 0.8rem;
    letter-spacing: 2px;
    transition: 0.4s;
}
.mode-btn.active, .mode-btn:hover { border-color: var(--text-main); color: var(--text-main); }

.tut-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tut-container {
    width: 95vw;
    max-width: 1400px;
    height: 700px;
    display: flex;
    background: var(--panel-bg);
    border: 1px solid #1a1a1a;
    box-shadow: 0 0 100px rgba(0,0,0,0.9);
    position: relative;
    overflow: hidden; /* CRITICAL: This ensures collapsed sidebar stays hidden inside container */
}

/* --- Sidebar --- */
.tut-sidebar {
    width: var(--sidebar-width);
    background: #050505;
    border-right: 1px solid #1a1a1a;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    /* Faster speed as requested */
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), margin-left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.tut-sidebar.collapsed {
    /* Moves it left within the overflow:hidden container */
    margin-left: calc(var(--sidebar-width) * -1);
}

.sidebar-sticky-header {
    padding: 30px 40px 10px 40px;
    background: #050505;
    position: sticky;
    top: 0;
    z-index: 2100;
}

.sidebar-toggle-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 20px;
    padding: 0;
    z-index: 3000;
}

.sidebar-toggle-btn span {
    width: 20px;
    height: 1px;
    background: var(--text-dim);
    transition: 0.3s;
}

.sidebar-label {
    font-family: 'Cinzel', serif;
    color: #fff1d5;
    font-size: 0.75rem;
    letter-spacing: 3px;
    margin: 0 0 12px 0;
    font-weight: 700;
}

.sidebar-divider {
    height: 1px;
    background: linear-gradient(to right, var(--accent-red), transparent);
}

.sidebar-nav-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0 50px 0;
}

.sidebar-nav-scroll::-webkit-scrollbar { width: 3px; }
.sidebar-nav-scroll::-webkit-scrollbar-thumb { background: #1a1a1a; }

.toc-group { margin-bottom: 40px; padding: 0 40px; }
.toc-group-title {
    font-family: 'Cinzel', serif;
    color: #ffffff42;
    font-size: 0.6rem;
    letter-spacing: 3px;
    margin-bottom: 20px;
    text-transform: uppercase;
    border-bottom: 1px solid #111;
    padding-bottom: 8px;
}

.toc-topic { margin-bottom: 15px; }
.topic-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 5px 0;
}

.topic-label {
    font-family: 'Cinzel', serif;
    color: #999;
    font-size: 0.8rem;
    letter-spacing: 1.5px;
    transition: 0.3s;
}

.topic-header:hover .topic-label { color: var(--text-main); }

.collapse-arrow {
    width: 7px;
    height: 7px;
    border-right: 1px solid #444;
    border-bottom: 1px solid #444;
    transform: rotate(45deg);
    transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    margin-right: 5px;
    pointer-events: none;
}

.toc-topic:not(.collapsed) .collapse-arrow {
    transform: rotate(-135deg);
    border-color: var(--text-main);
}

.toc-steps-list {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s;
    border-left: 1px solid #1a1a1a;
    margin-left: 4px;
    margin-top: 10px;
}

.toc-topic.collapsed .toc-steps-list {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.toc-item {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.72rem;
    font-weight: 500;
    color: #555;
    padding: 12px 0 12px 24px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    transition: color 0.3s ease;
    background: linear-gradient(to right, rgb(26 125 142 / 25%), transparent);
    background-repeat: no-repeat;
    background-size: 0% 100%;
    background-position: left;
}

.toc-item.active {
    color: var(--text-main);
    font-weight: 600;
    background-size: 100% 100%;
}

.toc-item::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 50%;
    height: 0;
    width: 2px;
    background: #1a8e4e;
    box-shadow: 0 0 15px var(--accent-red);
    transition: all 0.3s ease;
    opacity: 0;
}

.toc-item.active::before { height: 60%; top: 20%; opacity: 1; }

/* --- Modern Moonlight Progress --- */
.tut-divider-container { position: relative; width: 100%; margin: 40px 0 30px 0; }
.progress-meta { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 10px; }

.section-indicator {
    font-family: 'Cinzel', serif;
    font-size: 0.65rem;
    letter-spacing: 3px;
    color: #828282;
    text-transform: uppercase;
}

.next-preview {
    font-family: 'Cinzel', serif;
    font-size: 0.65rem;
    letter-spacing: 2px;
    color: var(--gold-dim);
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s;
}

.tut-modern-progress {
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(255,255,255,0.03);
}

.modern-fill {
    height: 100%;
    width: 0%;
    background: #fff;
    box-shadow: 0 0 10px #fff;
    transition: width 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.tut-divider-line { height: 1px; background: rgba(255, 255, 255, 0.08); width: 100%; }

/* --- Content Content --- */
.tut-media-side { display: flex; justify-content: center; flex: 1.6; background: #000; overflow: hidden; mask-image: linear-gradient(to right, black 85%, transparent 100%); }
.media-wrap img, .media-wrap video { width: 100%; height: 100%; object-fit: contain; opacity: 0.6; }
.tut-content-side { flex: 1.4; padding: 60px; display: flex; flex-direction: column; height: 100%; box-sizing: border-box; }
.tsushima-text { font-family: 'Cinzel', serif; color: var(--text-main); letter-spacing: 5px; font-size: 1.5rem; margin: 0; text-transform: uppercase; }
.tut-progress-dots { display: flex; gap: 12px; margin-top: 25px; }
.dot { width: 10px; height: 10px; border: 1px solid #333; transform: rotate(45deg); transition: 0.4s; }
.dot.active { background: #fff; border-color: #fff; box-shadow: 0 0 0px var(--accent-red); }
.tut-body { flex-grow: 1; overflow-y: auto; padding-right: 20px; }
.tut-body::-webkit-scrollbar { width: 2px; }
.tut-body::-webkit-scrollbar-thumb { background: var(--accent-red); }
.main-desc { font-style: italic; color: var(--text-dim); font-size: 1.1rem; line-height: 1.9; margin: 0; }
.tut-details-grid { margin-top: 40px; background: rgba(255,255,255,0.02); padding: 25px; border-left: 2px solid var(--green-accent); }
.detail-item { display: flex; align-items: flex-start; gap: 15px; }
.tut-icon-inner { color: var(--green-accent); margin-top: 5px; font-size: 0.8rem; }
.detail-text { font-family: 'Montserrat', sans-serif; font-size: 0.85rem; color: var(--gold-dim); margin: 0; line-height: 1.6; letter-spacing: 0.5px; }
.tut-footer { margin-top: 40px; }
.button-row { display: flex; gap: 20px; }
.tut-btn { font-family: 'Cinzel', serif; padding: 15px 45px; cursor: pointer; border: none; letter-spacing: 2px; transition: 0.3s; }
.btn-primary { background: var(--text-main); color: #000; font-weight: bold; }
.btn-primary:hover { background: #fff; transform: translateY(-2px); }
.btn-secondary { background: transparent; color: #555; border: 1px solid #222; }
.btn-secondary:hover { color: #888; border-color: #444; }
.btn-symbol { font-size: 1.2rem; margin-left: 10px; }

/* Increased Animation speed from 0.8s to 0.45s */
.anim-reveal { animation: revealEffect 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
@keyframes revealEffect {
    from { opacity: 0; transform: translateY(15px); filter: blur(10px); }
    to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* --- Refined Collection Log System --- */

:root {
    --accent-green: #8ce59b;
    --accent-green-low: rgba(140, 229, 155, 0.15);
    --accent-green-glow: rgba(140, 229, 155, 0.4);
    --text-main: #e0ddd5;    /* Brighter bone-white for readability */
    --text-dim: #a0a0a0;     /* Increased contrast for inactive text */
    --gold-dim: #a68b5b;     /* Consistent gold for headers */
}

/* Sidebar Section Headers */
.sidebar-label {
    font-size: 0.6rem; 
    letter-spacing: 3px;
    color: var(--gold-dim);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.topic-label {
    font-size: 0.72rem;
    letter-spacing: 1.2px;
    color: var(--text-dim);
}

/* Topic Header Alignment */
.topic-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    cursor: pointer;
}

/* --- The Step Item Container --- */
.toc-item {
    display: flex;
    justify-content: space-between; /* Pushes content to opposite ends */
    align-items: center;
    padding: 6px 0 6px 15px; /* Compact padding */
    font-size: 0.65rem;
    color: #777; /* Visible but desaturated */
    transition: all 0.3s ease;
    background: transparent !important;
    position: relative;
}

/* Active Highlight - Subtle and clean */
.toc-item.active {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05) !important;
}

/* --- Fixed Crystal Checkboxes --- */
.step-check-container {
    position: relative;
    width: 24px;  /* Defined area for alignment */
    height: 12px;
    display: flex;
    justify-content: flex-end; /* Aligns crystal to the right under the arrows */
    align-items: center;
    cursor: pointer;
    margin-right: 5px; /* Spacing from the sidebar edge */
}

.step-check-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    width: 8px;
    height: 8px;
    background-color: transparent;
    border: 1px solid #333; /* Visible border for empty state */
    transform: rotate(45deg);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: inset 0 0 2px rgba(0,0,0,0.5);
}

/* Checked State - The Crystal Fill */
.step-check-container input:checked ~ .checkmark {
    background-color: var(--accent-green);
    border-color: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green-glow);
}

/* Log Completion Visuals */
.toc-topic.completed .topic-label {
    color: var(--accent-green);
    opacity: 0.9;
}

.toc-item.completed {
    color: var(--accent-green);
    opacity: 0.8;
}

/* Subtle Vertical Connector */
.toc-steps-list {
    border-left: 1px solid #1a1a1a;
    margin-left: 4px;
    margin-top: 2px;
    margin-bottom: 8px;
}

/* --- Cinematic Tut-Body Styling --- */

/* The container for the description and details */
.tut-body {
    flex-grow: 1 !important;
    background-color: #d9d9d9 !important; /* The light background from image */
    background-image: radial-gradient(circle at center, #e8e8e8 0%, #c4c4c4 100%) !important;
    padding: 30px !important;
    margin: 20px 0 !important;
    border-radius: 2px !important;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.1) !important;
    overflow-y: auto !important;
}

/* Updated Description Text */
.main-desc {
    font-family: 'Noto Serif', serif !important;
    font-size: 0.9rem !important;
    line-height: 1.6 !important;
    color: #222222 !important; /* Darker text as seen in reference */
    font-style: italic !important;
    margin-bottom: 25px !important;
}

/* Updated Detail Grid (The Green Bar Area) */
.tut-details-grid {
    background: rgba(0, 0, 0, 0.05) !important; /* Subtle contrast on light bg */
    border-left: 3px solid #1b4d2e !important; /* Darker green bar */
    padding: 20px !important;
    margin-top: 15px !important;
    zoom: 0.8;
}

.detail-text {
    font-family: 'Montserrat', sans-serif !important;
    font-size: 0.9rem !important;
    color: #333333 !important; /* Darker gold/grey text */
    font-weight: 500 !important;
    line-height: 1.5 !important;
}

.tut-icon-inner {
    color: #1b4d2e !important; /* Matching icon color */
}

/* --- Keyboard Key Styling --- */
/* Styling for all boxes in combinations */
kbd {
    display: inline-block !important;
    padding: 2px 8px !important;
    font-family: 'Montserrat', sans-serif !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    background: #111111 !important;
    border: 1px solid #333 !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 0 #000 !important;
    margin: 0 2px !important;
    text-transform: uppercase !important;
    vertical-align: middle !important;
    text-align: center !important;
    min-width: 12px !important; /* Ensures the "+" box isn't too narrow */
    position: relative;
    top: -3px;
}

/* Sidebar Collapse Animation */
.tut-sidebar {
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    width: 340px; /* Original Width */
}

.tut-sidebar.collapsed {
    width: 0px !important; /* Fully minimize width */
    border-right: none !important;
}

/* Video Reset Button */
.media-wrap {
    position: relative;
}

.video-reset-btn {
    position: absolute;
    /* Move to the middle of the parent */
    top: 80%;
    left: 50%;
    /* Offset by 50% of its own width/height to perfectly center */
    transform: translate(-50%, -50%);
    
    /* Your existing vibes */
    background: rgba(0, 0, 0, 0.7) !important;
    border: 1px solid #444 !important;
    color: #fff !important;
    padding: 8px 15px !important;
    font-family: 'Cinzel', serif !important;
    font-size: 0.7rem !important;
    letter-spacing: 1px !important;
    cursor: pointer !important;
    z-index: 100 !important;
    transition: 0.3s !important;
}

.video-reset-btn:hover {
    background: #fff !important;
    color: #000 !important;
}

:root {
    --accent-green: #8ce59b;
    --accent-green-glow: rgba(140, 229, 155, 0.4);
    --osrs-red: #5d1111;
    --osrs-red-bright: #8b1a1a;
    --panel-bg: #0d0d0d;
    --text-main: #e0ddd5;
    --text-dim: #777777; /* Default state color */
    --gold-bright: #ffb84d;
    --gold-dim: #a68b5b;
}

/* --- Improved Reset Button --- */
.clear-log-btn {
    background: linear-gradient(180deg, #4d1010 0%, #2a0505 100%);
    color: #e0ddd5;
    border: 1px solid #7a1a1a;
    font-family: 'Cinzel', serif;
    font-size: 0.6rem;
    padding: 4px 12px;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    transition: all 0.2s;
    margin-top: 5px;
    text-transform: uppercase;
}

.clear-log-btn:hover {
    border-color: #ff4d4d;
    box-shadow: 0 0 10px rgba(139, 26, 26, 0.5);
    transform: translateY(-1px);
}

/* --- Fixed Log Completion Colors --- */
/* Default (Uncompleted) */
.toc-topic .topic-label {
    color: var(--text-dim); /* Was orange, now grey */
}

.toc-item {
    color: #555; /* Default desaturated grey */
}

/* Completed State (Green) */
.toc-topic.completed .topic-label,
.toc-item.completed {
    color: var(--accent-green) !important;
}

/* Active State (Highlighted) */
.toc-item.active:not(.completed) {
    color: var(--text-main);
}

/* Container to keep text and button on one line */
.header-inline-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 8px; /* Space above the divider */
}

/* Updated Sidebar Label for proper alignment */
.sidebar-label {
    font-size: 13px;
    top: 3px;
    position: relative;
    letter-spacing: 1px;
    color: #bfbfbf;
    margin: 0;
    text-transform: uppercase;
}

/* --- The Reset Button (Improved OSRS Vibe) --- */
.clear-log-btn {
    background: linear-gradient(180deg, #4d1010 0%, #2a0505 100%);
    color: #e0ddd5;
    border: 1px solid #7a1a1a;
    font-family: 'Cinzel', serif;
    font-size: 0.55rem; /* Slightly smaller for the inline look */
    padding: 2px 8px;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    transition: all 0.2s;
    text-transform: uppercase;
}

.clear-log-btn:hover {
    border-color: #ff4d4d;
    box-shadow: 0 0 8px rgba(139, 26, 26, 0.4);
    color: #fff;
}

/* --- Fix for the Orange Color Issue --- */
/* This ensures the items default to a dim grey-white after reset */
.toc-item, .topic-label {
    color: var(--text-dim) !important;
    transition: color 0.3s ease;
}

/* When the JavaScript adds 'completed', turn it green */
.toc-item.completed, 
.toc-topic.completed .topic-label {
    color: var(--accent-green) !important;
    opacity: 1;
}

/* When the JavaScript adds 'active', make it white (if not completed) */
.toc-item.active:not(.completed) {
    color: var(--text-main) !important;
}
/* --- The Expanding Sidebar Panel --- */
.tut-sidebar {
    width: var(--sidebar-width);
    background: #050505;
    border-right: 1px solid #1a1a1a;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: relative;
    z-index: 5000;
    /* Smooth transition for width and background */
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1), background 0.6s ease;
}

/* --- The "Menu Active" State --- */
/* When the menu is active, the sidebar stretches across half the screen */
.tut-sidebar.menu-active {
    width: 600px; 
    background: #000000;
    box-shadow: 50px 0 100px rgba(0,0,0,0.8);
}

/* Hide normal TOC content when menu is open */
.tut-sidebar.menu-active .sidebar-nav-scroll,
.tut-sidebar.menu-active .sidebar-label,
.tut-sidebar.menu-active .clear-log-btn {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* --- Internal Navigation Menu (Hidden by default) --- */
.sidebar-internal-menu {
    position: absolute;
    top: 150px;
    left: 60px;
    display: flex;
    flex-direction: column;
    gap: 40px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-20px);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: 0.1s;
}

.tut-sidebar.menu-active .sidebar-internal-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* --- New Navigation Link Design --- */
.sidebar-nav-link {
    text-decoration: none;
    display: block;
}

.nav-link-meta {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.6rem;
    color: var(--gold-dim);
    letter-spacing: 3px;
    display: block;
    margin-bottom: 5px;
    opacity: 0.5;
}

.nav-link-label {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    color: var(--text-dim);
    display: block;
    letter-spacing: 4px;
    text-transform: uppercase;
    transition: all 0.3s ease;
    position: relative;
}

/* Animated Underline */
.nav-link-label::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 0%;
    height: 1px;
    background: linear-gradient(to right, var(--gold-dim), transparent);
    transition: width 0.4s ease;
}

.sidebar-nav-link:hover .nav-link-label {
    color: var(--text-main);
    letter-spacing: 6px;
    transform: translateX(10px);
}

.sidebar-nav-link:hover .nav-link-label::after {
    width: 100%;
}

/* --- Subtle Background Overlay for Content Side --- */
/* This blurs the main tutorial area when sidebar expands */
.tut-media-side, .tut-content-side {
    transition: filter 0.6s ease, opacity 0.6s ease;
}

.tut-sidebar.menu-active ~ .tut-media-side,
.tut-sidebar.menu-active ~ .tut-content-side {
    filter: blur(8px) brightness(0.3);
    pointer-events: none;
}