/* ============================================
   EVERPROXY HYPER-CUSTOMIZATION CSS
   200+ CSS Variables for Ultimate Control
   ============================================ */

:root {
    /* ========================================
       GLOBAL SETTINGS
       ======================================== */
    --ui-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --ui-font-size-base: 14px;
    --ui-font-weight-normal: 400;
    --ui-font-weight-medium: 500;
    --ui-font-weight-bold: 600;
    --ui-line-height: 1.5;
    --ui-letter-spacing: 0px;

    /* Animation */
    --anim-speed: 0.2s;
    --anim-easing: ease;
    --anim-speed-fast: 0.1s;
    --anim-speed-slow: 0.4s;

    /* Borders & Radius */
    --radius-none: 0px;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-none: none;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* Glass/Blur */
    --glass-blur: 10px;
    --glass-opacity: 0.8;

    /* Scrollbar */
    --scrollbar-width: 8px;
    --scrollbar-thumb-color: rgba(0, 0, 0, 0.2);
    --scrollbar-track-color: transparent;
    --scrollbar-radius: 4px;

    /* ========================================
       LAYOUT STRUCTURE
       ======================================== */
    --layout-direction: column;
    --tabbar-position: top;
    /* top, bottom */
    --toolbar-position: top;
    /* top, bottom */
    --sidebar-position: left;
    /* left, right, hidden */
    --urlbar-position: center;
    /* left, center, right */
    --buttons-left-order: 1;
    --buttons-right-order: 2;

    /* ========================================
       TAB BAR (30+ options)
       ======================================== */
    --tabbar-height: 42px;
    --tabbar-padding: 8px;
    --tabbar-bg: var(--toolbar-bg);
    --tabbar-border-width: 1px;
    --tabbar-border-color: var(--border-color);
    --tabbar-gap: 4px;
    --tabbar-scroll-behavior: auto;

    /* Individual Tabs */
    --tab-min-width: 120px;
    --tab-max-width: 240px;
    --tab-height: 34px;
    --tab-padding-x: 12px;
    --tab-padding-y: 6px;
    --tab-radius: 8px;
    --tab-radius-style: top;
    /* top, all, none */
    --tab-font-size: 12px;
    --tab-font-weight: 500;
    --tab-gap: 8px;
    --tab-border-width: 1px;

    /* Tab Colors */
    --tab-bg: var(--tab-inactive);
    --tab-bg-hover: var(--tab-hover);
    --tab-bg-active: var(--tab-active);
    --tab-text-color: var(--text-color);
    --tab-text-color-active: var(--text-color);
    --tab-border-color: transparent;
    --tab-border-color-active: var(--accent-color);

    /* Tab Components */
    --tab-favicon-size: 16px;
    --tab-favicon-show: block;
    /* block, none */
    --tab-favicon-radius: 2px;
    --tab-title-show: block;
    /* block, none */
    --tab-title-max-width: 120px;
    --tab-close-size: 16px;
    --tab-close-show: block;
    /* block, none */
    --tab-close-opacity: 0.6;
    --tab-close-hover-opacity: 1;
    --tab-close-bg: transparent;
    --tab-close-bg-hover: rgba(0, 0, 0, 0.1);

    /* Tab States */
    --tab-inactive-opacity: 0.8;
    --tab-active-shadow: var(--shadow-sm);
    --tab-pinned-width: 42px;
    --tab-loading-color: var(--accent-color);

    /* New Tab Button */
    --newtab-size: 28px;
    --newtab-bg: transparent;
    --newtab-bg-hover: var(--btn-hover-bg);
    --newtab-radius: var(--radius-md);
    --newtab-icon-size: 18px;

    /* ========================================
       TOOLBAR (30+ options)
       ======================================== */
    --toolbar-height: 52px;
    --toolbar-padding-x: 16px;
    --toolbar-padding-y: 8px;
    --toolbar-bg: var(--ui-bg);
    --toolbar-border-width: 1px;
    --toolbar-border-color: var(--border-color);
    --toolbar-gap: 12px;
    --toolbar-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);

    /* Navigation Buttons */
    --btn-size: 34px;
    --btn-radius: 50%;
    --btn-bg: transparent;
    --btn-bg-hover: rgba(0, 0, 0, 0.08);
    --btn-bg-active: rgba(0, 0, 0, 0.12);
    --btn-border-width: 0px;
    --btn-border-color: transparent;
    --btn-shadow: none;

    /* Button Icons */
    --btn-icon-size: 20px;
    --btn-icon-color: var(--text-color);
    --btn-icon-color-hover: var(--text-color);
    --btn-icon-color-disabled: rgba(0, 0, 0, 0.3);

    /* Button Visibility */
    --btn-back-show: flex;
    --btn-forward-show: flex;
    --btn-refresh-show: flex;
    --btn-bookmark-show: flex;
    --btn-devtools-show: flex;
    --btn-history-show: flex;
    --btn-settings-show: flex;

    /* ========================================
       ADDRESS BAR / URL BAR (25+ options)
       ======================================== */
    --urlbar-width: 100%;
    --urlbar-max-width: none;
    --urlbar-height: 38px;
    --urlbar-padding-x: 16px;
    --urlbar-padding-left: 40px;
    --urlbar-radius: 24px;
    --urlbar-bg: var(--input-bg);
    --urlbar-bg-focus: var(--ui-bg);
    --urlbar-border-width: 1px;
    --urlbar-border-color: var(--border-color);
    --urlbar-border-color-focus: var(--accent-color);
    --urlbar-shadow: none;
    --urlbar-shadow-focus: 0 0 0 2px rgba(59, 130, 246, 0.2);
    --urlbar-font-size: 14px;
    --urlbar-font-weight: 400;
    --urlbar-text-color: var(--text-color);
    --urlbar-placeholder-color: rgba(0, 0, 0, 0.4);

    /* URL Bar Icon */
    --urlbar-icon-size: 18px;
    --urlbar-icon-color: var(--text-color);
    --urlbar-icon-left: 12px;

    /* Go Button */
    --go-btn-show: flex;
    --go-btn-bg: var(--accent-color);
    --go-btn-text: white;
    --go-btn-padding: 8px 16px;
    --go-btn-radius: var(--radius-md);

    /* ========================================
       BOOKMARKS BAR (15+ options)
       ======================================== */
    --bookmarks-height: 32px;
    --bookmarks-padding: 4px 8px;
    --bookmarks-bg: var(--ui-bg);
    --bookmarks-border-width: 1px;
    --bookmarks-border-color: var(--border-color);
    --bookmarks-show: none;
    /* flex, none */

    --bookmark-item-padding: 4px 8px;
    --bookmark-item-radius: var(--radius-sm);
    --bookmark-item-bg-hover: var(--btn-hover-bg);
    --bookmark-favicon-size: 14px;
    --bookmark-font-size: 12px;

    /* ========================================
       WEBVIEW CONTAINER
       ======================================== */
    --webview-bg: white;
    --webview-border-radius: 0px;
    --webview-shadow: none;
    --webview-border: none;

    /* Loading Overlay */
    --loading-bg: var(--ui-bg);
    --loading-bar-height: 3px;
    --loading-bar-color: var(--accent-color);
    --loading-bar-radius: 2px;

    /* ========================================
       DEVTOOLS (20+ options)
       ======================================== */
    --devtools-height: 300px;
    --devtools-bg: var(--ui-bg);
    --devtools-border-color: var(--border-color);
    --devtools-tab-height: 36px;
    --devtools-tab-bg: transparent;
    --devtools-tab-bg-active: var(--accent-color);
    --devtools-tab-text: var(--text-color);
    --devtools-tab-text-active: white;
    --devtools-font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    --devtools-font-size: 12px;

    /* Console */
    --console-log-color: var(--text-color);
    --console-warn-color: #f59e0b;
    --console-error-color: #ef4444;
    --console-info-color: #3b82f6;

    /* ========================================
       CONTEXT MENU
       ======================================== */
    --context-bg: var(--ui-bg);
    --context-border: 1px solid var(--border-color);
    --context-radius: var(--radius-md);
    --context-shadow: var(--shadow-lg);
    --context-item-padding: 8px 16px;
    --context-item-hover: var(--btn-hover-bg);

    /* ========================================
       MODALS & OVERLAYS
       ======================================== */
    --modal-bg: var(--ui-bg);
    --modal-radius: var(--radius-lg);
    --modal-shadow: var(--shadow-xl);
    --modal-backdrop: rgba(0, 0, 0, 0.5);
    --modal-backdrop-blur: 4px;

    /* ========================================
       THEME COLORS - Light Mode Default
       ======================================== */
    --bg-color: #f8f9fa;
    --ui-bg: #ffffff;
    --toolbar-bg: #f1f3f4;
    --tab-inactive: #e8eaed;
    --tab-active: #ffffff;
    --tab-hover: #dadce0;
    --text-color: #3c4043;
    --text-color-secondary: #5f6368;
    --accent-color: #1a73e8;
    --accent-color-hover: #1557b0;
    --border-color: #dadce0;
    --input-bg: #f1f3f4;
    --success-color: #34a853;
    --warning-color: #fbbc04;
    --error-color: #ea4335;

    /* ========================================
       STARTUP ANIMATION
       ======================================== */
    --startup-show: none;
    /* block, none */
    --startup-bg: var(--bg-color);
    --startup-duration: 2s;
}

