/* Dashboard Styles */

*, *::before, *::after {
    box-sizing: border-box;
}

html, body { overflow-x: hidden; overflow-y: hidden;} body { position: relative; } 

html, body {
    height: 100vh;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: hidden;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--text-color);
    background: var(--background-color);
}

.dashboard {
    display: grid;
    height: 100vh;
    width: 100%;
}

/* Navigation */
.nav-section {
    background: var(--navbar-bg, var(--bg-header));
    border-bottom: var(--border-primary);
    position: relative;
    padding-bottom: 96px;
}

.nav-section h2 {
    margin: 0;
    padding: 16px;
    font-size: var(--font-size-large);
    color: var(--navbar-text, var(--text-color));
}

.nav-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-section li {
    padding: 12px 16px;
}

.nav-section .nav-link {
    text-decoration: none;
    color: var(--navbar-text, var(--text-color));
    font-weight: var(--font-weight);
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    font-size: inherit;
    font-family: inherit;
}

/* Nav link icon + text layout */
.nav-section .nav-link { display:flex; align-items:center; gap:10px; }
.nav-section .nav-icon { width:18px; height:18px; display:block; color: var(--navbar-text, var(--primary-color)); }
/* emoji/text icon styling when using `nav-emoji` */
.nav-icon.nav-emoji { display:inline-flex; align-items:center; justify-content:center; font-size: var(--font-size-icon); line-height:1; width:18px; height:18px; }
.nav-section .nav-text { display:inline-block; }

/* Settings: inline navbar controls row */
.navbar-controls { display:flex; align-items:center; gap:8px; margin-top:6px; }
.navbar-controls label { font-size: 14px; }
.navbar-controls input[type="color"] { width:36px; height:26px; padding:0; border:0; background:transparent; }
/* contrast note */
.navbar-contrast-note { font-size:12px; margin-left:8px; padding:4px 6px; border-radius:4px; display:inline-block; vertical-align:middle; }
.navbar-contrast-note.ok { background: rgba(0,128,0,0.07); color: #0b6623; border: 1px solid rgba(0,128,0,0.12); }
.navbar-contrast-note.warn { background: rgba(255,165,0,0.08); color: #b36b00; border: 1px solid rgba(255,165,0,0.12); }

.nav-section .nav-link:hover {
    color: var(--primary-color);
}

/* Main Render */
.main-render {
    background: var(--main-bg);
    padding: 5px;
}

.main-render h1 {
    margin-top: 0;
    font-size: var(--font-size-xlarge);
}

/* Thumb Control */
.thumb-control {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--btn-primary-text);
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--box-shadow);
    display: none;
}

/* Logout Control */
.logout-control {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--btn-primary-text);
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--box-shadow);
    display: none;
}

.user-area {
    position: absolute;
    bottom: 16px;
    left: 16px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.user-chip {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--btn-primary-text);
    display: none;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: var(--box-shadow);
    cursor: default;
    font-size: 14px;
    text-transform: uppercase;
}
.user-chip.show { display: flex; }

.user-logout {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--box-shadow);
    cursor: pointer;
    padding: 0;
}
.user-logout:hover { background: rgba(0,0,0,0.04); }
.user-logout svg { display: block; width:18px; height:18px; }

/* file icon before filename */
.file-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 20px;
    margin-right: 6px;
    font-size: 16px;
    line-height: 1;
    color: var(--primary-color-contrast);
}
.file-icon svg { display:block; width:100%; height:100%; }

