/* =============================================================================
   LG SOFT SOLUTIONS
   Multi Tenant White Label E-Paper SaaS
   edition.css
   Phase 1 - Production Consolidated Architecture (Refined Codebase)
============================================================================= */

/* =============================================================================
   CSS CUSTOM PROPERTIES
============================================================================= */
:root {
    /* Brand Colors */
    --primary-theme: #006B4F;
    --secondary-theme: #222222;
    --header-bg: #ffffff;
    --footer-bg: #000000;

    /* Layout & Surfaces */
    --body-bg: #f7f8fa;
    --surface: #ffffff;
    --surface-2: #f3f5f8;
    --border-color: #e3e6ec;
    --border-light: #eef1f5;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
    --shadow-sm: 0 2px 8px rgba(0,0,0,.08);
    --shadow-md: 0 8px 24px rgba(0,0,0,.10);
    --shadow-lg: 0 18px 45px rgba(0,0,0,.14);

    /* Sizing & Components */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --toolbox-height: 54px;
    --header-height: 100px;
    --sidebar-width: 280px;
    --viewer-offset:154px;
    --viewer-mobile-offset:108px;

    /* Animations & Layers */
    --transition-fast: .15s ease;
    --transition: .25s cubic-bezier(.4,0,.2,1);
    --transition-slow: .40s cubic-bezier(.4,0,.2,1);
    --z-header: 1040;
    --z-toolbox: 1030;
    --z-sidebar: 1020;
    --z-overlay: 3000;
    --z-modal: 4000;

    color-scheme: light;
}

/* =============================================================================
   RESET & FOUNDATION
============================================================================= */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    height: 100%;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--body-bg);
    color: #212529;
    overflow-x: hidden;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =============================================================================
   MEDIA & CORE HTML INTERFACES
============================================================================= */
img {
    max-width: 100%;
    height: auto;
    display: block;
    border: 0;
    user-select: none;
    -webkit-user-drag: none;
}

canvas {
    display: block;
    touch-action: none;
    image-rendering: auto;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition);
}

button {
    font: inherit;
}

input, button, textarea, select {
    outline: none;
}

/* =============================================================================
   ACCESSIBILITY & CONTROL STATES
============================================================================= */
:focus-visible {
    outline: 3px solid rgba(13,110,253,.25);
    outline-offset: 2px;
}

[hidden], .hidden {
    display: none !important;
}

[aria-disabled="true"] {
    pointer-events: none;
    opacity: .5;
}

.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    border: 0 !important;
}

/* =============================================================================
   HEADER & TICKER
============================================================================= */
.top-header {
    /*position: relative;
    z-index: var(--z-header);*/
    background: var(--header-bg);
    border-bottom: 3px solid var(--primary-theme);
    box-shadow: var(--shadow-sm);
}