/* ============================================
   DARK THEME
   ============================================ */
[data-theme="dark"] {
    --bg-color: #09090b;
    --ui-bg: rgba(24, 24, 27, 0.9);
    --toolbar-bg: rgba(39, 39, 42, 0.8);
    --tab-inactive: transparent;
    --tab-active: rgba(63, 63, 70, 0.6);
    --tab-hover: rgba(63, 63, 70, 0.4);
    --text-color: #fafafa;
    --text-color-secondary: #a1a1aa;
    --accent-color: #8b5cf6;
    --accent-color-hover: #7c3aed;
    --border-color: rgba(255, 255, 255, 0.08);
    --input-bg: rgba(0, 0, 0, 0.3);
    --scrollbar-thumb-color: rgba(255, 255, 255, 0.2);
    --urlbar-placeholder-color: rgba(255, 255, 255, 0.4);
    --btn-bg-hover: rgba(255, 255, 255, 0.08);
    --btn-icon-color-disabled: rgba(255, 255, 255, 0.2);
}

[data-theme="midnight"] {
    --bg-color: #0d1117;
    --ui-bg: #161b22;
    --toolbar-bg: #21262d;
    --tab-inactive: #21262d;
    --tab-active: #30363d;
    --tab-hover: #30363d;
    --text-color: #c9d1d9;
    --text-color-secondary: #8b949e;
    --accent-color: #58a6ff;
    --border-color: #30363d;
    --input-bg: #21262d;
}

