/* Layout & Typography */
body {
    visibility: hidden;

    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #E3F2FD;/*Light blue*/
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
}

#banner {
    background-color: #2c3e50;
    color: white;
    padding: 10px 20px;

    /* 1. Force the single-row layout */
    display: flex;
    flex-direction: row;
    align-items: center;      /* Vertically centers title and dropdowns */
    justify-content: flex-start; /* Keeps items grouped to the left */
    gap: 15px;               /* Adds consistent space between elements */

    /* 2. Prevent wrapping on tablets */
    flex-wrap: nowrap;
    overflow: hidden;        /* Keeps the banner clean if text is long */

    /* 3. Positioning */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    box-sizing: border-box;
    z-index: 1000;
}

/* 4. Tweak the Title to sit tight */
#banner h4 {
    margin: 0;               /* Removes default spacing that pushes rows apart */
    white-space: nowrap;     /* Ensures 'Insight Forge' stays on one line */
    font-size: 1.1rem;
}

/* 5. Make pickers share the space */
#banner select {
    max-width: 200px;        /* Prevents one picker from hogging the row */
    height: 30px;
}

select {
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #ccc;
}
#highlight-color-table {
    width: 68px;
    border-collapse: collapse;
    table-layout: fixed;
    margin: 0 auto;
}
#highlight-color-table td {
    width: 34px;
    height: 34px;
    padding: 2px;
}
.color-swatch {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.15);
    cursor: pointer;
    padding: 0;
}
.color-swatch:hover {
    border-color: rgba(0,0,0,0.4);
}

#left-sidebar {
    background-color: #4d4d4d;
    color: white;
    position: fixed;
    left: 0;
    /* REMOVE right: 8px; */
    /* ADD a fixed width instead: */
    width: 88px;

    top: 67px;
    bottom: 0;
    z-index: 1000;

    max-width: 88px;       /* Hard limit for the width */
    box-sizing: border-box; /* Ensures padding doesn't push width past 100px */

    border-right: 1px solid #ccc;
    padding: 10px 5px;
    display: flex;
    flex-wrap: wrap; /* Allows icons to form a 2-column grid */
    gap: 6px;       /* Space between icons */
    padding: 5px;          /* Minimal padding to prevent sticking to edges */
    box-sizing: border-box; /* Critical: keeps the 82px from growing */
    justify-content: center;
    align-content: flex-start;
    z-index: 900;

	overflow-y: auto; /*Scroll bar */
    -ms-overflow-style: none;   /* IE/Edge */
    scrollbar-width: none;      /* Firefox */
}
#left-sidebar::-webkit-scrollbar {
    display: none;              /* Chrome/Safari/Opera */
}
#right-sidebar {
    background-color: #4d4d4d;
    position: fixed;
    right: 0;
    top: 67px;
    bottom: 0;
    width: 36px;
    z-index: 1000;
    box-sizing: border-box;
    overflow-y: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
    padding: 0; /* spacing now handled by the table below */
}
#right-sidebar::-webkit-scrollbar {
    display: none;
}

#right-sidebar table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 3px 10px;
    box-sizing: border-box;
}

#right-sidebar table td {
    text-align: center;
    padding: 0;
}
#right-sidebar table button {
    margin: 0; /* override the global button{margin:1px} — spacing now comes from border-spacing */
}
#right-sidebar #zoomLevel {
    color: white;
    text-align: center;
    font-size: 11px;
}


/* Ensure the PDF iframe perfectly fills the flexible container wrapper */
#viewer-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}
/* The Reader Container */
#viewer-container {
    background-color: #E3F2FD;/*Light blue*/
    flex-grow: 1;
    position: relative;        /* 👈 ADD THIS: Creates a boundary for the iframe */

    margin-left: 102px;
    margin-right: 37px;
    margin-top: 60px;

    margin-bottom: 50px;
    padding: 40px;
    /* Hide scrollbar for Chrome, Safari and Opera */
    &::-webkit-scrollbar { display: none; }

    /* Hide scrollbar for IE, Edge and Firefox */
    -ms-overflow-style: none;
    scrollbar-width: none;

    /* Ensure scrolling still works mechanically */
    overflow-y: auto;

    /* Keep your existing styles */
    transition: background-color 0.3s ease, color 0.3s ease;
    line-height: 1.6;

    /* Add this to prevent the container from growing wider than the screen */
    box-sizing: border-box;
}
#viewer-container::-webkit-scrollbar {
    display: none;
}

