/* ABOUTME: Styles for the fake Chrome browser shell UI. */
/* ABOUTME: Targets the ~2008 chunky blue Chrome aesthetic with title bar, tabs, toolbar, and status bar. */

/* ===== Reset & Base ===== */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #d4d4d4;
    font-family: "Segoe UI", "Lucida Grande", Arial, sans-serif;
    font-size: 13px;
}

/* ===== Chrome Shell ===== */

#chrome-shell {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    background: #f0f0f0;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

/* ===== Title Bar ===== */

#title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 30px;
    min-height: 30px;
    padding: 0 8px;
    background: linear-gradient(to bottom, #5b7faf, #3a5785);
    color: #fff;
    font-size: 12px;
    user-select: none;
    -webkit-user-select: none;
}

#page-title {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}

.window-buttons {
    display: flex;
    gap: 4px;
}

.window-buttons span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 18px;
    border-radius: 2px;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.window-buttons span:hover {
    background: rgba(255, 255, 255, 0.25);
}

.window-buttons .close-btn:hover {
    background: #e04343;
    border-color: #c03030;
}

/* ===== Tab Bar ===== */

#tab-bar {
    display: flex;
    align-items: flex-end;
    height: 35px;
    min-height: 35px;
    padding: 0 6px;
    background: #c8c8c8;
    border-bottom: 1px solid #aaa;
}

.tab {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 12px;
    margin-right: 2px;
    background: #d8d8d8;
    border: 1px solid #aaa;
    border-bottom: 1px solid #aaa;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    font-size: 12px;
    color: #555;
    user-select: none;
    -webkit-user-select: none;
    /* Subtle 3D effect: lighter top, darker bottom */
    border-top-color: #e5e5e5;
    border-left-color: #ddd;
    border-right-color: #bbb;
}

.tab.active {
    height: 31px;
    background: #fff;
    border-bottom-color: #fff;
    color: #333;
    font-weight: 500;
    /* Override 3D borders for active tab */
    border-top-color: #ccc;
    border-left-color: #ccc;
    border-right-color: #ccc;
}

.tab-title {
    max-width: 140px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.tab-close {
    font-size: 14px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    border-radius: 2px;
    padding: 0 2px;
}

.tab-close:hover {
    background: #e04343;
    color: #fff;
}

/* ===== Toolbar ===== */

#toolbar {
    display: flex;
    align-items: center;
    height: 40px;
    min-height: 40px;
    padding: 0 8px;
    gap: 6px;
    background: #e8e8e8;
    border-bottom: 1px solid #ccc;
}

#nav-buttons {
    display: flex;
    gap: 3px;
}

#nav-buttons button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: linear-gradient(to bottom, #fafafa, #e0e0e0);
    font-size: 15px;
    color: #555;
    cursor: pointer;
    line-height: 1;
}

#nav-buttons button:hover {
    background: linear-gradient(to bottom, #fff, #eaeaea);
    border-color: #999;
}

#nav-buttons button:active {
    background: linear-gradient(to bottom, #ddd, #ccc);
}

/* ===== Address Bar ===== */

#address-bar {
    flex: 1;
    display: flex;
    align-items: center;
    height: 28px;
    padding: 0 10px;
    background: #fff;
    border: 1px solid #bbb;
    border-radius: 4px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

#url-display {
    font-family: "Consolas", "Courier New", monospace;
    font-size: 13px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Color the protocol portion green */
#url-display::first-line {
    color: #333;
}

#url-input {
    display: none;
    flex: 1;
    border: none;
    outline: none;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 13px;
    background: transparent;
    color: #333;
}

/* ===== Sound Toggle ===== */

#sound-toggle {
    display: flex;
}

#btn-sound {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: linear-gradient(to bottom, #fafafa, #e0e0e0);
    font-size: 14px;
    cursor: pointer;
    line-height: 1;
}

#btn-sound:hover {
    background: linear-gradient(to bottom, #fff, #eaeaea);
    border-color: #999;
}

/* ===== Bookmarks Bar ===== */

#bookmarks-bar {
    min-height: 0;
    height: 0;
    padding: 0;
    background: #f5f5f5;
    border-bottom: 1px solid transparent;
    overflow: hidden;
    transition: height 0.2s ease, padding 0.2s ease;
}

#bookmarks-bar.has-bookmarks {
    height: 28px;
    min-height: 28px;
    padding: 0 10px;
    border-bottom-color: #ddd;
    display: flex;
    align-items: center;
    gap: 4px;
}

.bookmark-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    color: #333;
    cursor: pointer;
    white-space: nowrap;
}

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

.bookmark-icon {
    font-size: 12px;
}

/* ===== Content Area ===== */

#content-area {
    flex: 1;
    position: relative;
    background: #fff;
    overflow-y: auto;
    overflow-x: hidden;
}

#page-content {
    width: 100%;
    min-height: 100%;
}

/* ===== Loading Screen ===== */

#loading-screen {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.92);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

#loading-screen.visible {
    display: flex;
}

.loading-bar-container {
    width: 260px;
    height: 18px;
    background: #e0e0e0;
    border: 1px solid #bbb;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
}

.loading-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(to right, #4a90d9, #6ab0f3);
    border-radius: 2px;
    transition: width 3s linear;
}

.loading-bar.animating {
    width: 100%;
}

.loading-text {
    font-size: 12px;
    color: #777;
    font-style: italic;
}

/* ===== Status Bar ===== */