[data-theme="rose"] {
    --bg-color: #1a1118;
    --ui-bg: #2d1f29;
    --toolbar-bg: #3d2a35;
    --tab-inactive: #2d1f29;
    --tab-active: #4a3545;
    --tab-hover: #3d2a35;
    --text-color: #f8e8ee;
    --accent-color: #ff6b9d;
    --border-color: #4a3545;
    --input-bg: #2d1f29;
}

/* ============================================
   BASE STYLES
   ============================================ */
* {
    box-sizing: border-box;
    transition-property: background-color, color, border-color, opacity, transform, box-shadow;
    transition-duration: var(--anim-speed);
    transition-timing-function: var(--anim-easing);
}

/* Robust Scrollbar Selectors */
*::-webkit-scrollbar,
html::-webkit-scrollbar,
body::-webkit-scrollbar,
#browser-content::-webkit-scrollbar,
#tab-bar::-webkit-scrollbar {
    width: var(--scrollbar-width);
    height: var(--scrollbar-width);
    background: transparent;
    /* Track area transparent */
}

*::-webkit-scrollbar-thumb,
html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
#browser-content::-webkit-scrollbar-thumb,
#tab-bar::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb-color);
    border-radius: var(--scrollbar-radius);
    border: 2px solid transparent;
    /* Creates padding effect if background-clip is content-box, or just solid */
    background-clip: content-box;
    /* Optional: simpler solid color for now */
    /* Let's stick to simple solid color as per user request */
    background: var(--scrollbar-thumb-color);
    border: none;
    border-radius: var(--scrollbar-radius);
}