/* Theme Definitions */
.white { background-color: #FFFFFF !important; color: #000000; }
.ivory { background-color: #FDF5E6 !important; color: #000000; } /* Adjusted for better distinction */
.azure { background-color: #F0FFFF !important; color: #000000; }
.sepia { background-color: #F4ECD8 !important; color: #5B4636; }
.light-blue { background-color: #E3F2FD !important; color: #000000; }
.light-yellow { background-color: #FFFDE7 !important; color: #000000; }
.honeydew { background-color: #F0FFF0 !important; color: #000000; }
.mint { background-color: #99ffcc !important; color: #000000; }
.light-gray { background-color: #F5F5F5 !important; color: #000000; }
.light-green { background-color: #E8F5E9 !important; color: #000000; }
/* High Contrast / Dark Themes */
.black-azure {
    background-color: #000000 !important;
    color: #F0FFFF !important;
}

.black-green {
    background-color: #000000 !important;
    color: #90EE90 !important; /* LightGreen */
}

.black-orange {
    background-color: #000000 !important;
    color: #FFA500 !important; /* Orange */
}

/* Ensure links in dark mode are still visible */
.black-azure a, .black-green a, .black-orange a {
    color: #add8e6;
    text-decoration: underline;
}

.black-cyan {
    background-color: #000000 !important;
    color: #00FFFF !important; /* Pure Cyan */
}

/* Ensure links are readable in Cyan mode */
.black-cyan a {
    color: #00CCCC;
    text-decoration: underline;
}



/* Ensure RTF content scales well on tablet */
#viewer-container img {
    max-width: 100%;
    height: auto;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 20px;
    font-size: 0.9rem;
    font-weight: bold;
}

.zoom-controls button {
    background-color: #34495e;
    color: white;
    border: 1px solid #5d6d7e;
    padding: 2px 10px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 1.1rem;
}

.zoom-controls button:hover {
    background-color: #415b76;
}

#zoomLevel {
    min-width: 45px;
    text-align: center;
}

/* Ensure the zoom is applied from the top-left */
#viewer-container {
    /* 1. Essential for Zooming (DO NOT REMOVE) */
    transform-origin: top left;
    position: relative;
    /* 2. Essential for Highlighting (DO NOT REMOVE) */
    user-select: text;
    -webkit-user-select: text;

    /* 3. The "Natural Size" Settings */
    display: inline-block; /* Shrink-wraps the text so JS can measure it accurately */
    box-sizing: border-box;
    padding: 20px;

    /* 4. Visuals */
    background-color: transparent; /* Inherits from your themePicker */
}


/* Custom Highlight Style */
mark {
    background-color: #ffeb3b; /* Classic Highlighter Yellow */
    color: #000;
    border-radius: 2px;
    padding: 1px 0;
}

/* Make the highlight button pop slightly on hover */
#highlightBtn:hover img {
    filter: brightness(1.2);
    transform: scale(1.1);
    transition: transform 0.1s ease;
}

.banner-table {
    width: auto;           /* Only as wide as the buttons */
    border-collapse: collapse;
    table-layout: auto;    /* Lets the content dictate the width */
}

.banner-table td {
	text-align: left;         /* Horizontal align left */
    white-space: nowrap;      /* Stops items from overlapping/wrapping */
    vertical-align: middle;   /* Keeps icons and text centered vertically */
    padding: 5px 10px;        /* Consistent spacing between items */
}

/* Left side takes up 45% of the width */
.left-tools { width: 45%; text-align: left; }

/* Right side takes up 55% to accommodate the longer theme list */
.right-tools { width: 55%; text-align: right; }

.document-row {
    padding-top: 12px !important;
    border-top: 1px solid #444; /* Visual separation */
}

/* Specific layout for the file picker */
#filePicker {
    width: 250px;           /* Fixed width to keep it predictable */
    max-width: 40%;         /* Safety cap so it doesn't crush the title on small screens */
    margin-right: 20px;     /* Space from the right edge */
}

/* Shared styles for both pickers */
#folderPicker, #filePicker {
    padding: 5px;
    margin: 10px;
    border-radius: 4px;
    border: 1px solid #ccc;
    min-width: 150px;       /* Ensures it doesn't get too tiny */
    font-size: 0.9em;       /* Slightly smaller text looks more 'pro' */
}

/* This targets EVERY button in your HTML */
button {
    width: 28px !important;    /* !important ensures nothing overrides this */
    height: 28px !important;
    border-radius: 10px;
    overflow: hidden;         /* Clips the image to the rounded corners */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 1px;              /* Gives them a tiny bit of breathing room */
    border: 1px solid #ccc;
    background: white;
}

/* This forces the images to scale down to the 44px button */
button img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;      /* 'contain' is better for icons to avoid cropping */
    display: block;
}

/* Optional: Add a subtle 'press' effect for your tablet */
button:active {
    transform: scale(0.95);
    background-color: #eee;
}


#themePicker {
    width: 76px;           /* Your specific limit */
    max-width: 76px;       /* Hard cap */
    padding: 4px 2px;      /* Slimmer padding to fit in the sidebar */
    margin: 10px auto;     /* Centers it horizontally in the 100px sidebar */
    display: block;        /* Necessary for the auto-margin centering to work */

    font-size: 11px;       /* Smaller font helps the longer names fit */
    border-radius: 4px;
    border: 1px solid #ccc;
    background-color: #fff;
    cursor: pointer;
}

/* Optional: Slim down the options if the tablet makes them huge */
#themePicker option {
    font-size: 12px;
}


#fontPicker {
    width: 76px;
    max-width: 76px;
    padding: 4px 2px;
    margin: 10px auto;
    display: block;
    font-size: 11px;
    border-radius: 4px;
    border: 1px solid #ccc;
    background-color: #fff;
}