.top-header .container-fluid {
    min-height: 72px;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-wrapper img {
    max-height: 90px;
    width: auto;
    object-fit: contain;
}

.logo-wrapper h1, .logo-wrapper h2, .logo-wrapper h3 {
    margin: 0;
    font-weight: 700;
    color: var(--primary-theme);
}

.breaking-bar {
    background: var(--secondary-theme);
    color: #ffffff;
    min-height: 42px;
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.breaking-bar .container-fluid {
    display: flex;
    align-items: center;
    min-height: 42px;
}

.breaking-badge {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    margin-right: 18px;
    background: var(--primary-theme);
    color: #ffffff;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
}

.ticker-container {
    position: relative;
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
}

.ticker-track {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    animation: tickerScroll 45s linear infinite;
    will-change: transform;
}

.ticker-track:hover {
    animation-play-state: paused;
}

.ticker-track a {
    display: inline-flex;
    align-items: center;
    color: #ffffff;
    margin-right: 42px;
    font-size: 13px;
    font-weight: 500;
    opacity: .92;
    transition: opacity var(--transition);
}

.ticker-track a:hover {
    opacity: 1;
    color: #ffc107;
}

@keyframes tickerScroll {
    from { transform: translate3d(0,0,0); }
    to { transform: translate3d(-50%,0,0); }
}

/* =============================================================================
   STICKY TOOLBAR & INTERACTION UTILITIES
============================================================================= */
.unified-sticky-toolbox {
    position: sticky;
    top: 0;
    z-index: var(--z-toolbox);
    display: flex;
    align-items: center;
    min-height: var(--toolbox-height);
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
}

.unified-sticky-toolbox .container-fluid {
    min-height: var(--toolbox-height);
}

.action-btn-square {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
}

.action-btn-square:hover {
    background: var(--primary-theme);
    color: #ffffff;
    border-color: var(--primary-theme);
    transform: translateY(-1px);
}

.action-btn-square:active {
    transform: scale(.96);
}

.vertical-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
}

.core-page-tracker-input {
    display: flex;
    align-items: center;
    justify-content: center;
}

.core-page-tracker-input input {
    width: 54px;
    text-align: center;
    font-weight: 700;
}

.core-page-tracker-input span {
    user-select: none;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar-group > * {
    flex-shrink: 0;
}

/* =============================================================================
   ARCHIVE CALENDAR SYSTEM
============================================================================= */
.style-archive-inline-group {
    display: flex;
    align-items: center;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #ffc107;
    background: #ffffff;
    box-shadow: var(--shadow-xs);
}

.style-archive-clickable-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 36px;
    margin: 0;
    cursor: pointer;
    background: #ffc107;
    color: #222222;
    border: none !important;
}

.style-archive-native-input {
    width: 130px;
    height: 36px;
    padding: 0 10px;
    border: none !important;
    background: #ffffff;
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    cursor: pointer;
}

.style-archive-native-input:focus {
    box-shadow: none;
}

/* =============================================================================
   MAIN APPLICATION VIEWER SYSTEM (SIDEBAR + CANVAS CONTAINER)
============================================================================= */
.container-viewer-main {
    width: 100%;
    max-width: 100%;
    flex: 1;
}

.match-height-row {
    align-items: stretch;
}

.visual-viewer-grid-col {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Layout Core Wrapper - Restored & Bug Fixed for Responsive Auto Fit-To-Screen */
/*.viewer-container {
    position: relative;
    display: flex;
    flex-direction: row;
    width: 100%;
    height: calc(100vh - var(--toolbox-height));
    min-height: 480px;
    overflow: hidden;
    background: #1b1b1b;
    border-radius: var(--radius-md);
    border: 1px solid rgba(0,0,0,.08);
    box-shadow: var(--shadow-md);
}*/

.viewer-container{
    position:relative;
    display:flex;
    width:100%;
    height:calc(100vh - var(--viewer-offset));
    min-height:320px;
    overflow:hidden;
    background:#1f1f1f;
}

/* Canvas Scroll-Pane Layer - Responsive Configuration */
/*.canvas-wrapper {
    position: relative;
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3a3a3a;
    cursor: grab;
    padding: 0;
    margin: 0;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: none;
    scroll-behavior: auto;
}*/

.canvas-wrapper{
    position:relative;
    flex:1;
    overflow:auto;
    display:flex;
    justify-content:center;
    align-items:center;
    background:#2b2b2b;
    touch-action:none;
    overscroll-behavior:none;
    -webkit-overflow-scrolling:touch;
}

.viewer-stage {
    position: relative;
    width: max-content;
    height: max-content;
    min-width: 100%;
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#viewerStage{
    position:relative;
    display:flex;
    justify-content:center;
    align-items:center;
    width:100%;
    height:100%;
    min-width:100%;
    min-height:100%;
}

.canvas-wrapper.dragging {
    cursor: grabbing;
}

.canvas-wrapper::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.canvas-wrapper::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.canvas-wrapper::-webkit-scrollbar-track {
    background: #2f2f2f;
}

/* Canvas Viewport Styles to Ensure Screen Fitting Defaults */
/*#canvasViewer {
    display: block;
    margin: auto;
    padding: 0;
    background: #ffffff;
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto;
    height: auto;
    object-fit: contain;
    box-shadow: 0 6px 24px rgba(0,0,0,.35);
}*/

#canvasViewer{
    display:block;
    max-width:none;
    max-height:none;
    width:auto;
    height:auto;
    margin:auto;
    user-select:none;
    -webkit-user-drag:none;
    transform-origin:center center;
}

/* Explicit scaling override block for standard cropper containment layout engines */
.cropper-container {
    max-width: 100% !important;
    max-height: 100% !important;
}

/* Ensure child toolbar overlays are visible and clickable outside the crop boundaries */
.cropper-crop-box {
    overflow: visible !important;
}

/* =============================================================================
   EPAPER SIDEBAR AND NAVIGATION COMPONENT
============================================================================= */
.epaper-sidebar, .sidebar-panel {
    width: var(--sidebar-width);
    background-color: #ffffff;
    border-right: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-shrink: 0 !important;
    overflow: auto;
    position: relative;
    z-index: 10;
}

.sidebar-tabs {
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-light);
    background: #fafafa;
}