*::-webkit-scrollbar-track,
html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
#browser-content::-webkit-scrollbar-track,
#tab-bar::-webkit-scrollbar-track {
    background: var(--scrollbar-track-color);
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--ui-font-family);
    font-size: var(--ui-font-size-base);
    font-weight: var(--ui-font-weight-normal);
    line-height: var(--ui-line-height);
    letter-spacing: var(--ui-letter-spacing);
    background: var(--bg-color);
    background-image: radial-gradient(circle at 15% 50%, rgba(139, 92, 246, 0.05), transparent 25%), radial-gradient(circle at 85% 30%, rgba(56, 189, 248, 0.05), transparent 25%);
    background-attachment: fixed;
    color: var(--text-color);
    display: flex;
    flex-direction: var(--layout-direction);
}

/* ============================================
   BROWSER UI CONTAINER
   ============================================ */
#browser-ui {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
}

/* Tab Bar Positioning */
/* Default is Top (column) */
/* Bottom: Reverse column so TabBar (1st in DOM) goes to bottom */
html[data-config-tabbar-position="bottom"] #browser-ui {
    flex-direction: column-reverse;
}

html[data-config-tabbar-position="left"] #browser-ui {
    flex-direction: row;
}

html[data-config-tabbar-position="right"] #browser-ui {
    flex-direction: row-reverse;
}

#browser-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    overflow: hidden;
    position: relative;
}

html[data-config-toolbar-position="left"] #browser-content {
    flex-direction: row;
}

html[data-config-toolbar-position="right"] #browser-content {
    flex-direction: row-reverse;
}

/* Vertical Toolbar Styles */
html[data-config-toolbar-position="left"] #toolbar,
html[data-config-toolbar-position="right"] #toolbar {
    flex-direction: column;
    width: 60px;
    /* Slim vertical toolbar */
    height: 100%;
    padding: 10px 0;
    border-bottom: none;
    order: 0;
}

html[data-config-toolbar-position="left"] #toolbar {
    border-right: var(--toolbar-border-width) solid var(--toolbar-border-color);
}

html[data-config-toolbar-position="right"] #toolbar {
    border-left: var(--toolbar-border-width) solid var(--toolbar-border-color);
}

/* Vertical Toolbar Adjustments */
html[data-config-toolbar-position="left"] #url-bar-container,
html[data-config-toolbar-position="right"] #url-bar-container {
    display: none;
    /* Hide URL bar in vertical toolbar mode usually, or move it elsewhere? User didn't specify, but vertical URL bar is weird. Let's hide or make it icon-only? Or maybe they want it vertical? Assuming hide/popout for now or just standard vertical flow which might break layout. safely keep it flows vertically. */
    /* Let's try to let it flow but Rotate? pure vertical flex */
    writing-mode: vertical-lr;
    transform: rotate(180deg);
    /* Text orientation */
}

/* Actually vertical toolbar usually implies vertical button stack */


/* Vertical Tab Bar Styles */
html[data-config-tabbar-position="left"] #tab-bar,
html[data-config-tabbar-position="right"] #tab-bar {
    flex-direction: column;
    min-width: 200px;
    max-width: 260px;
    height: 100vh;
    border-bottom: none;
    border-right: var(--tabbar-border-width) solid var(--tabbar-border-color);
    padding-bottom: var(--tabbar-padding);
    padding-right: 0;
    overflow-y: auto;
    overflow-x: hidden;
    order: 0;
}

