/* --- Pal Brand Variables --- */
:root {
    --pal-blue: #2563eb;
    --pal-blue-deep: #1e40af;
    --pal-blue-soft: #64748b;
    --pal-bg: #f8faff;
    --pal-white: #ffffff;
    --tab-inactive: #e0e7ff;
    --border-light: rgba(37, 99, 235, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Varela Round', sans-serif;
    background-color: var(--pal-bg);
    overflow: hidden;
    color: #1e293b;
}

/* --- Main Container --- */
#browser-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
    margin-top: 80px;
    background: var(--pal-white);
}

/* --- Header & Tab System --- */
header {
    background: #f1f5f9;
    flex-shrink: 0;
    padding-top: 8px;
    border-bottom: 1px solid var(--border-light);
}

#tab-bar {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
}

#tabs-list {
    display: flex;
    flex-direction: row;
    gap: 4px;
    flex: 0 1 auto;
    min-width: 0;
}

/* Redesigned Tabs */
.tab {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 1 180px;
    max-width: 200px;
    min-width: 100px;
    height: 40px;
    padding: 0 12px;
    background: var(--tab-inactive);
    color: var(--pal-blue-soft);
    border-radius: 12px 12px 0 0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    white-space: nowrap;
}

.tab:hover:not(.active) {
    background: #d1d5db;
    color: var(--pal-blue-deep);
}

.tab.active {
    background: var(--pal-white);
    color: var(--pal-blue);
    font-weight: 600;
    box-shadow: 0 -4px 10px rgba(37, 99, 235, 0.05);
}

.tab span:first-child {
    flex: 1;            
    overflow: hidden;    
    text-overflow: ellipsis;
    white-space: nowrap; 
    min-width: 0;        
}

.close-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    
    width: 20px;
    height: 20px;
    
    flex: 0 0 20px; 
    
    margin-left: 4px;    
    border-radius: 50%;
    
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
}

.close-tab:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* New Tab Button */
#add-tab-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border: none;
    background: var(--pal-blue);
    color: white;
    font-size: 20px;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
}

#add-tab-btn:hover {
    background: var(--pal-blue-deep);
    transform: scale(1.05);
}

/* --- Address Bar Area --- */
.address-bar-container {
    padding: 12px 20px;
    background: var(--pal-white);
    border-bottom: 1px solid var(--border-light);
}

#address-input {
    width: 100%;
    padding: 12px 24px;
    border-radius: 50px;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
}

#address-input:focus {
    border-color: var(--pal-blue);
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* --- Results Content Area --- */
#content-viewport {
    flex: 1;
    overflow-y: auto;
    padding: 40px 20px;
    background: var(--pal-white);
}

/* Home View (Centered Search) */
#home-view {
    max-width: 600px;
    margin: 10vh auto;
    text-align: center;
}

#home-view h1 {
    font-size: 64px;
    font-weight: 900;
    color: var(--pal-blue);
    margin-bottom: 8px;
    letter-spacing: -2px;
}

#home-view p {
    color: var(--pal-blue-soft);
    font-size: 1.1rem;
    margin-bottom: 30px;
}

/* Results Formatting */
#results-container {
    max-width: 800px;
    margin: 0 auto;
}

.result-item {
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
    animation: slideUp 0.4s ease forwards;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-item a {
    color: var(--pal-blue);
    text-decoration: none;
    font-size: 1.25rem;
    display: inline-block;
    margin-bottom: 4px;
}

.result-item a:hover {
    text-decoration: underline;
}

.result-item span {
    display: block;
    color: #059669; /* Green for URLs */
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.result-item p {
    color: #475569;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* --- Footer Area --- */
footer {
    padding: 24px;
    background: var(--pal-bg);
    border-top: 1px solid var(--border-light);
}

.search-box {
    display: flex;
    max-width: 700px;
    margin: 0 auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border-radius: 50px;
    overflow: hidden;
}

.search-box input {
    flex: 1;
    padding: 16px 28px;
    border: none;
    outline: none;
    font-size: 16px;
    font-family: inherit;
}

.search-box button {
    padding: 0 32px;
    background: var(--pal-blue);
    color: white;
    cursor: pointer;
    font-weight: 700;
    border: none;
    transition: background 0.2s;
}

.search-box button:hover {
    background: var(--pal-blue-deep);
}

/* --- Optimized Toolbar & Nav Button --- */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: var(--pal-white);
    border-bottom: 1px solid var(--border-light);
}

/* --- Optimized Toolbar & Nav Button --- */
.nav-btn {
    display: none; /* Controlled by JS as 'flex' */
    align-items: center;    /* Vertical center */
    justify-content: center; /* Horizontal center */
    background: #f1f5f9; 
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    color: var(--pal-blue-soft);
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0; /* Important: removes default button padding that offsets icons */
}

.nav-btn:hover {
    background: var(--pal-blue);
    color: white;
    transform: scale(1.05);
}

.nav-btn svg {
    display: block; 
    width: 20px;  /* Fixed size for consistency */
    height: 20px;
    /* Remove any implicit margins */
    margin: 0; 
}

/* Unified Address Input */
#address-input {
    flex-grow: 1;
    padding: 10px 20px;
    border-radius: 50px;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
}

#address-input:focus {
    border-color: var(--pal-blue);
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}