/* --- Scratchpad Layout --- */
#scratchpad {
    position: fixed;
    bottom: 0;
    left: 88px; /* Adjust to match your sidebar width */
    right: 37px;
    /*height: 180px; /* Original height */
    /* When collapsed, it shrinks to exactly the header's height */
    height: 40px;
    transition: height 0.3s ease-in-out, transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    /* Hide scrollbar for Chrome, Safari and Opera */
    &::-webkit-scrollbar { display: none; }

    /* Hide scrollbar for IE, Edge and Firefox */
    -ms-overflow-style: none;
    scrollbar-width: none;

    /* Ensure scrolling still works mechanically */
    overflow-y: auto;
}
#scratchpad::-webkit-scrollbar {
    display: none;
}

/*                Toggle Size Scratchpad                  */
/* This ensures that when the scratchpad grows, the content inside the viewer
   can still be scrolled all the way to the end. */
.maxed-active #viewer-container {
    padding-bottom: 82vh; /* Slightly more than the 80vh height for breathing room */
}

/* The Maximum state */
#scratchpad.maxed {
    height: 84vh; /* 80% of the Viewport Height */

}


/* This ensures that when the scratchpad grows, the content inside the viewer
   can still be scrolled all the way to the end. */
.expanded-active #viewer-container {
    padding-bottom: 52vh; /* Slightly more than the 50vh height for breathing room */
}
/* The Expanded state */
#scratchpad.expanded {
    height: 50vh; /* 50% of the Viewport Height */
}



.scratch-hidden #viewer-container {
    /* 2. When 'hidden' (minimized), the viewer still needs to respect
          the 40px title bar resting at the bottom so text doesn't hide behind it */
    margin-bottom: 64px;
    padding-bottom: 64px;
}

/* --- Styling the Header & Text --- */
.scratchpad-header {
    background: #1a252f;
    padding: 3px 10px;
    display: flex;
    flex-direction: column;
    min-height: 64px;
    overflow: hidden;
}

.scratchpad-row-1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 32px;
}

.scratchpad-row-2 {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    min-height: 32px;
}

.basic-title {
    font-size: 15px; /* Slightly smaller to match the slim profile */
    text-transform: uppercase;
    color: white;
    letter-spacing: 0.5px;
    font-weight: bold;
    /*display: inline-block;
    min-width: 200px;
    transition: opacity 0.5s ease-in-out;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    */
}
.scratchpad-title {
    font-size: 15px; /* Slightly smaller to match the slim profile */
    text-transform: uppercase;
    color: white;
    letter-spacing: 0.5px;
    font-weight: bold;
    display: inline-block;
    min-width: 200px; /* Prevents the UI from "jumping" if the text is short */
    transition: opacity 0.5s ease-in-out;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom; /* Keeps it aligned with your buttons */
}