.sidebar-tabs .nav-link {
    border: none;
    border-radius: 0;
    color: #495057;
    font-size: 14px;
    font-weight: 600;
    padding: 12px 5px;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
}

.sidebar-tabs .nav-link.active {
    color: var(--primary-theme);
    border-bottom: 2px solid var(--primary-theme);
    background-color: #fff;
}

.sidebar-scroll-pane, .sidebar-tab-content {
    overflow-y: auto;
    flex-grow: 1;
    padding: 15px;
    height: calc(100% - 46px);
}

/* Page Thumbnails & Clips Lists */
.thumb-item, .thumb-list-item {
    width: 100%;
    border-radius: 8px;
    border: 2px solid transparent;
    background-color: #f8f9fa;
    cursor: pointer;
    display: block;
    transition: all 0.2s ease-in-out;
}

.thumb-item:hover, .thumb-list-item:hover,
.thumb-item.active, .thumb-list-item.active {
    transform: translateY(-2px);
    border-color: var(--primary-theme);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15), var(--shadow-md);
}

.thumb-item.active {
    box-shadow: 0 0 0 3px rgba(0,107,79,.15);
}

.page-number-badge {
    position: absolute;
    right: 10px;
    bottom: 10px;
}

.clip-thumb-card, .clip-list-item {
    border-radius: 10px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid var(--border-light);
    margin-bottom: 12px;
    transition: transform var(--transition), box-shadow var(--transition), background 0.2s;
}

.clip-thumb-card:hover, .clip-list-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    background-color: #f1f3f5;
}

.clip-thumb-img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
    background:#f4f4f4;
}

/* =============================================================================
   CROP ENGINE OVERLAY & BOX MODIFIERS
============================================================================= */
/*#cropOverlay {
    position: absolute;
    inset: 0;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    cursor: crosshair;
    background-color: rgba(0, 0, 0, 0);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}*/
#cropOverlay {
    position: absolute;
    inset: 0;
    z-index: 1000;
    cursor: crosshair;
    background-color: rgba(0, 0, 0, 0);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

#cropOverlay.d-none {
    display: none;
}

/* Floating Action Toolbar Layer Above Crop Selection Box */
/*.crop-inline-actions {
    position: absolute;
    left: 50%;
    top: -54px;                 /* Moves toolbar safely above crop boundary outlines */
   /* transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: .5rem;
    z-index: 9999;
    pointer-events: auto;
    white-space: nowrap;
}*/

/* Floating Action Toolbar Layer Above Crop Selection Box */
.crop-inline-actions {
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translateX(-50%);
    margin-bottom: 18px; /* Safe padding clearance height above target crop outlines */
    display: flex;
    gap: .5rem;
    z-index: 10050;
    white-space: nowrap;
    pointer-events: auto !important; /* Forces input event matching to work flawlessly */
}