html[data-config-tabbar-position="right"] #tab-bar {
    border-right: none;
    border-left: var(--tabbar-border-width) solid var(--tabbar-border-color);
}

html[data-config-tabbar-position="left"] .tab,
html[data-config-tabbar-position="right"] .tab {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin-bottom: var(--tab-gap);
    border-bottom: var(--tab-border-width) solid var(--tab-border-color);
}


/* Toolbar Positioning */
/* When bottom, move it to end of flex container */
html[data-config-toolbar-position="bottom"] #toolbar {
    order: 10;
    border-top: var(--toolbar-border-width) solid var(--toolbar-border-color);
    border-bottom: none;
}

#tab-bar {
    order: var(--tabbar-order, 0);
    display: flex;
    align-items: flex-end;
    gap: var(--tabbar-gap);
    min-height: var(--tabbar-height);
    padding: var(--tabbar-padding);
    padding-bottom: 0;
    background: var(--tabbar-bg);
    backdrop-filter: blur(var(--glass-blur));
    border-bottom: var(--tabbar-border-width) solid var(--tabbar-border-color);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

#tab-bar::-webkit-scrollbar {
    height: 4px;
}

.tab {
    display: flex;
    align-items: center;
    gap: var(--tab-gap);
    min-width: var(--tab-min-width);
    max-width: var(--tab-max-width);
    height: var(--tab-height);
    padding: var(--tab-padding-y) var(--tab-padding-x);
    background: var(--tab-bg);
    border: var(--tab-border-width) solid var(--tab-border-color);
    border-bottom: none;
    border-radius: var(--tab-radius) var(--tab-radius) 0 0;
    font-size: var(--tab-font-size);
    font-weight: var(--tab-font-weight);
    color: var(--tab-text-color);
    opacity: var(--tab-inactive-opacity);
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
}

.tab:hover {
    background: var(--tab-bg-hover);
    opacity: 1;
}

.tab.active {
    background: var(--tab-bg-active);
    border-color: var(--tab-border-color-active);
    color: var(--tab-text-color-active);
    opacity: 1;
    box-shadow: var(--tab-active-shadow);
}

.tab-favicon {
    width: var(--tab-favicon-size);
    height: var(--tab-favicon-size);
    border-radius: var(--tab-favicon-radius);
    display: var(--tab-favicon-show);
    object-fit: contain;
    flex-shrink: 0;
}

body.hide-favicons .tab-favicon {
    display: none !important;
}

.tab-title {
    display: var(--tab-title-show);
    max-width: var(--tab-title-max-width);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.tab-close {
    display: var(--tab-close-show);
    width: var(--tab-close-size);
    height: var(--tab-close-size);
    background: var(--tab-close-bg);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    opacity: var(--tab-close-opacity);
    padding: 0;
    font-size: 14px;
    line-height: 1;
    color: inherit;
    flex-shrink: 0;
}

.tab-close:hover {
    background: var(--tab-close-bg-hover);
    opacity: var(--tab-close-hover-opacity);
}

.tab.pinned {
    min-width: var(--tab-pinned-width);
    max-width: var(--tab-pinned-width);
}

.tab.pinned .tab-title,
.tab.pinned .tab-close {
    display: none;
}

#new-tab-btn {
    width: var(--newtab-size);
    height: var(--newtab-size);
    min-width: var(--newtab-size);
    background: var(--newtab-bg);
    border: none;
    border-radius: var(--newtab-radius);
    font-size: var(--newtab-icon-size);
    cursor: pointer;
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-bottom: 4px;
}

#new-tab-btn:hover {
    background: var(--newtab-bg-hover);
}

/* ============================================
   TOOLBAR
   ============================================ */