/* Mobile / Tablet Layout: keep nav at bottom for all non-desktop widths */
@media (max-width: 1023px) {
    .dashboard {
        grid-template-rows: 1fr auto;
    }

    .nav-section {
        order: 2;
        background: var(--navbar-bg, var(--bg-footer));
        padding: 0 0 48px;
        display: block !important; /* Always visible on mobile/tablet */
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 85px;
        z-index: 1000;
        border-top: var(--border-primary);
    }

    /* hide the heading on small screens */
    .nav-section h2 { display: none; }

    .nav-dropbox { display: none !important; }

    .user-chip { display: none !important; }

    /* Mobile/tablet: show nav as horizontal bar with only icons */
    .nav-section ul { display:flex; flex-direction:row; justify-content:space-between; align-items:center; padding:8px 12px; }
    .nav-section li { padding: 6px 8px; }
    .nav-section .nav-text { display:none; }
    .nav-section .nav-icon { width:28px; height:28px; }

    .nav-section.nav-visible {
        display: block;
    }

    /* Frosted iOS-like top rounded nav when visible */
    .nav-section.nav-visible {
        border-top-left-radius: var(--border-radius);
        border-top-right-radius: var(--border-radius);
        background: linear-gradient(180deg, rgba(53, 49, 53, 0.86), rgba(34, 33, 33, 0.6));
        backdrop-filter: var(--backdrop-filter-blur);
        -webkit-backdrop-filter: var(--backdrop-filter-blur);
        box-shadow: var(--box-shadow-frosted);
        border-top: var(--border-opaque);
        height: 88px;
        padding-top: 6px;
    }

    /* Dark theme variant for bottom nav */
    [data-theme="dark"] .nav-section.nav-visible {
        background: linear-gradient(180deg, rgba(28,28,30,0.92), rgba(44,44,46,0.72));
        box-shadow: var(--box-shadow-dark);
        border-top: var(--border-opaque);
    }

    .main-render {
        order: 1;
        padding: 16px;
        height: 100vh;
        overflow-y: auto;
        overflow-x: hidden;
        padding-bottom: 100px; /* space for fixed bottom nav */
    }

    /* Tablet: slightly larger icons and more comfortable spacing */
    @media (min-width: 768px) {
        .nav-section .nav-icon { width:32px; height:32px; }
        .nav-section li { padding: 8px 12px; }
    }

    /* Extra small phones should have minimal padding to maximize viewport */
    @media (max-width: 600px) {
        .main-render { padding: 4px; padding-bottom: 100px; }
    }

    .thumb-control {
        display: block;
    }

    /* Hide the floating duplicate logout control (we clone logout into settings instead) */
    .logout-control {
        display: none !important;
    }

    .nav-logout {
        display: none;
    }
}

/* Desktop Layout */
@media (min-width: 1024px) {
    .dashboard {
        grid-template-columns: 250px 1fr;
    }

    .nav-section {
        order: 1;
        height: 100vh;
        border-right: var(--border-primary);
        /* ensure nav becomes visible again on desktop (overrides mobile/tablet 'display:none') */
        display: block;
        position: relative;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .main-render {
        order: 2;
        height: 100vh;
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* restore vertical nav layout on desktop */
    .nav-section ul { display: block; }
    .nav-section .nav-text { display: inline-block; }
    .nav-section .nav-icon { width: 18px; height: 18px; }
    .thumb-control { display: none; }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 12000;
    overflow-x: hidden;
    overflow-y: hidden;
    box-sizing: border-box;
}

/* Files toolbar layout */
.files-toolbar {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding-bottom: 8px;
}
.files-controls {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.files-path { flex: 1; display:flex; align-items:center; }

/* Preset color swatches in settings */
.preset-colors { display:flex; align-items:center; }
.preset-color { width:28px; height:28px; border-radius:6px; border:1px solid rgba(0,0,0,0.06); cursor:pointer; padding:0; }

/* Icon-only, full-width buttons for iOS-friendly toolbar */
.files-controls .btn {
    width: auto;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Utility: responsive nav height */
.nav-height {
    /* default for tablet and desktop */
    height: 98dvh;
}

/* phones/mobile: shorter height */
@media (max-width: 767px) {
    .nav-height {
        /* height: 94dvh; */
        height: calc(100vh - 110px) !important;
    }
}
    /* gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 16px;
    line-height: 1;
} */
.files-controls .btn svg { width: 20px; height: 20px; display: block; }
.files-controls .btn.btn-primary { background: var(--primary-color); color: var(--btn-primary-text); }
.files-controls .btn.btn-danger { background: var(--danger-color); color: #fff; }
.files-controls .btn:hover { filter: brightness(0.97); }

/* Toolbar as a horizontal row with space between controls and path */
.files-toolbar { display:flex; flex-direction: row; align-items: center; justify-content: space-between; width: 100%; }
.files-path { margin-top: 0; }

/* Admin users toolbar (responsive) */
#admin-users-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
#admin-users-toolbar input[type="text"], #admin-users-toolbar input[type="email"], #admin-users-toolbar input[type="password"] {
    flex: 1 1 160px;
    min-width: 120px;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}
#admin-users-toolbar label { flex: 0 0 auto; display: flex; align-items: center; }
#admin-users-toolbar button { flex: 0 0 auto; }

@media (max-width: 600px) {
    #admin-users-toolbar input[type="text"], #admin-users-toolbar input[type="email"], #admin-users-toolbar input[type="password"] {
        flex: 1 1 100%;
        min-width: 0;
    }
    #admin-users-toolbar label { width: 100%; justify-content: flex-start; }
    #admin-users-toolbar button { width: 100%; }
}

@media (max-width: 767px) {
    /* small screens stack vertically */
    .files-toolbar { flex-direction: column; gap: 8px; }
    .files-controls { width: 100%; justify-content: space-between; }
    .files-controls .btn { flex: 1 1 auto; }
}

/* badge inside icon button */
.btn-badge {
    display: inline-block;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    font-size: 12px;
    text-align: center;
    border-radius: 12px;
    background: rgba(0,0,0,0.9);
    color: #fff;
    padding: 0 6px;
    margin-left: 6px;
    vertical-align: top;
}

.files-controls .btn { position: relative; }
.files-controls .btn .btn-badge { position: absolute; top: -6px; right: -6px; transform: translate(0,0); }
.files-controls .btn.active { box-shadow: 0 6px 18px rgba(0,0,0,0.12); transform: translateY(-1px); }

/* checkbox column */
.file-table input[type="checkbox"] { width:18px; height:18px; }
.file-table th.check-col, .file-table td.check-col { width:36px; text-align:center; }
.file-table td.check-col { vertical-align: middle; }

.modal.show {
    display: block;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--backdrop-color);
    z-index: 12010;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--pop-up-color);
    border: var(--border-primary);
    border-radius: var(--border-radius-large);
    box-shadow: var(--box-shadow-frosted);
    max-width: min(500px, calc(100% - 40px));
    width: 90%;
    max-height: calc(100vh - 40px);
    overflow: hidden;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    z-index: 12020;
}

@media (max-width: 767px) {
    .modal-content {
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        max-height: calc(100vh - 60px);
        width: calc(100% - 20px);
        max-width: none;
    }
}

.modal-sm .modal-content {
    max-width: min(300px, calc(100% - 40px));
    width: auto;
}

.modal-header {
    background: transparent;
    color: var(--modal-header-text);
    padding: var(--card-padding) var(--card-padding) 0 var(--card-padding);
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--card-spacing);
    box-sizing: border-box;
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    font-size: var(--font-size-large);
    font-weight: 600;
    color: var(--text-color);
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--modal-header-text);
}