.scratchpad-controls {
    display: flex;
    gap: 6px; /* Match your sidebar gap for consistency */
    align-items: center;
}

#notePad {
    flex-grow: 1;
    overflow-y: auto;
    background: #fdfdfd;
    color: #2c3e50;
    padding: 12px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Nicer for Rich Text */
    font-size: 14px;
    overflow-y: auto; /* Adds the scrollbar back */
    outline: none;    /* Removes the blue border when clicking */
    white-space: pre-wrap; /* Preserves spacing from the RTF */
}

/* Placeholder fix for divs */
#notePad:empty:before {
    content: attr(placeholder);
    color: #95a5a6;
}

#captureBtn {
    width: 63px !important;
    height: 28px !important;
    background-color: #1abc9c; /* A distinct 'action' color */
    color: white;
    border: none;
    cursor: pointer;
}

#captureBtn:hover {
    background-color: #16a085;
}

#ticker-title {
    transition: opacity 0.5s ease-in-out;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: monospace; /* Consistent with your technical style */
}

/* Reset the browser's default yellow */
mark.search-hit {
    background-color: transparent;
    color: inherit;
    padding: 0;
}

/* Only apply color when we actually want it */
mark.search-hit.active-highlight {
    background-color: yellow;
    color: black;
}

/* toggle controlls for highlight & Pen */
.sidebar-toggle-container {
    padding: 6px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
}

.toggle-row input {
    cursor: pointer;
    margin: 0;
}

.toggle-row label {
    cursor: pointer;
    color: #546E7A;
    font-size: 13px;
    font-weight: 500;
}

#toggle-highlight:checked + label {
    color: #000;
    background-color: #FFF59D;
    padding: 1px 4px;
    border-radius: 3px;
}

#toggle-pen:checked + label {
    color: #000;
    background-color: #EF9A9A;
    padding: 1px 4px;
    border-radius: 3px;
}

/* New Content Modal                - unified UI */
#new-content-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
#new-content-overlay.active {
    display: flex;
}
#new-content-modal {
    background: #1e1e1e;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 28px 32px;
    width: 420px;
    max-width: 90vw;
    font-family: monospace;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
#new-content-modal h3 {
    margin: 0 0 20px 0;
    font-size: 1rem;
    color: #90caf9;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
#new-content-modal label {
    display: block;
    font-size: 0.75rem;
    color: #aaa;
    margin-bottom: 4px;
    margin-top: 14px;
}
#new-content-modal input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    background: #2a2a2a;
    border: 1px solid #555;
    border-radius: 4px;
    color: #e0e0e0;
    padding: 8px 10px;
    font-family: monospace;
    font-size: 0.9rem;
}
#new-content-modal input[type="text"]:focus {
    outline: none;
    border-color: #90caf9;
}
.nc-radio-group {
    display: flex;
    gap: 24px;
    margin-top: 10px;
}
.nc-radio-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #ccc;
    cursor: pointer;
    margin: 0;
}
#nc-new-folder-wrap {
    display: none;
    margin-top: 10px;
}
#nc-new-folder-wrap.visible {
    display: block;
}
#nc-format-group {
    display: flex;
    gap: 24px;
    margin-top: 10px;
}
#nc-format-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #ccc;
    cursor: pointer;
    margin: 0;
}
#new-content-status {
    margin-top: 12px;
    font-size: 0.8rem;
    min-height: 18px;
    color: #81c784;
}
#new-content-status.error { color: #e57373; }
.nc-buttons {
    display: flex;
    gap: 10px;
    margin-top: 22px;
    justify-content: flex-end;
}
.nc-buttons button {
    padding: 8px 28px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-family: monospace;
    font-size: 0.85rem;
}
#nc-confirm {
    background: #90caf9;
    color: #111;
}
#nc-confirm:hover { background: #64b5f6; }
#nc-cancel {
    background: #333;
    color: #ccc;
}
#nc-cancel:hover { background: #444; }

#insightforge-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}