#toolbar {
    order: var(--toolbar-order, 0);
    display: flex;
    align-items: center;
    gap: var(--toolbar-gap);
    height: var(--toolbar-height);
    padding: var(--toolbar-padding-y) var(--toolbar-padding-x);
    background: var(--toolbar-bg);
    backdrop-filter: blur(var(--glass-blur));
    border-bottom: var(--toolbar-border-width) solid var(--toolbar-border-color);
    box-shadow: var(--toolbar-shadow);
}

#toolbar button {
    display: flex;
    /* var(--btn-show) handled inline or via specific IDs */
    align-items: center;
    justify-content: center;
    width: var(--btn-size);
    height: var(--btn-size);
    border-radius: var(--btn-radius);
    border: none;
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    transition: background 0.1s;
    font-size: var(--btn-icon-size);
}

.icon-btn img,
.icon-btn svg {
    width: var(--btn-icon-size);
    height: var(--btn-icon-size);
    opacity: 0.8;
    pointer-events: none;
    /* Let button handle clicks */
}

/* Invert icons to match text color if needed, or use CSS filter */
/* Assuming SVGs are black stroke */
[data-theme="dark"] .icon-btn img {
    filter: invert(0.9);
}

#toolbar button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--btn-size);
    height: var(--btn-size);
    padding: 0;
    background: var(--btn-bg);
    border: var(--btn-border-width) solid var(--btn-border-color);
    border-radius: var(--btn-radius);
    cursor: pointer;
    color: var(--btn-icon-color);
    box-shadow: var(--btn-shadow);
}

#toolbar button:hover {
    background: var(--btn-bg-hover);
    color: var(--btn-icon-color-hover);
}

#toolbar button:active {
    background: var(--btn-bg-active);
}

#toolbar button:disabled {
    color: var(--btn-icon-color-disabled);
    cursor: not-allowed;
}

#toolbar button:disabled:hover {
    background: var(--btn-bg);
}

#toolbar button.icon-btn svg {
    width: var(--btn-icon-size);
    height: var(--btn-icon-size);
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

/* Button Visibility - Increased specificity to override default flex */
#toolbar #back-btn {
    display: var(--btn-back-show);
}

#toolbar #forward-btn {
    display: var(--btn-forward-show);
}

#toolbar #refresh-btn {
    display: var(--btn-refresh-show);
}

#toolbar #bookmark-btn {
    display: var(--btn-bookmark-show);
}

#toolbar #devtools-btn {
    display: var(--btn-devtools-show);
}

#toolbar #history-btn {
    display: var(--btn-history-show);
}

#toolbar #settings-btn {
    display: var(--btn-settings-show);
}

/* ============================================
   URL BAR
   ============================================ */
#url-bar-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    max-width: var(--urlbar-max-width);
    margin: 0 auto;
    /* For alignment */
    justify-content: var(--urlbar-align, center);
}

#search-icon {
    position: absolute;
    left: var(--urlbar-icon-left);
    width: var(--urlbar-icon-size);
    height: var(--urlbar-icon-size);
    color: var(--urlbar-icon-color);
    pointer-events: none;
    z-index: 1;
}

#search-icon svg {
    width: 100%;
    height: 100%;
}

#url-bar {
    width: var(--urlbar-width);
    height: var(--urlbar-height);
    padding: 0 var(--urlbar-padding-x) 0 var(--urlbar-padding-left);
    background: var(--urlbar-bg);
    border: var(--urlbar-border-width) solid var(--urlbar-border-color);
    border-radius: var(--urlbar-radius);
    box-shadow: var(--urlbar-shadow);
    font-size: var(--urlbar-font-size);
    font-weight: var(--urlbar-font-weight);
    color: var(--urlbar-text-color);
    outline: none;
}

#url-bar::placeholder {
    color: var(--urlbar-placeholder-color);
}

#url-bar:focus {
    background: var(--urlbar-bg-focus);
    border-color: var(--urlbar-border-color-focus);
    box-shadow: var(--urlbar-shadow-focus);
}