.modal-body {
    padding: 16px;
    color: var(--modal-text);
    /* allow body to grow and scroll while footer stays fixed */
    flex: 1 1 auto;
    overflow: auto;
}

.modal-body p {
    margin-bottom: 16px;
}

.modal-footer {
    background: transparent;
    color: var(--modal-text);
    padding: 16px;
    border-top: var(--border-primary);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: auto;
    padding-bottom: 20px; /* Extra padding for mobile browser UI */
}

@media (max-width: 767px) {
    .modal-footer {
        padding-bottom: 30px; /* More padding on mobile for browser UI */
    }
}

/* Profile cards */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.profile-card {
    background: var(--card-background);
    border: var(--card-border);
    padding: var(--card-padding);
    border-radius: var(--card-border-radius);
    box-shadow: var(--card-shadow);
}
@media (max-width: 767px) {
    .profile-grid { grid-template-columns: 1fr; }
}

/* Auth Modal Styles */
.auth-tabs {
    display: flex;
    margin-bottom: var(--card-spacing);
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 4px;
    gap: 4px;
}

.auth-tab {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: calc(var(--border-radius) - 2px);
    cursor: pointer;
    font-size: var(--font-size-base);
    font-weight: 500;
    transition: all 0.2s ease;
}

.auth-tab:hover {
    background: var(--hover-color);
}

.auth-tab.active {
    background: var(--primary-color);
    color: var(--btn-primary-text);
    box-shadow: var(--box-shadow);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.form-group {
    margin-bottom: var(--card-spacing);
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: var(--border-primary);
    border-radius: var(--border-radius);
    background: var(--input-bg);
    color: var(--text-color);
    font-size: var(--font-size-base);
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-color-light);
}

.auth-btn {
    width: 100%;
    padding: var(--btn-padding);
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border: none;
    border-radius: var(--btn-border-radius);
    font-size: var(--btn-font-size);
    font-weight: var(--btn-font-weight);
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-top: var(--card-spacing);
    box-sizing: border-box;
}

.auth-btn:hover {
    background: var(--btn-primary-hover);
}

.auth-btn:active {
    background: var(--btn-primary-active);
}

.btn {
    padding: var(--btn-padding);
    border: none;
    border-radius: var(--btn-border-radius);
    font-size: var(--btn-font-size);
    font-weight: var(--btn-font-weight);
    cursor: pointer;
    transition: background-color 0.2s ease;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--btn-height);
}

.btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
}

.btn-primary:hover {
    background: var(--btn-primary-hover);
}

