:root {
    --bg-color: #f2f2f7;
    --toolbar-bg: rgba(255, 255, 255, 0.85);
    --text-color: #1c1c1e;
    --input-bg: #e5e5ea;
    --primary-color: #007aff;
    --border-color: rgba(0, 0, 0, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --safe-area-top: env(safe-area-inset-top, 0px);
}

.dark-mode {
    --bg-color: #000000;
    --toolbar-bg: rgba(28, 28, 30, 0.85);
    --text-color: #f2f2f7;
    --input-bg: #2c2c2e;
    --primary-color: #0a84ff;
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

/* Toolbar */
.toolbar {
    background: var(--toolbar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: calc(var(--safe-area-top) + 8px) 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 100;
}

.toolbar-top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.url-bar-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border-radius: 12px;
    padding: 0 12px;
    height: 40px;
    transition: background-color 0.3s ease;
}

.url-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 16px;
    outline: none;
    width: 100%;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--primary-color);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.icon-btn:active {
    opacity: 0.6;
}

.icon-btn svg {
    width: 20px;
    height: 20px;
}

.search-btn {
    width: 28px;
    height: 28px;
    color: var(--text-color);
    opacity: 0.5;
}

.tab-count {
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    width: 22px;
    height: 22px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Zoom Controls */
.toolbar-bottom {
    display: flex;
    justify-content: center;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--input-bg);
    padding: 4px 16px;
    border-radius: 20px;
}

.zoom-slider {
    -webkit-appearance: none;
    width: 120px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    outline: none;
}

.zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

#zoom-level {
    font-size: 12px;
    font-weight: 500;
    min-width: 40px;
    text-align: right;
}

.zoom-btn {
    position: relative;
    width: 28px;
    height: 28px;
}

.zoom-btn .minus, .zoom-btn .plus {
    position: absolute;
    font-size: 10px;
    font-weight: bold;
    top: 2px;
    right: 2px;
}

/* Content Area */
.content-area {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    background: #fff; /* Frames are typically white background */
}

.browser-tab {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    transform-origin: top left;
    display: none;
    background: #fff;
}

.browser-tab.active {
    display: block;
}

/* Overlays & Modals */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.glass {
    background: var(--toolbar-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-color);
    border-radius: 24px 24px 0 0;
    padding: 24px;
    box-shadow: var(--glass-shadow);
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.overlay.hidden .glass {
    transform: translateY(100%);
}

.glass h3 {
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 600;
}

/* Menu Items */
.menu-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 16px;
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item svg {
    width: 24px;
    height: 24px;
    color: var(--text-color);
}

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--border-color);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .slider {
    background-color: #34c759;
}

input:checked + .slider:before {
    transform: translateX(22px);
}

.slider.round {
    border-radius: 28px;
}
.slider.round:before {
    border-radius: 50%;
}

/* Tabs & Bookmarks List */
.tabs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.primary-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 16px;
    font-weight: 600;
    cursor: pointer;
}

.tabs-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
}

.tab-item {
    background: var(--input-bg);
    padding: 12px 16px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tab-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

.tab-title {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tab-url {
    font-size: 12px;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.close-tab-btn {
    color: #ff3b30;
    background: transparent;
    border: none;
    font-size: 20px;
    padding: 8px;
    cursor: pointer;
}
