/* Chrome-Style Browser CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    overflow: hidden;
    background: #fff;
    color: #202124;
}

.browser-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Tab Bar */
.tab-bar {
    display: flex;
    align-items: flex-end;
    background: #dee1e6;
    height: 36px;
    padding: 0 8px;
    border-bottom: 1px solid #bdc1c6;
    user-select: none;
}

.tabs-container {
    display: flex;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.tabs-container::-webkit-scrollbar {
    display: none;
}

.tab {
    display: flex;
    align-items: center;
    min-width: 180px;
    max-width: 240px;
    height: 36px;
    background: #bdc1c6;
    border: none;
    border-radius: 8px 8px 0 0;
    padding: 0 12px;
    margin-right: 1px;
    cursor: pointer;
    position: relative;
    transition: background 0.1s;
}

.tab:hover {
    background: #c8cbcf;
}

.tab.active {
    background: #fff;
    border-bottom: 1px solid #fff;
}

.tab-favicon {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    flex-shrink: 0;
}

.tab-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: #202124;
}

.tab-close {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    flex-shrink: 0;
    font-size: 16px;
    color: #5f6368;
    transition: background 0.1s;
}

.tab-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.new-tab-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    color: #5f6368;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 4px 4px;
    transition: background 0.1s;
}

.new-tab-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.window-controls {
    display: flex;
    gap: 4px;
    margin-left: auto;
    margin-bottom: 4px;
}

.window-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    color: #5f6368;
    transition: background 0.1s;
}

.window-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.window-btn.close:hover {
    background: #e81123;
    color: #fff;
}

/* Navigation Bar */
.nav-bar {
    display: flex;
    align-items: center;
    height: 48px;
    padding: 0 8px;
    background: #fff;
    border-bottom: 1px solid #e8eaed;
    gap: 8px;
}

.nav-controls {
    display: flex;
    gap: 4px;
}

.nav-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5f6368;
    transition: background 0.1s;
}

.nav-btn:hover:not(:disabled) {
    background: #f1f3f4;
}

.nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Address Bar */
.address-bar-container {
    flex: 1;
    position: relative;
    max-width: 800px;
}

.address-bar {
    display: flex;
    align-items: center;
    height: 36px;
    background: #f1f3f4;
    border-radius: 18px;
    padding: 0 12px;
    gap: 8px;
    transition: background 0.2s, box-shadow 0.2s;
}

.address-bar:focus-within {
    background: #fff;
    box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
}

.security-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.url-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: #202124;
}

.url-input::placeholder {
    color: #80868b;
}

.star-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5f6368;
    transition: background 0.1s;
    flex-shrink: 0;
}

.star-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.star-btn.bookmarked {
    color: #1a73e8;
}

/* Search Suggestions */
.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    margin-top: 4px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
}

.suggestions-dropdown.show {
    display: block;
}

.suggestion-item {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    cursor: pointer;
    gap: 12px;
    transition: background 0.1s;
}

.suggestion-item:hover,
.suggestion-item.selected {
    background: #f1f3f4;
}

.suggestion-icon {
    width: 20px;
    height: 20px;
    color: #5f6368;
    flex-shrink: 0;
}

.suggestion-text {
    flex: 1;
    font-size: 14px;
    color: #202124;
}

/* Right Controls */
.right-controls {
    display: flex;
    gap: 4px;
}

.icon-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5f6368;
    transition: background 0.1s;
}

.icon-btn:hover {
    background: #f1f3f4;
}

/* Bookmarks Bar */
.bookmarks-bar {
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 12px;
    background: #fff;
    border-bottom: 1px solid #e8eaed;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

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

.bookmarks-list {
    display: flex;
    gap: 8px;
}

.bookmark-item {
    display: flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 4px;
    text-decoration: none;
    color: #202124;
    font-size: 13px;
    white-space: nowrap;
    transition: background 0.1s;
}

.bookmark-item:hover {
    background: #f1f3f4;
}

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

.tab-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
}

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

.browser-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* New Tab Page */
.new-tab-page {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    background: #fff;
}

.ntp-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.ntp-logo {
    text-align: center;
    margin-bottom: 40px;
}

.ntp-logo h1 {
    font-size: 72px;
    font-weight: 300;
    color: #202124;
    letter-spacing: -2px;
}

.ntp-search {
    max-width: 600px;
    margin: 0 auto 60px;
}

.ntp-search-box {
    display: flex;
    align-items: center;
    height: 48px;
    background: #fff;
    border: 1px solid #dfe1e5;
    border-radius: 24px;
    padding: 0 16px;
    gap: 12px;
    transition: box-shadow 0.2s;
}

.ntp-search-box:hover {
    box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
}

.ntp-search-box:focus-within {
    box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
    border-color: transparent;
}

.ntp-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    color: #202124;
}

.ntp-shortcuts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 24px;
    margin-bottom: 60px;
}

.ntp-shortcut {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    padding: 16px;
    border-radius: 8px;
    transition: background 0.1s;
}

.ntp-shortcut:hover {
    background: #f1f3f4;
}

.ntp-shortcut-icon {
    width: 48px;
    height: 48px;
    background: #f1f3f4;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 8px;
}