.btn-primary:active {
    background: var(--btn-primary-active);
}

.btn-success {
    background: var(--btn-success-bg);
    color: var(--btn-success-text);
}

.btn-success:hover {
    background: var(--btn-success-hover);
}

.btn-success:active {
    background: var(--btn-success-active);
}

.btn-danger {
    background: var(--danger-color);
    color: #fff;
}

.btn-danger:hover {
    background: color-mix(in srgb, var(--danger-color) 85%, black);
}

.btn-danger:active {
    background: color-mix(in srgb, var(--danger-color) 75%, black);
}

/* utility */
.bg-danger { background: var(--danger-color); color: #fff; }

#auth-message {
    margin-top: var(--card-spacing);
    text-align: center;
    padding: 12px;
    border-radius: var(--border-radius);
    font-weight: 500;
    box-sizing: border-box;
    word-wrap: break-word;
}

#auth-message:empty {
    display: none;
}

/* Settings Modal */
.settings-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    border-bottom: var(--border-primary);
}

.settings-nav li {
    margin-right: 16px;
}

.settings-nav a {
    display: block;
    padding: 8px 0;
    text-decoration: none;
    color: var(--text-color);
    border-bottom: 2px solid transparent;
}

.settings-nav a.active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
}

.settings-content {
    padding-top: 16px;
}

.settings-section {
    display: none;
}

.settings-section.active {
    display: block;
}

.setting-item {
    margin-bottom: 16px;
}

/* Quick-links / Nav settings: draggable rows and visual styling */
.setting-item {
    transition: transform 200ms ease, box-shadow 180ms ease, background-color 180ms ease;
    border-radius: 10px;
    border: none;
    background: var(--pop-up-color);
    padding: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.setting-item .move-handle {
    touch-action: none;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-color);
    cursor: grab;
    user-select: none;
}
.setting-item .move-handle:active { cursor: grabbing; }
.setting-item.dragging {
    opacity: 0.95;
    transform: scale(1.02);
    box-shadow: 0 18px 40px rgba(0,0,0,0.16);
    z-index: 9999;
}
.setting-item.placeholder {
    border: 2px dashed var(--primary-color);
    background: linear-gradient(180deg, rgba(0,0,0,0.02), rgba(0,0,0,0.01));
    height: 48px;
    margin: 6px 0;
    border-radius: 8px;
}
.setting-item.moved {
    animation: moved-highlight 360ms ease;
}
@keyframes moved-highlight {
    0% { transform: translateY(6px) scale(0.995); box-shadow: 0 8px 20px rgba(0,0,0,0.08); }
    50% { transform: translateY(-2px) scale(1.01); }
    100% { transform: none; box-shadow: 0 1px 4px rgba(0,0,0,0.04); }
}


.setting-item label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

.setting-item select, .setting-item input {
    padding: 8px;
    border: var(--border-primary);
    border-radius: var(--border-radius);
    font-size: var(--font-size-base);
}

.radio-group {
    display: flex;
    gap: 16px;
}

.radio-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.radio-group input {
    margin-right: 4px;
}

/* Full Modal */
.modal-full .modal-content {
    width: 100%;
    height: 100vh;
    max-width: none;
    max-height: none;
    transform: none;
    top: 0;
    left: 0;
    padding: 0;
}

/* Full Modal on Desktop - XL size */
@media (min-width: 1024px) {
    .modal-full .modal-content {
        width: 90vw;
        height: 90dvh;
        max-width: 950px;
        transform: translate(-50%, -50%);
        top: 50%;
        left: 50%;
    }
}

/* Full Modal on Mobile */
@media (max-width: 767px) {
    .modal-full .modal-content {
        width: 100%;
        height: 100vh;
        top: 0;
        left: 0;
        transform: none;
    }
}

/* Files table and dropbox widget */
.file-table {
    width: 100%;
    border-collapse: collapse;
    overflow-x: hidden;
    table-layout: fixed;
}
.file-table th, .file-table td {
    padding: 8px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    text-align: left;
}

/* Ensure table wrapper doesn't cause horizontal overflow */
#files-table-wrap {
    overflow-x: hidden;
    overflow-y: auto;
    height: calc(100vh - 120px);
}
.file-table a {
    text-decoration: none;
    color: var(--text-color);
    cursor: pointer;
}
.dropbox {
    position: fixed;
    right: 20px;
    bottom: 80px;
    width: 340px;
    background: var(--pop-up-color);
    border: var(--border-primary);
    border-radius: 8px;
    box-shadow: var(--box-shadow-frosted);
    z-index: 10000;
}
.dropbox .dropbox-inner { padding: 16px; }
.dropbox-hint { margin-top: 8px; color: var(--secondary-color-text); font-size: 13px; }