/* Increased specificity to override #toolbar button { display: flex } */
#toolbar #go-btn {
    display: var(--go-btn-show);
    background: var(--go-btn-bg);
    color: var(--go-btn-text);
    padding: var(--go-btn-padding);
    border: none;
    border-radius: var(--go-btn-radius);
    font-weight: var(--ui-font-weight-medium);
    cursor: pointer;
}

#toolbar #go-btn:hover {
    opacity: 0.9;
}

/* ============================================
   BOOKMARKS BAR
   ============================================ */
#bookmarks-bar {
    display: var(--bookmarks-show);
    align-items: center;
    gap: 4px;
    height: var(--bookmarks-height);
    padding: var(--bookmarks-padding);
    background: var(--bookmarks-bg);
    border-bottom: var(--bookmarks-border-width) solid var(--bookmarks-border-color);
    overflow-x: auto;
}

#bookmarks-bar.bookmarks-bar-hidden {
    display: none;
}

#bookmarks-list-container {
    display: flex;
    gap: 4px;
}

.bookmark-item-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: var(--bookmark-item-padding);
    border-radius: var(--bookmark-item-radius);
    cursor: pointer;
    font-size: var(--bookmark-font-size);
    white-space: nowrap;
}

.bookmark-item-bar:hover {
    background: var(--bookmark-item-bg-hover);
}

.bookmark-item-bar img {
    width: var(--bookmark-favicon-size);
    height: var(--bookmark-favicon-size);
}

/* ============================================
   WEBVIEWS CONTAINER
   ============================================ */
#webviews-container {
    flex: 1;
    position: relative;
    background: var(--webview-bg);
    overflow: hidden;
    z-index: 1;
    /* Ensure it stays under overlays */
}

#webviews-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: var(--webview-border);
    border-radius: var(--webview-border-radius);
    box-shadow: var(--webview-shadow);
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: var(--loading-bar-height);
    background: var(--loading-bg);
    z-index: 100;
    opacity: 0;
    transition: opacity 0.2s;
}

.loading-overlay.visible {
    opacity: 1;
}

.loading-progress {
    height: 100%;
    background: var(--loading-bar-color);
    border-radius: var(--loading-bar-radius);
    width: 0%;
    transition: width 0.3s ease;
}

/* ============================================
   DEVTOOLS
   ============================================ */
#devtools-container {
    height: var(--devtools-height);
    background: var(--devtools-bg);
    border-top: 1px solid var(--devtools-border-color);
    display: flex;
    flex-direction: column;
}

#devtools-container.devtools-hidden {
    display: none;
}

#devtools-tabs {
    display: flex;
    height: var(--devtools-tab-height);
    background: var(--toolbar-bg);
    border-bottom: 1px solid var(--devtools-border-color);
}

.devtools-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
    background: var(--devtools-tab-bg);
    border: none;
    color: var(--devtools-tab-text);
    font-size: var(--devtools-font-size);
    cursor: pointer;
}

.devtools-tab:hover {
    background: var(--btn-bg-hover);
}

.devtools-tab.active {
    background: var(--devtools-tab-bg-active);
    color: var(--devtools-tab-text-active);
}

.devtools-tab-icon {
    width: 16px;
    height: 16px;
}

#devtools-content {
    flex: 1;
    overflow: hidden;
}

.devtools-panel {
    display: none;
    height: 100%;
    overflow: auto;
}

.devtools-panel.active {
    display: flex;
    flex-direction: column;
}

.devtools-panel-header {
    padding: 8px 12px;
    font-weight: var(--ui-font-weight-medium);
    background: var(--input-bg);
    border-bottom: 1px solid var(--border-color);
}

#console-output {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    font-family: var(--devtools-font-family);
    font-size: var(--devtools-font-size);
}

.console-message {
    padding: 4px 8px;
    border-bottom: 1px solid var(--border-color);
}

.console-message.log {
    color: var(--console-log-color);
}

