/* ==========================================================================
   DUCK POND UNIFIED BROWSER ARCHITECTURE STYLES
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;700&display=swap');

:root {
    /* Core Theme Sync Engine Mapping */
    --bg: #f7f7f7;
    --surface: #ffffff;
    --surface-hover: #f1f3f4;
    --surface-active: #e8eaed;
    --border: #DADCE0;
    --border-light: #e8eaed;

    /* Text Hierarchy Tokens */
    --text: #3c4043;
    --text-muted: #70757a;
    --text-dim: #9aa0a6;

    /* Accent Settings */
    --accent: #3c4043;
    --accent-dim: rgba(60, 64, 67, 0.8);
    --accent-glow: rgba(60, 64, 67, 0.1);

    /* Status Trackers */
    --success: #1fa463;
    --warning: #f9ab00;
    --error: #d93025;
    --info: #1a73e8;

    /* Interface Shadows */
    --shadow-sm: 0 1px 2px rgba(60, 64, 67, 0.05);
    --shadow-md: 0 4px 12px rgba(60, 64, 67, 0.1);
    --shadow-lg: 0 8px 24px rgba(60, 64, 67, 0.15);
    --shadow-xl: 0 16px 48px rgba(60, 64, 67, 0.2);

    /* Spacing Dimensions */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Rounding Engine Rules */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Animation Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.35s ease;

    --z-base: 1;
    --z-dropdown: 100;
    --z-sticky: 500;
    --z-modal: 1000;
    --z-toast: 2000;
    --z-max: 9999;

    --font-sans: 'Google Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'Consolas', monospace;
    --bg-image: none;
}

/* Active Dark Variant Structural Conversions */
body.dark-variant, html.dark-variant {
    --bg: #121212;
    --surface: #1e1e1e;
    --surface-hover: #2d2d2d;
    --surface-active: #353535;
    --border: #3c4043;
    --border-light: #4a4a4a;

    --text: #f1f3f4;
    --text-muted: #9aa0a6;
    --text-dim: #606468;

    --accent: #f1f3f4;
    --accent-dim: rgba(241, 243, 244, 0.8);
    --accent-glow: rgba(241, 243, 244, 0.1);
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.7);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.8);
}

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

body,
html,
#app {
    font-family: var(--font-sans);
    width: 100vw;
    height: 100vh;
    margin: 0;
    background: var(--bg);
    overflow: hidden;
    color: var(--text);
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

/* Layout Canvas */
.browser-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Tabs Panel bar */
.tabs {
    display: flex;
    padding: 8px 8px 0;
    gap: 6px;
    background: var(--bg);
    overflow-x: auto;
    transition: background-color var(--transition-fast);
}

.tabs::-webkit-scrollbar {
    height: 0;
}

.tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    min-width: 180px;
    max-width: 220px;
    background: var(--bg);
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab:hover {
    background: var(--surface-hover);
}

.tab.active {
    background: var(--surface);
    border-color: var(--border);
}

.tab-favicon {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

.tab-title {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tab-close {
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    line-height: 1;
}

.tab-close:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.new-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 2px;
}

.new-tab:hover {
    background: var(--surface-hover);
    color: var(--text);
}

/* Control Navigation Bar Strip */
.nav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.nav button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: var(--radius-full);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 16px;
}

.nav button:hover {
    background: var(--surface-hover);
    color: var(--text);
}

/* Address Locator Field Bar Wrapper */
.address-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

input.bar {
    width: 100%;
    height: 36px;
    padding: 0 40px 0 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: all var(--transition-fast);
}

input.bar:focus {
    border-color: var(--text-muted);
    background: var(--surface);
}

input.bar::placeholder {
    color: var(--text-dim);
}

#home-btn-nav {
    position: absolute;
    right: 6px;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    padding: 0;
}

#home-btn-nav:hover {
    color: var(--text);
    background: var(--surface-hover);
}

/* Loading Dynamic Bar Tracker */
.loading-bar-container {
    height: 2px;
    background: transparent;
}

.loading-bar {
    height: 100%;
    width: 0%;
    background: var(--text-muted);
    transition: width 0.2s ease, opacity 0.15s;
}

/* Main Workspace Framework Frame Viewport */
.iframe-container {
    flex: 1;
    position: relative;
    background: var(--bg);
}

.iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    position: absolute;
}

.iframe-container iframe.hidden {
    display: none;
}

.iframe-container iframe.loading {
    filter: blur(15px);
    transition: filter 0.5s ease;
}

.iframe-loading {
    position: absolute;
    inset: 0;
    background: var(--bg);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.message-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    color: var(--text);
    text-align: center;
    position: absolute;
    top: 0;
    left: 0;
    background: var(--surface);
    transition: background-color var(--transition-fast);
    z-index: 10;
}

.message-content {
    max-width: 400px;
    padding: 24px;
}

.message-content h1 {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 8px;
}

.message-content p {
    color: var(--text-muted);
    font-size: 13px;
    word-break: break-all;
}

.spinner {
    border: 2px solid var(--border);
    border-top-color: var(--text-muted);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

#skip-btn {
    margin-top: 20px;
    padding: 8px 18px;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    cursor: pointer;
    font-size: 13px;
    transition: all var(--transition-fast);
    display: none;
}

#skip-btn:hover {
    border-color: var(--text-muted);
}

.tab-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--text-muted);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Settings Dashboard Modal Frame overlays */
.wisp-settings-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

.wisp-settings-modal.hidden {
    display: none;
}

.settings-card {
    background: var(--surface);
    width: 420px;
    max-width: 90vw;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transition: background-color var(--transition-fast);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.settings-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
    display: flex;
}

.close-btn:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.settings-content {
    padding: 20px;
    max-height: 50vh;
    overflow-y: auto;
}

.section-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.server-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.wisp-option {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.wisp-option:hover {
    border-color: var(--text-muted);
}

.wisp-option.active {
    border-color: var(--text);
    background: var(--surface-hover);
}

.wisp-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wisp-option-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    display: flex;
    align-items: center;
}

.wisp-option-url {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.server-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ping-text {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.status-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-dim);
}

.status-indicator.status-success {
    background: var(--success);
}

.status-indicator.status-error {
    background: var(--error);
}

.custom-input-group {
    display: flex;
    gap: 8px;
}

.custom-input-group input {
    flex: 1;
    height: 36px;
    padding: 0 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 13px;
    outline: none;
    transition: all var(--transition-fast);
}

.custom-input-group input:focus {
    border-color: var(--text-muted);
}

.custom-input-group button {
    height: 36px;
    padding: 0 16px;
    background: var(--text);
    color: var(--surface);
    border: none;
    border-radius: var(--radius-xl);
    cursor: pointer;
    font-weight: 500;
    transition: opacity var(--transition-fast);
}

.custom-input-group button:hover {
    opacity: 0.9;
}

.settings-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.4;
}

.delete-wisp-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
    margin-left: 6px;
    transition: color var(--transition-fast);
}

.delete-wisp-btn:hover {
    color: var(--error);
}

/* Action Toggle Switch Configurations */
.toggle-switch {
    width: 40px;
    height: 20px;
    background: var(--border);
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-switch.active {
    background: var(--text);
}

.toggle-knob {
    width: 16px;
    height: 16px;
    background: var(--surface);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
}

.toggle-switch.active .toggle-knob {
    transform: translateX(20px);
}

.flex {
    display: flex;
}