.dropbox.drag-over { outline: 2px dashed var(--primary-color); background: color-mix(in srgb, var(--primary-color) 8%, transparent); }

.nav-dropbox {
    position: absolute;
    bottom: 80px;
    left: 16px;
    right: 16px;
    width: auto;
    background: var(--pop-up-color);
    border: var(--border-primary);
    border-radius: 8px;
    box-shadow: var(--box-shadow-frosted);
    z-index: 10000;
}
.nav-dropbox .dropbox-inner { padding: 16px; }

.dropbox.drag-over, .nav-dropbox.drag-over { outline: 2px dashed var(--primary-color); background: color-mix(in srgb, var(--primary-color) 8%, transparent); }

/* Icon buttons for file actions */
.icon-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-color);
}
.icon-btn:hover { background: rgba(0,0,0,0.04); }
.icon-btn svg { width: 18px; height: 18px; display: block; }

/* File preview modal tweaks */
#file-preview-body img, #file-preview-body video, #file-preview-body iframe { max-width: 100%; height: auto; display: block; margin: 0 auto; }
#file-preview-body pre { white-space: pre-wrap; word-break: break-word; }

/* Row actions dropdown */
.row-actions-dropdown {
    position: absolute;
    z-index: 1000;
    background: var(--pop-up-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px;
    min-width: 120px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    pointer-events: auto;
}

.row-actions-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.row-actions-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
}

.row-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-color);
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    width: 100%;
    text-align: left;
    white-space: nowrap;
}

.row-action-btn:hover {
    background: var(--hover-bg);
}

.row-action-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.row-action-danger {
    color: var(--danger-color);
}

.row-action-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Row actions dropdown */
.row-actions-dropdown {
    position: absolute;
    top: 100%;
    z-index: 1000;
    background: var(--pop-up-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px;
    min-width: 120px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    margin-top: 4px;
}

.row-actions-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.row-actions-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
}

.row-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-color);
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    width: 100%;
    text-align: left;
}

.row-action-btn:hover {
    background: var(--hover-bg);
}

.row-action-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.row-action-danger {
    color: var(--danger-color);
}