.crop-inline-actions .btn {
    height: 34px;
    min-width: 34px;
    padding: .35rem .8rem;
    border-radius: 999px;
}

/* =============================================================================
   UPGRADED CROP ENGINE UI (Touch-Friendly)
============================================================================= */
/*#cropSelection {
    position: absolute;
    border: 2px solid var(--primary-theme, #006B4F);
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.75);
    cursor: move;
    touch-action: none;
    overflow: visible;   /* Enables crop-inline toolbar visibility out of crop bounds */
/*}
*/
#cropSelection {
    position: absolute;
    border: 2px dashed var(--primary-theme, #006B4F);
    background-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65);
    /*cursor: move;*/
    touch-action: none;
    overflow: visible !important; /* Forces toolbar visibility beyond crop boundaries */
}
/*.crop-handle {
    position: absolute;
    width: 44px; /* Optimized Accessible Touch Targets */
    /*height: 44px;
    background-color: transparent; /* Invisible wrapper hitbox tracking */
    /*z-index: 1010;
    display: flex;
    align-items: center;
    justify-content: center;
}*/
/* Touch-Friendly Drag Handles Hitboxes */
.crop-handle {
    position: absolute;
    width: 34px;
    height: 34px;
    background-color: transparent;
    z-index: 1010;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Visual Handle Node Elements */
/*.crop-handle::after {
    content: '';
    width: 12px;
    height: 12px;
    background-color: #ffffff;
    border: 2px solid var(--primary-theme, #006B4F);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    transition: transform 0.1s ease;
}*/
.crop-handle::after {
    content: '';
    width: 10px;
    height: 10px;
    background-color: #ffffff;
    border: 2px solid var(--primary-theme, #006B4F);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

.crop-handle:active::after {
    transform: scale(1.5);
    background-color: var(--primary-theme, #006B4F);
}

/* High Accuracy Target Wrappers Layout Pointers */
/*.crop-handle.tl { top: -22px; left: -22px; cursor: nwse-resize; }
.crop-handle.tm { top: -22px; left: calc(50% - 22px); cursor: ns-resize; }
.crop-handle.tr { top: -22px; right: -22px; cursor: nesw-resize; }
.crop-handle.rm { top: calc(50% - 22px); right: -22px; cursor: ew-resize; }
.crop-handle.br { bottom: -22px; right: -22px; cursor: nwse-resize; }
.crop-handle.bm { bottom: -22px; left: calc(50% - 22px); cursor: ns-resize; }
.crop-handle.bl { bottom: -22px; left: -22px; cursor: nesw-resize; }
.crop-handle.lm { top: calc(50% - 22px); left: -22px; cursor: ew-resize; }*/

.crop-handle.tl { top: -16px; left: -16px; cursor: nwse-resize; }
.crop-handle.tm { top: -16px; left: calc(50% - 16px); cursor: ns-resize; }
.crop-handle.tr { top: -16px; right: -16px; cursor: nesw-resize; }
.crop-handle.rm { top: calc(50% - 16px); right: -16px; cursor: ew-resize; }
.crop-handle.br { bottom: -16px; right: -16px; cursor: nwse-resize; }
.crop-handle.bm { bottom: -16px; left: calc(50% - 16px); cursor: ns-resize; }
.crop-handle.bl { bottom: -16px; left: -16px; cursor: nesw-resize; }
.crop-handle.lm { top: calc(50% - 16px); left: -16px; cursor: ew-resize; }

/* =============================================================================
   MODALS & FLOATING SYSTEMS
============================================================================= */
.mobile-floating-navigation {
    position: fixed;
    inset-inline: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-inline: 14px;
    pointer-events: none;
    z-index: var(--z-overlay); /* Pushed cleanly into elevated overlay systems */
}

.floating-nav-btn {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: rgba(0,107,79,.90);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    pointer-events: auto;
    box-shadow: 0 10px 24px rgba(0,0,0,.25);
    transition: transform var(--transition), background var(--transition);
}

.floating-nav-btn:hover {
    background: var(--primary-theme);
    transform: scale(1.06);
}

.floating-nav-btn:active {
    transform: scale(.94);
}

.modal-content {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0,0,0,.25);
}

.modal-header {
    border-bottom: 1px solid var(--border-light);
}

.modal-footer {
    border-top: 1px solid var(--border-light);
}

.modal-title {
    font-weight: 700;
}

.custom-modal-clip-render-box {
    background: #fafafa;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#clipOutputImage {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.social-icon-row {
    display: flex;
    justify-content: center;
    gap: 14px;
}

.social-icon-row a {
    transition: transform var(--transition), opacity var(--transition);
}

.social-icon-row a:hover {
    transform: translateY(-2px);
    opacity: .9;
}

.social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary-theme);
    color: #fff;
    margin-left: 8px;
    transition: .25s;
}

.social-icon:hover {
    background: var(--secondary-theme);
    color: #fff;
    transform: translateY(-2px);
}

#downloadClipBtn {
    min-width: 220px;
}