#status-bar {
    display: flex;
    align-items: center;
    height: 28px;
    min-height: 28px;
    padding: 0 12px;
    gap: 20px;
    background: #f5f5f5;
    border-top: 1px solid #ccc;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 12px;
    color: #555;
    user-select: none;
    -webkit-user-select: none;
}

.currency {
    display: flex;
    align-items: center;
    gap: 4px;
}

.currency-icon {
    font-size: 13px;
    font-style: normal;
}

.currency-label {
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#clicks-count {
    font-weight: 700;
    font-size: 13px;
    color: #333;
}

#data-count {
    color: #444;
}

#reputation-count {
    color: #444;
}

/* ===== URL Protocol Coloring ===== */

/* JS will wrap the protocol in a span for green coloring */
.url-protocol {
    color: #0b8a00;
}

/* ===== Address Bar — Search Mode ===== */

#address-bar.search-enabled {
    cursor: text;
}

#address-bar.search-enabled #url-display {
    cursor: text;
}

#address-bar.search-active #url-display {
    display: none;
}

#address-bar.search-active #url-input {
    display: block;
}

/* ===== New Tab Button ===== */

.tab-new-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-left: 4px;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: linear-gradient(to bottom, #eee, #d8d8d8);
    font-size: 16px;
    color: #666;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    align-self: center;
}

.tab-new-btn:hover {
    background: linear-gradient(to bottom, #fafafa, #eaeaea);
    border-color: #999;
    color: #333;
}

/* ===== Monitor Level Classes ===== */
/* Higher monitor levels reduce chrome padding for more content space */

#chrome-shell.monitor-level-0 #toolbar {
    padding: 0 8px;
    height: 40px;
    min-height: 40px;
}

#chrome-shell.monitor-level-1 #toolbar {
    padding: 0 6px;
    height: 38px;
    min-height: 38px;
}

#chrome-shell.monitor-level-1 #tab-bar {
    height: 33px;
    min-height: 33px;
}

#chrome-shell.monitor-level-2 #toolbar {
    padding: 0 4px;
    height: 36px;
    min-height: 36px;
}

#chrome-shell.monitor-level-2 #tab-bar {
    height: 31px;
    min-height: 31px;
}

#chrome-shell.monitor-level-2 #status-bar {
    height: 24px;
    min-height: 24px;
}

#chrome-shell.monitor-level-3 #toolbar {
    padding: 0 4px;
    height: 34px;
    min-height: 34px;
}

#chrome-shell.monitor-level-3 #tab-bar {
    height: 29px;
    min-height: 29px;
}

#chrome-shell.monitor-level-3 #title-bar {
    height: 24px;
    min-height: 24px;
}

#chrome-shell.monitor-level-3 #status-bar {
    height: 22px;
    min-height: 22px;
    padding: 0 8px;
    gap: 14px;
}

/* ===== Upgrade Shop Overlay ===== */

#upgrade-shop {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    background: #f0ede4;
    overflow-y: auto;
    font-family: "Segoe UI", "Lucida Grande", Arial, sans-serif;
}

#upgrade-shop.visible {
    display: block;
}

.shop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    background: linear-gradient(to bottom, #3a5785, #2a4265);
    color: #fff;
    border-bottom: 3px solid #ffd700;
}

.shop-header h2 {
    font-size: 18px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.shop-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
}

.shop-close-btn:hover {
    background: #e04343;
    border-color: #c03030;
}

.shop-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Individual upgrade section cards */
.shop-section {
    background: #fff;
    border: 2px solid #c0b89c;
    border-radius: 6px;
    padding: 14px 16px;
    box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.1);
}

.shop-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #3a5785;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px dashed #c0b89c;
}

.shop-section-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.shop-section-label {
    font-size: 13px;
    color: #555;
}

.shop-section-value {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.shop-section-desc {
    font-size: 12px;
    color: #888;
    font-style: italic;
    margin-top: 4px;
}

.shop-status-unlocked {
    color: #2a8c2a;
    font-weight: 700;
}

.shop-status-locked {
    color: #999;
}

/* Speed bar visual for modem */
.speed-bar-track {
    width: 100%;
    height: 12px;
    background: #e0e0e0;
    border: 1px solid #bbb;
    border-radius: 3px;
    overflow: hidden;
    margin: 6px 0;
}

.speed-bar-fill {
    height: 100%;
    background: linear-gradient(to right, #e04343, #ffd700, #2a8c2a);
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* Upgrade buy button */
.shop-buy-btn {
    display: inline-block;
    padding: 6px 16px;
    margin-top: 6px;
    border: 2px outset #c0b89c;
    border-radius: 4px;
    background: linear-gradient(to bottom, #fafafa, #e0e0e0);
    font-size: 13px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    font-family: inherit;
}

.shop-buy-btn:hover:not(:disabled) {
    background: linear-gradient(to bottom, #fff, #eaeaea);
    border-color: #999;
}

.shop-buy-btn:active:not(:disabled) {
    background: linear-gradient(to bottom, #ddd, #ccc);
    border-style: inset;
}

.shop-buy-btn:disabled {
    background: #e8e8e8;
    color: #aaa;
    cursor: not-allowed;
    border-style: solid;
    border-color: #ccc;
}

.shop-max-label {
    display: inline-block;
    padding: 4px 12px;
    margin-top: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #2a8c2a;
}

/* ===== Auto-Save Indicator ===== */

#save-indicator {
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
    color: #888;
    margin-left: auto;
}

#save-indicator.visible {
    opacity: 1;
}