.row-action-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}
 / *   F i l e   T r e e   S t y l e s   * / 
 . f i l e - t r e e   { 
         m a x - h e i g h t :   4 0 0 p x ; 
         o v e r f l o w - y :   a u t o ; 
         b o r d e r :   v a r ( - - b o r d e r - p r i m a r y ) ; 
         b o r d e r - r a d i u s :   v a r ( - - b o r d e r - r a d i u s ) ; 
         b a c k g r o u n d :   v a r ( - - i n p u t - b g ) ; 
 } 
 
 . f i l e - t r e e - i t e m   { 
         d i s p l a y :   f l e x ; 
         a l i g n - i t e m s :   c e n t e r ; 
         p a d d i n g :   8 p x   1 2 p x ; 
         c u r s o r :   p o i n t e r ; 
         b o r d e r - b o t t o m :   1 p x   s o l i d   v a r ( - - b o r d e r - c o l o r ) ; 
         t r a n s i t i o n :   b a c k g r o u n d - c o l o r   0 . 1 5 s   e a s e ; 
 } 
 
 . f i l e - t r e e - i t e m : h o v e r   { 
         b a c k g r o u n d :   v a r ( - - h o v e r - b g ) ; 
 } 
 
 . f i l e - t r e e - i t e m . s e l e c t e d   { 
         b a c k g r o u n d :   v a r ( - - p r i m a r y - c o l o r - l i g h t ) ; 
         c o l o r :   v a r ( - - b t n - p r i m a r y - t e x t ) ; 
 } 
 
 . f i l e - t r e e - i t e m   . t r e e - i c o n   { 
         w i d t h :   2 0 p x ; 
         h e i g h t :   2 0 p x ; 
         m a r g i n - r i g h t :   8 p x ; 
         f l e x - s h r i n k :   0 ; 
         d i s p l a y :   f l e x ; 
         a l i g n - i t e m s :   c e n t e r ; 
         j u s t i f y - c o n t e n t :   c e n t e r ; 
 } 
 
 . f i l e - t r e e - i t e m   . t r e e - i c o n . e x p a n d e d : : b e f o r e   { 
         c o n t e n t :   ' ' ; 
 } 
 
 . f i l e - t r e e - i t e m   . t r e e - i c o n . c o l l a p s e d : : b e f o r e   { 
         c o n t e n t :   ' ' ; 
 } 
 
 . f i l e - t r e e - i t e m   . t r e e - i c o n . f i l e : : b e f o r e   { 
         c o n t e n t :   ' ' ; 
 } 
 
 . f i l e - t r e e - i t e m   . t r e e - l a b e l   { 
         f l e x :   1 ; 
         f o n t - s i z e :   1 4 p x ; 
 } 
 
 . f i l e - t r e e - c h i l d r e n   { 
         m a r g i n - l e f t :   2 0 p x ; 
         b o r d e r - l e f t :   2 p x   s o l i d   v a r ( - - b o r d e r - c o l o r ) ; 
 } 
 
 . f i l e - t r e e - c h i l d r e n . h i d d e n   { 
         d i s p l a y :   n o n e ; 
 } 
 
 . f i l e - t r e e - l o a d i n g   { 
         p a d d i n g :   2 0 p x ; 
         t e x t - a l i g n :   c e n t e r ; 
         c o l o r :   v a r ( - - t e x t - s e c o n d a r y ) ; 
         f o n t - s t y l e :   i t a l i c ; 
 } 
 
 / *   F i l e   T r e e   S t y l e s   * / 
 
 . f i l e - t r e e   { 
 
         m a x - h e i g h t :   4 0 0 p x ; 
 
         o v e r f l o w - y :   a u t o ; 
 
         b o r d e r :   v a r ( - - b o r d e r - p r i m a r y ) ; 
 
         b o r d e r - r a d i u s :   v a r ( - - b o r d e r - r a d i u s ) ; 
 
         b a c k g r o u n d :   v a r ( - - i n p u t - b g ) ; 
 
 } 
 
 
 
 . f i l e - t r e e - i t e m   { 
 
         d i s p l a y :   f l e x ; 
 
         a l i g n - i t e m s :   c e n t e r ; 
 
         p a d d i n g :   8 p x   1 2 p x ; 
 
         c u r s o r :   p o i n t e r ; 
 
         b o r d e r - b o t t o m :   1 p x   s o l i d   v a r ( - - b o r d e r - c o l o r ) ; 
 
         t r a n s i t i o n :   b a c k g r o u n d - c o l o r   0 . 1 5 s   e a s e ; 
 
 } 
 
 
 
 . f i l e - t r e e - i t e m : h o v e r   { 
 
         b a c k g r o u n d :   v a r ( - - h o v e r - b g ) ; 
 
 } 
 
 
 
 . f i l e - t r e e - i t e m . s e l e c t e d   { 
 
         b a c k g r o u n d :   v a r ( - - p r i m a r y - c o l o r - l i g h t ) ; 
 
         c o l o r :   v a r ( - - b t n - p r i m a r y - t e x t ) ; 
 
 } 
 
 
 
 . f i l e - t r e e - i t e m   . t r e e - i c o n   { 
 
         w i d t h :   2 0 p x ; 
 
         h e i g h t :   2 0 p x ; 
 
         m a r g i n - r i g h t :   8 p x ; 
 
         f l e x - s h r i n k :   0 ; 
 
         d i s p l a y :   f l e x ; 
 
         a l i g n - i t e m s :   c e n t e r ; 
 
         j u s t i f y - c o n t e n t :   c e n t e r ; 
 
 } 
 
 
 
 . f i l e - t r e e - i t e m   . t r e e - i c o n . e x p a n d e d : : b e f o r e   { 
 
         c o n t e n t :   ' � x  ' ; 
 
 } 
 
 
 
 . f i l e - t r e e - i t e m   . t r e e - i c o n . c o l l a p s e d : : b e f o r e   { 
 
         c o n t e n t :   ' � x � ' ; 
 
 } 
 
 
 
 . f i l e - t r e e - i t e m   . t r e e - i c o n . f i l e : : b e f o r e   { 
 
         c o n t e n t :   ' � x  ' ; 
 
 } 
 
 
 
 . f i l e - t r e e - i t e m   . t r e e - l a b e l   { 
 
         f l e x :   1 ; 
 
         f o n t - s i z e :   1 4 p x ; 
 
 } 
 
 
 
 . f i l e - t r e e - c h i l d r e n   { 
 
         m a r g i n - l e f t :   2 0 p x ; 
 
         b o r d e r - l e f t :   2 p x   s o l i d   v a r ( - - b o r d e r - c o l o r ) ; 
 
 } 
 
 
 
 . f i l e - t r e e - c h i l d r e n . h i d d e n   { 
 
         d i s p l a y :   n o n e ; 
 
 } 
 
 
 
 . f i l e - t r e e - l o a d i n g   { 
 
         p a d d i n g :   2 0 p x ; 
 
         t e x t - a l i g n :   c e n t e r ; 
 
         c o l o r :   v a r ( - - t e x t - s e c o n d a r y ) ; 
 
         f o n t - s t y l e :   i t a l i c ; 
 
 } 
 
 . f i l e - t r e e - i t e m   . t r e e - i c o n . e x p a n d e d : : b e f o r e   {   c o n t e n t :   " " ;   } 
 
 . f i l e - t r e e - i t e m   . t r e e - i c o n . e x p a n d e d : : b e f o r e   {   c o n t e n t :   " " ;   } 
 
 . f i l e - t r e e - i t e m   . t r e e - i c o n . c o l l a p s e d : : b e f o r e   {   c o n t e n t :   " " ;   } 
 
 . f i l e - t r e e - i t e m   . t r e e - i c o n . f i l e : : b e f o r e   {   c o n t e n t :   " " ;   } 
 
 / *   F i l e   T r e e   S t y l e s   * / 
 
 . f i l e - t r e e   {   m a x - h e i g h t :   4 0 0 p x ;   o v e r f l o w - y :   a u t o ;   b o r d e r :   v a r ( - - b o r d e r - p r i m a r y ) ;   b o r d e r - r a d i u s :   v a r ( - - b o r d e r - r a d i u s ) ;   b a c k g r o u n d :   v a r ( - - i n p u t - b g ) ;   } 
 
 . f i l e - t r e e - i t e m   {   d i s p l a y :   f l e x ;   a l i g n - i t e m s :   c e n t e r ;   p a d d i n g :   8 p x   1 2 p x ;   c u r s o r :   p o i n t e r ;   b o r d e r - b o t t o m :   1 p x   s o l i d   v a r ( - - b o r d e r - c o l o r ) ;   t r a n s i t i o n :   b a c k g r o u n d - c o l o r   0 . 1 5 s   e a s e ;   } 
 
 . f i l e - t r e e - i t e m : h o v e r   {   b a c k g r o u n d :   v a r ( - - h o v e r - b g ) ;   } 
 
 . f i l e - t r e e - i t e m . s e l e c t e d   {   b a c k g r o u n d :   v a r ( - - p r i m a r y - c o l o r - l i g h t ) ;   c o l o r :   v a r ( - - b t n - p r i m a r y - t e x t ) ;   } 
 
 . f i l e - t r e e - i t e m   . t r e e - i c o n   {   w i d t h :   2 0 p x ;   h e i g h t :   2 0 p x ;   m a r g i n - r i g h t :   8 p x ;   f l e x - s h r i n k :   0 ;   d i s p l a y :   f l e x ;   a l i g n - i t e m s :   c e n t e r ;   j u s t i f y - c o n t e n t :   c e n t e r ;   } 
 
 . f i l e - t r e e - i t e m   . t r e e - l a b e l   {   f l e x :   1 ;   f o n t - s i z e :   1 4 p x ;   } 
 
 . f i l e - t r e e - c h i l d r e n   {   m a r g i n - l e f t :   2 0 p x ;   b o r d e r - l e f t :   2 p x   s o l i d   v a r ( - - b o r d e r - c o l o r ) ;   } 
 
 . f i l e - t r e e - c h i l d r e n . h i d d e n   {   d i s p l a y :   n o n e ;   } 
 
 / *   P r e v e n t   m o d a l   s h a k i n g   * / 
 
 . m o d a l   {   a n i m a t i o n :   n o n e ;   } 
 
 . m o d a l . s h o w   {   a n i m a t i o n :   n o n e ;   } 
 
 . f i l e - t r e e - i t e m   {   t r a n s i t i o n :   n o n e ;   } 
 
 . f i l e - t r e e - i t e m   . t r e e - i c o n . e x p a n d e d : : b e f o r e   {   c o n t e n t :   " " ;   } 
 
 . f i l e - t r e e - i t e m   . t r e e - i c o n . c o l l a p s e d : : b e f o r e   {   c o n t e n t :   " " ;   } 
 
 . f i l e - t r e e - i t e m   . t r e e - i c o n . f i l e : : b e f o r e   {   c o n t e n t :   " " ;   } 
 
 .file-tree-item .tree-icon.expanded::before { content: ""; }