.btn-brand {
    background: var(--primary-theme);
    border-color: var(--primary-theme);
    color: #fff;
}

.btn-brand:hover {
    background: var(--secondary-theme);
    border-color: var(--secondary-theme);
}

/* =============================================================================
   LOADERS & UI EMPTY STATES
============================================================================= */
.viewer-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.75);
    backdrop-filter: blur(3px);
    z-index: 200;
}

.viewer-spinner {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 5px solid #e9ecef;
    border-top-color: var(--primary-theme);
    animation: viewerSpin .9s linear infinite;
}

@keyframes viewerSpin {
    to { transform: rotate(360deg); }
}

.empty-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    padding: 40px 20px;
}

.footer-fixed-bottom {
    background: var(--footer-bg);
    color: #ffffff;
    border-top: 1px solid rgba(255,255,255,.08);
}

.footer-fixed-bottom p {
    margin: 0;
}

.form-control:focus {
    border-color: var(--primary-theme);
    box-shadow: 0 0 0 .15rem rgba(0,107,79,.15);
}

.btn {
    transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}

.btn:active {
    transform: scale(.97);
}

/* =============================================================================
   PERFORMANCE DESCRIPTOR FRAMEWORKS
============================================================================= */
.lazy-render {
    content-visibility: auto;
    contain-intrinsic-size: 500px;
}

.hardware, .gpu-layer {
    transform: translateZ(0);
    will-change: transform;
}

.fade-transition {
    transition: opacity var(--transition), transform var(--transition);
}

.shadow-hover {
    transition: box-shadow var(--transition), transform var(--transition);
}

.shadow-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Scrollbar Interface Overrides (Webkit System Engine) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-thumb {
    background: #c7cdd5;
    border-radius: 20px;
}

::-webkit-scrollbar-thumb:hover {
    background: #aeb6bf;
}

::-webkit-scrollbar-track {
    background: #f5f5f5;
}

/* Scrollbar Interface Overrides (Gecko Engine Firefox) */
* {
    scrollbar-width: thin;
    scrollbar-color: #b8bec7 #f5f5f5;
}

.no-select {
    user-select: none;
    -webkit-user-select: none;
}

.pointer { cursor: pointer; }
.grab { cursor: grab; }
.grabbing { cursor: grabbing; }
.opacity-0 { opacity: 0 !important; }
.opacity-100 { opacity: 1 !important; }

/* =============================================================================
   RESPONSIVE LAYOUT ENGINE MEDIA BREAKPOINTS
============================================================================= */
/* Desktop / Large Screens Viewports */
@media (min-width: 992px) {
    .viewer-container {
        height: calc(100vh - var(--toolbox-height) - 85px);
    }
}