.ntp-shortcut-title {
    font-size: 13px;
    color: #202124;
    text-align: center;
}

/* Menu Dropdown */
.menu-dropdown {
    position: fixed;
    top: 48px;
    right: 8px;
    width: 320px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    padding: 8px 0;
    display: none;
    z-index: 1000;
}

.menu-dropdown.show {
    display: block;
}

.menu-section {
    padding: 4px 0;
}

.menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    color: #202124;
    transition: background 0.1s;
}

.menu-item:hover {
    background: #f1f3f4;
}

.menu-item .shortcut {
    font-size: 12px;
    color: #5f6368;
}

.menu-divider {
    height: 1px;
    background: #e8eaed;
    margin: 4px 0;
}

/* Settings Panel */
.settings-panel,
.history-panel,
.downloads-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 600px;
    height: 100vh;
    background: #fff;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
    z-index: 2000;
}

.settings-panel.show,
.history-panel.show,
.downloads-panel.show {
    display: flex;
}

.settings-header,
.panel-header {
    display: flex;
    align-items: center;
    height: 56px;
    padding: 0 16px;
    border-bottom: 1px solid #e8eaed;
    gap: 16px;
}

.back-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5f6368;
    transition: background 0.1s;
}

.back-btn:hover {
    background: #f1f3f4;
}

.settings-header h2,
.panel-header h2 {
    flex: 1;
    font-size: 20px;
    font-weight: 400;
    color: #202124;
}

.clear-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #1a73e8;
    transition: background 0.1s;
}

.clear-btn:hover {
    background: #f1f3f4;
}

.settings-content,
.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.settings-section {
    margin-bottom: 32px;
}

.settings-section h3 {
    font-size: 16px;
    font-weight: 500;
    color: #202124;
    margin-bottom: 16px;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    font-size: 14px;
    color: #202124;
}

.setting-select {
    padding: 8px 12px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    font-size: 14px;
    color: #202124;
    background: #fff;
    cursor: pointer;
}

.setting-button {
    padding: 10px 24px;
    border: 1px solid #dadce0;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #1a73e8;
    transition: background 0.1s;
    margin-top: 8px;
}

.setting-button:hover {
    background: #f1f3f4;
}

/* History Items */
.history-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e8eaed;
    gap: 12px;
    cursor: pointer;
    transition: background 0.1s;
}

.history-item:hover {
    background: #f1f3f4;
}

.history-favicon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-title {
    font-size: 14px;
    color: #202124;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-url {
    font-size: 12px;
    color: #5f6368;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-time {
    font-size: 12px;
    color: #5f6368;
    flex-shrink: 0;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #5f6368;
}

.empty-state svg {
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 14px;
}

/* Loading Indicator */
.loading-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: #e8eaed;
    overflow: hidden;
    display: none;
}

.loading-indicator.show {
    display: block;
}

.loading-bar {
    height: 100%;
    background: #1a73e8;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        width: 0;
        margin-left: 0;
    }
    50% {
        width: 50%;
        margin-left: 25%;
    }
    100% {
        width: 0;
        margin-left: 100%;
    }
}

/* Dark Mode */
body.dark-mode {
    background: #202124;
    color: #e8eaed;
}

body.dark-mode .browser-container {
    background: #202124;
}

body.dark-mode .tab-bar {
    background: #292a2d;
    border-bottom-color: #3c4043;
}

body.dark-mode .tab {
    background: #3c4043;
    color: #e8eaed;
}

body.dark-mode .tab.active {
    background: #202124;
}

body.dark-mode .nav-bar {
    background: #202124;
    border-bottom-color: #3c4043;
}

body.dark-mode .address-bar {
    background: #3c4043;
}

body.dark-mode .address-bar:focus-within {
    background: #292a2d;
}

body.dark-mode .url-input {
    color: #e8eaed;
}

body.dark-mode .bookmarks-bar {
    background: #202124;
    border-bottom-color: #3c4043;
}

body.dark-mode .bookmark-item {
    color: #e8eaed;
}

body.dark-mode .new-tab-page {
    background: #202124;
}

body.dark-mode .ntp-logo h1 {
    color: #e8eaed;
}

body.dark-mode .ntp-search-box {
    background: #3c4043;
    border-color: #5f6368;
}

body.dark-mode .ntp-search-input {
    color: #e8eaed;
}

body.dark-mode .menu-dropdown,
body.dark-mode .settings-panel,
body.dark-mode .history-panel,
body.dark-mode .downloads-panel {
    background: #292a2d;
}

body.dark-mode .menu-item,
body.dark-mode .setting-item,
body.dark-mode .history-title {
    color: #e8eaed;
}

/* Responsive */
@media (max-width: 768px) {
    .tab {
        min-width: 120px;
    }
    
    .address-bar-container {
        max-width: none;
    }
    
    .settings-panel,
    .history-panel,
    .downloads-panel {
        max-width: 100%;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #dadce0;
    border-radius: 6px;
    border: 3px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: #bdc1c6;
    background-clip: content-box;
}

body.dark-mode ::-webkit-scrollbar-thumb {
    background: #5f6368;
    background-clip: content-box;
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: #80868b;
    background-clip: content-box;
}