.console-message.warn {
    color: var(--console-warn-color);
    background: rgba(245, 158, 11, 0.1);
}

.console-message.error {
    color: var(--console-error-color);
    background: rgba(239, 68, 68, 0.1);
}

.console-message.info {
    color: var(--console-info-color);
}

#console-input-container {
    padding: 8px;
    border-top: 1px solid var(--border-color);
}

#console-input {
    width: 100%;
    padding: 8px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: var(--devtools-font-family);
    font-size: var(--devtools-font-size);
    color: var(--text-color);
    outline: none;
}

#console-input:focus {
    border-color: var(--accent-color);
}

#network-list {
    flex: 1;
    overflow-y: auto;
}

.network-request {
    display: flex;
    gap: 12px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    font-family: var(--devtools-font-family);
    font-size: var(--devtools-font-size);
}

.network-method {
    min-width: 50px;
    font-weight: bold;
}

.network-url {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.network-status {
    min-width: 40px;
}

.network-status.success {
    color: var(--success-color);
}

.network-status.error {
    color: var(--error-color);
}

#elements-tree {
    flex: 1;
    overflow: auto;
    padding: 8px;
    font-family: var(--devtools-font-family);
    font-size: var(--devtools-font-size);
}

.dom-node {
    padding: 2px 0 2px 20px;
    cursor: pointer;
}

.dom-node:hover {
    background: var(--btn-bg-hover);
}

.dom-node.selected {
    background: var(--accent-color);
    color: white;
}

.dom-tag {
    color: #881280;
}

.dom-attr {
    color: #994500;
}

.dom-text {
    color: var(--text-color-secondary);
}

.dom-comment {
    color: #006400;
}

.dom-expander {
    display: inline-block;
    width: 12px;
    cursor: pointer;
    user-select: none;
}

/* ============================================
   CONTEXT MENU
   ============================================ */
#context-menu {
    position: fixed;
    background: var(--context-bg);
    border: var(--context-border);
    border-radius: var(--context-radius);
    box-shadow: var(--context-shadow);
    min-width: 180px;
    z-index: 10000;
    overflow: hidden;
}

#context-menu.context-menu-hidden {
    display: none;
}

.context-menu-item {
    padding: var(--context-item-padding);
    cursor: pointer;
    font-size: 13px;
}

.context-menu-item:hover {
    background: var(--context-item-hover);
}

.context-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* ============================================
   TAB SEARCH MODAL
   ============================================ */
#tab-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--modal-backdrop);
    backdrop-filter: blur(var(--modal-backdrop-blur));
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 100px;
    z-index: 10000;
}

#tab-search-modal.tab-search-hidden {
    display: none;
}

.tab-search-container {
    width: 500px;
    max-width: 90%;
    background: var(--modal-bg);
    border-radius: var(--modal-radius);
    box-shadow: var(--modal-shadow);
    overflow: hidden;
}

#tab-search-input {
    width: 100%;
    padding: 16px;
    border: none;
    border-bottom: 1px solid var(--border-color);
    font-size: 16px;
    background: transparent;
    color: var(--text-color);
    outline: none;
}

#tab-search-results {
    max-height: 400px;
    overflow-y: auto;
}

.tab-search-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
}

.tab-search-result:hover,
.tab-search-result.selected {
    background: var(--btn-bg-hover);
}

.tab-search-result-favicon {
    width: 20px;
    height: 20px;
    border-radius: 2px;
}

.tab-search-result-content {
    flex: 1;
    min-width: 0;
}

.tab-search-result-title {
    font-weight: var(--ui-font-weight-medium);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tab-search-result-url {
    font-size: 12px;
    color: var(--text-color-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   STARTUP ANIMATION OVERLAY
   ============================================ */
#startup-overlay {
    display: var(--startup-show);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--startup-bg);
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

#startup-video {
    max-width: 80%;
    max-height: 80%;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

.flex {
    display: flex !important;
}

.no-scroll {
    overflow: hidden !important;
}