/* CSS Variables for theming */
:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #404040;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --accent-primary: #4a9eff;
    --accent-secondary: #357abd;
    --border-color: #444444;
    --tab-active: #404040;
    --tab-inactive: #2d2d2d;
    --input-bg: #2d2d2d;
    --input-border: #555555;
}

/* Light theme */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #e0e0e0;
    --text-primary: #000000;
    --text-secondary: #666666;
    --accent-primary: #0066cc;
    --accent-secondary: #0052a3;
    --border-color: #cccccc;
    --tab-active: #e0e0e0;
    --tab-inactive: #f5f5f5;
    --input-bg: #ffffff;
    --input-border: #cccccc;
}

/* OLED Black theme */
[data-theme="oled"] {
    --bg-primary: #000000;
    --bg-secondary: #111111;
    --bg-tertiary: #222222;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --accent-primary: #4a9eff;
    --accent-secondary: #357abd;
    --border-color: #333333;
    --tab-active: #222222;
    --tab-inactive: #111111;
    --input-bg: #111111;
    --input-border: #333333;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
}

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Browser Chrome */
.browser-chrome {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

/* Tab Strip */
.tab-strip {
    display: flex;
    align-items: center;
    background-color: var(--bg-secondary);
    height: 40px;
    padding: 0 8px;
    border-bottom: 1px solid var(--border-color);
}

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

.tab {
    display: flex;
    align-items: center;
    min-width: 150px;
    max-width: 250px;
    height: 32px;
    background-color: var(--tab-inactive);
    border: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
    margin-right: 4px;
    padding: 0 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.tab.active {
    background-color: var(--tab-active);
    border-bottom: 1px solid var(--tab-active);
}

.tab-title {
    flex: 1;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
}

.tab-close {
    width: 16px;
    height: 16px;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
}

.tab-close:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.new-tab-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.new-tab-btn:hover {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* Address Bar */
.address-bar {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    gap: 8px;
}

#addressInput {
    flex: 1;
    height: 32px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 6px;
    padding: 0 12px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

#addressInput:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.go-btn {
    height: 32px;
    padding: 0 16px;
    background-color: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.go-btn:hover {
    background-color: var(--accent-secondary);
}

.settings-btn {
    width: 32px;
    height: 32px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.settings-btn:hover {
    background-color: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* Content Area */
.content-area {
    flex: 1;
    position: relative;
    background-color: var(--bg-primary);
}

.tab-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.tab-content.active {
    opacity: 1;
    visibility: visible;
}

.tab-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background-color: white;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-width: 400px;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideIn 0.2s ease;
}

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

.modal-header h2, .modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.setting-group {
    margin-bottom: 24px;
}

.setting-group h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.setting-group select {
    width: 100%;
    height: 36px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 6px;
    padding: 0 12px;
    color: var(--text-primary);
    font-size: 14px;
}

.keybind-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.keybind-item label {
    min-width: 100px;
    font-size: 14px;
    color: var(--text-primary);
}

.keybind-item input {
    flex: 1;
    height: 32px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 6px;
    padding: 0 12px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: monospace;
}

.edit-keybind {
    padding: 6px 12px;
    background-color: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.edit-keybind:hover {
    background-color: var(--accent-secondary);
}

.current-keys {
    text-align: center;
    padding: 20px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 6px;
    font-family: monospace;
    font-size: 16px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

.modal-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

#saveKeybind {
    background-color: var(--accent-primary);
    color: white;
}

#saveKeybind:hover {
    background-color: var(--accent-secondary);
}

#cancelKeybind {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

#cancelKeybind:hover {
    background-color: var(--border-color);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Loading state */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    font-size: 14px;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}