:root {
    /* Premium Color Palette */
    --bg-color: #0d0d0d;
    --sidebar-bg: rgba(20, 20, 20, 0.7);
    --toolbar-bg: rgba(20, 20, 20, 0.7);
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --accent-color: #6366f1;
    /* Indigo-500 */
    --accent-glow: rgba(99, 102, 241, 0.4);
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --input-bg: rgba(255, 255, 255, 0.05);

    --sidebar-width: 320px;
    --source-width: 300px;
    --toolbar-height: 60px;

    --transition-speed: 0.3s;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 20%);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100%;
}

/* --- Source Panel (Left) --- */
.source-panel {
    width: var(--source-width);
    background: var(--sidebar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 2;
}

.code-container {
    flex: 1;
    overflow: auto;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.8rem;
    color: #a5d6ff;
}

.code-container pre {
    white-space: pre-wrap;
    word-break: break-all;
}

/* --- Browser Window (Center) --- */
.browser-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

/* Glassmorphism Toolbar */
.browser-toolbar {
    height: var(--toolbar-height);
    background: var(--toolbar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: var(--glass-border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 15px;
}

.controls {
    display: flex;
    gap: 8px;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.nav-btn:active {
    transform: scale(0.95);
}

.address-bar-container {
    flex: 1;
    display: flex;
    background: var(--input-bg);
    border-radius: 12px;
    border: 1px solid transparent;
    /* Prepare for focus border */
    transition: border-color 0.2s, box-shadow 0.2s;
    align-items: center;
    padding: 0 4px;
}

.address-bar-container:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

#address-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 0.9rem;
    outline: none;
    font-family: 'Inter', sans-serif;
}

#address-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.go-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 4px;
}

.go-btn:hover {
    box-shadow: 0 0 10px var(--accent-glow);
    transform: translateY(-1px);
}

.viewport-container {
    flex: 1;
    background: white;
    position: relative;
    overflow: hidden;
}

#web-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    /* Default bg for iframe */
}

/* --- Side Panel (Right) --- */
.side-panel {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-left: var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 2;
}

.panel-header {
    height: var(--toolbar-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: var(--glass-border);
}

.panel-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-header h2::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    background: var(--accent-color);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-glow);
}

.chat-display {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: 90%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.system {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border-left: 3px solid var(--accent-color);
    font-size: 0.85rem;
}

.message.user {
    align-self: flex-end;
    background: var(--accent-color);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

.chat-input-area {
    padding: 20px;
    border-top: var(--glass-border);
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
}

#user-input {
    flex: 1;
    background: var(--input-bg);
    border: 1px solid transparent;
    color: var(--text-primary);
    padding: 12px;
    border-radius: 8px;
    resize: none;
    height: 48px;
    /* Increased height */
    outline: none;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
}

#user-input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.1);
}

#btn-send {
    background: var(--accent-color);
    color: white;
    border: none;
    width: 48px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#btn-send:hover {
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}