@media (min-width: 1401px) {
    .viewer-container {
        height: calc(100vh - 160px);
    }
}

@media (min-width: 992px) and (max-width: 1400px) {
    .viewer-container {
        height: calc(100vh - 150px);
    }
}

/* Tablets & Mobile Base Layout System overrides */
@media (max-width: 991.98px) {
    .breaking-badge {
        display: none;
    }
    
    /* Sidebar responsive state config */
    .epaper-sidebar, .sidebar-panel {
        display: none !important;
        height: 500px;
    }
    
    .canvas-wrapper {
        width: 100% !important;
    }
    
    .viewer-container {
        height: calc(100vh - 110px);
        border-radius: 0;
    }
    
    .canvas-wrapper {
        width: 100%;
        height: 100%;
        overflow: auto;
    }
}

/* Smartphone & Touch Pointer Targets Interactions */
@media (max-width: 767.98px) {
    :root {
        --toolbox-height: 50px;
    }

    .top-header {
        display: block;
    }

    .logo-wrapper img {
        max-height: 90px;
    }

    .ticker-track a {
        font-size: 12px;
    }

    .core-page-tracker-input {
        min-width: 72px;
    }

    .style-archive-inline-group {
        border-radius: 6px;
    }

    .style-archive-native-input {
        width: 42px;
        color: transparent;
        padding: 0;
        text-indent: -9999px;
    }

    .style-archive-native-input::-webkit-calendar-picker-indicator {
        width: 100%;
        height: 100%;
        opacity: 0;
        cursor: pointer;
    }

    /* Isolated patch for mobile bottom navigation pill interactions */
    .position-fixed.start-50.translate-middle-x.bottom-0 {
        z-index: 2500 !important; 
        pointer-events: auto !important;
    }

    .position-fixed.start-50.translate-middle-x.bottom-0 .btn-group {
        background: #ffffff !important;
        box-shadow: var(--shadow-lg) !important;
    }

    .viewer-toolbar .container-fluid {
        overflow-x: auto;
        scrollbar-width: none;
        display: flex;
        flex-wrap: nowrap;
    }

    .viewer-toolbar .container-fluid::-webkit-scrollbar {
        display: none;
    }

    .viewer-toolbar .btn {
        min-width: 40px;
    }

    #pageIndicator {
        min-width: 85px;
        display: inline-block;
        text-align: center;
    }
}

/* Micro Device Display Rules */
@media (max-width: 575.98px) {
    .unified-sticky-toolbox .container-fluid {
        gap: 4px;
    }

    .action-btn-square {
        width: 34px;
        height: 34px;
    }

    #canvasViewer {
        border-radius: 2px;
    }
}

/* =============================================================================
   UTILITY SPECIFICATIONS (HIGH DPI, PRINT, REDUCED MOTION)
============================================================================= */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    #canvasViewer {
        image-rendering: auto;
    }
}

@supports (padding: max(0px)) {
    .mobile-floating-navigation {
        padding-left: max(14px, env(safe-area-inset-left));
        padding-right: max(14px, env(safe-area-inset-right));
    }
}
#canvasWrapper{
    position:relative;
    display:flex;
    align-items:center;
    justify-content:center;
    overflow:auto;
    background:#2b2b2b;
}

/* Fix 2: Inline crop actions toolbar positioned safely above crop box borders */
.cropper-toolbar-overlay {
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translateX(-50%);
    margin-bottom: 15px; /* Clear space buffer above selection box */
    z-index: 10050;
    background: rgba(34, 34, 34, 0.95);
    padding: 6px 12px;
    border-radius: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    white-space: nowrap;
    pointer-events: auto !important; /* Retains touch interaction capabilities on mobile viewports */
}

.cropper-toolbar-overlay .btn {
    padding: 4px 10px;
    font-size: 13px;
    border-radius: 20px;
}