.file-tree-item .tree-icon { font-family: "Segoe UI Emoji", "Segoe UI Symbol", "Apple Color Emoji", "Noto Color Emoji"; }
.file-tree-item { display: flex; align-items: center; padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border-color); transition: none; }
.file-tree-item:hover { background: var(--hover-bg); }
.file-tree-item.selected { background: var(--primary-color-light); color: var(--btn-primary-text); }
.file-tree-item .tree-icon { width: 20px; height: 20px; margin-right: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.file-tree-item .tree-label { flex: 1; font-size: 14px; }
/* Hover Popovers */
.hover-popover { position: absolute; background: var(--popover-bg); border: var(--popover-border); border-radius: var(--popover-border-radius); box-shadow: var(--popover-shadow); padding: 8px 12px; font-size: 12px; color: var(--text-color); white-space: nowrap; z-index: 1000; opacity: 0; visibility: hidden; transition: opacity 0.2s ease, visibility 0.2s ease; pointer-events: none; }
.hover-popover.show { opacity: 1; visibility: visible; }

/* Mobile touch scrolling fixes */
@media (max-width: 767px) {
    /* Prevent unwanted touch scrolling on file panels */
    #files-view {
        touch-action: pan-y;
        overflow: visible;
    }

    #files-table-wrap {
        touch-action: pan-y;
        overflow-x: hidden;
        overflow-y: auto;
        height: calc(100vh - 120px);
        -webkit-overflow-scrolling: touch;
    }

    .file-table {
        touch-action: pan-x pinch-zoom;
        overflow-x: hidden;
        overflow-y: auto;
        width: 100%;
        table-layout: fixed;
    }

    /* Allow vertical scrolling only where needed */
    .main-render {
        touch-action: pan-y pinch-zoom;
        overflow-x: hidden;
        overflow-y: auto;
    }
}

/* ============================================
   Markup Editor Modal Styles
   ============================================ */

#markup-editor-modal.modal-full {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2200000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#markup-editor-modal.modal-full.show {
    display: block;
    opacity: 1;
}

#markup-editor-modal .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2200001;
}

#markup-editor-modal .modal-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 95%;
    max-width: 1600px;
    height: 90vh;
    background: var(--surface-color, white);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 2200002;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#markup-editor-modal .modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-primary, #ddd);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--header-bg, #f5f5f5);
}

#markup-editor-modal .modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--text-color, #333);
}

#markup-editor-modal .modal-close-btn {
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-color, #333);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

#markup-editor-modal .modal-close-btn:hover {
    background: var(--hover-bg, rgba(0, 0, 0, 0.1));
}

#markup-editor-modal .modal-body {
    flex: 1;
    padding: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#markup-editor-modal #markup-editor-text {
    width: 100%;
    height: 100%;
    border: 1px solid var(--border-primary, #ddd);
    border-radius: 4px;
    padding: 12px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    background: var(--code-bg, #f8f8f8);
    color: var(--code-fg, #333);
}

#markup-editor-modal .CodeMirror {
    height: 100%;
    border: 1px solid var(--border-primary, #ddd);
    border-radius: 4px;
    font-size: 14px;
}

/* Navigation list item styling improvements */
.nav-link-item {
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.nav-link-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-link-item input:focus {
    outline: 2px solid var(--primary-color, #007bff);
    outline-offset: 2px;
}



/* Mobile and tablet responsive fixes for markup editor modal */
@media (max-width: 1024px) {
    #markup-editor-modal .modal-content {
        width: 95%;
        max-width: none;
        height: 85vh;
        z-index: 2200002 !important;
    }
}

@media (max-width: 768px) {
    #markup-editor-modal.modal-full {
        z-index: 2200000 !important;
    }
    
    #markup-editor-modal .modal-overlay {
        z-index: 2200001 !important;
    }
    
    #markup-editor-modal .modal-content {
        width: 98%;
        height: 90vh;
        max-height: calc(100vh - 40px);
        z-index: 2200002 !important;
        border-radius: 12px;
    }
    
    #markup-editor-modal .modal-header {
        padding: 12px 16px;
    }
    
    #markup-editor-modal .modal-body {
        padding: 12px;
    }
    
    #markup-editor-modal .CodeMirror {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    #markup-editor-modal .modal-content {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        transform: translate(-50%, -50%);
    }
    
    #markup-editor-modal .modal-header h2 {
        font-size: 16px;
    }
    
    #markup-editor-modal .CodeMirror {
        font-size: 12px;
    }
}


/* Extra large desktop - maximize modal size */
@media (min-width: 1400px) {
    #markup-editor-modal .modal-content {
        width: 95%;
        max-width: 1800px;
        height: 92vh;
    }
}

@media (min-width: 1920px) {
    #markup-editor-modal .modal-content {
        width: 90%;
        max-width: 2000px;
        height: 92vh;
    }
}
