/* SQLinForm Online - Styles matching Azure/Blazor version */

:root {
    --primary: #f27958;
    --primary-hover: #e56842;
    --secondary: #393185;
    --bg-main: #fafafa;
    --bg-panel: #f0e9e9;
    --border: #e0e0e0;
    --border-light: #f0f0f0;
    --text-primary: #393185;
    --text-secondary: #666;
    --text-muted: #999;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
}

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

html, body {
    height: 100%;
    font-family: var(--font-sans);
    font-size: 16px;
    background: var(--bg-main);
    color: var(--text-primary);
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Site Header - matching sqlinform.com */
.site-header {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
}

.header-container {
    max-width: 1240px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
}

.site-branding {
    flex-shrink: 0;
}

.logo-link {
    display: block;
}

.site-logo {
    height: 22px;
    width: auto;
}

/* Main Navigation */
.main-navigation {
    flex-grow: 1;
    display: flex;
    justify-content: flex-end;
}

.main-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0;
}

.menu-item {
    position: relative;
}

.menu-item > a {
    display: block;
    padding: 12px 15px;
    color: var(--secondary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 400;
    transition: color 0.2s;
}

.menu-item > a:hover {
    color: var(--secondary);
}

.menu-item.has-submenu > a::after {
    content: " ▾";
    font-size: 10px;
    opacity: 0.7;
}

/* Submenu */
.sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--bg-panel);
    border: 2px solid var(--secondary);
    border-top-width: 2px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    list-style: none;
    padding: 0;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.menu-item:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.sub-menu li {
    border-bottom: 1px solid #eaeaea;
}

.sub-menu li:last-child {
    border-bottom: none;
}

.sub-menu a {
    display: block;
    padding: 10px 15px;
    color: var(--secondary);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
}

.sub-menu a:hover {
    background: #f5f5f5;
    color: #dd3333;
}

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: var(--bg-panel);
    border-bottom: 2px solid var(--primary);
}

.toolbar-left {
    display: flex;
    gap: 8px;
}

/* Buttons */
button {
    font-family: var(--font-sans);
    cursor: pointer;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    transition: all 0.2s;
}

.btn-primary {
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    font-weight: 500;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    padding: 8px 16px;
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-load-sample {
    padding: 5px 12px;
    background: var(--primary);
    color: white;
    font-size: 13px;
    border-radius: 3px;
}

.btn-load-sample:hover {
    background: var(--primary-hover);
}

/* Main Layout */
.main-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Settings Panel - Left side */
.settings-panel {
    width: 625px;
    min-width: 250px;
    max-width: 1000px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.tabs-and-content {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Splitter zwischen Tabs und Content */
.splitter {
    width: 5px;
    background: #e0e0e0;
    cursor: col-resize;
    flex-shrink: 0;
    transition: background 0.2s;
}

.splitter:hover,
.splitter.active {
    background: var(--primary);
}

/* Splitter zwischen Settings Panel und SQL Panel */
.splitter-main {
    width: 5px;
    background: #e0e0e0;
    cursor: col-resize;
    flex-shrink: 0;
    transition: background 0.2s;
}

.splitter-main:hover,
.splitter-main.active {
    background: var(--primary);
}

/* Vertical Tabs */
.vertical-tabs {
    width: 180px;
    flex-shrink: 0;
    background: #f8f8f8;
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

.vtab-item {
    padding: 8px 10px;
    cursor: pointer;
    font-size: 13px;
    color: #555;
    border-bottom: 1px solid #eee;
    transition: all 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vtab-item:hover {
    background: #f0f0f0;
    color: #333;
}

.vtab-item.active {
    background: var(--primary);
    color: white;
    font-weight: 500;
}

.vtab-item.vtab-indent {
    padding-left: 16px;
    font-size: 12px;
}

/* Tab Content */
.tab-content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: #f0e9e9;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Settings Sections */
.settings-section {
    margin-bottom: 10px;
    border: 1px solid #eee;
    border-radius: 4px;
}

.section-header {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    background: var(--primary);
    cursor: pointer;
    user-select: none;
}

.section-header:hover {
    background: var(--primary-hover);
}

.section-icon {
    margin-right: 8px;
    color: white;
    font-size: 10px;
    width: 10px;
}

.section-header h4 {
    margin: 0;
    color: white;
    font-size: 14px;
    font-weight: 500;
    flex-grow: 1;
}

/* Help Button in Section Header */
.help-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #2196F3;
    color: white;
    border-radius: 50%;
    font-size: 13px;
    font-weight: bold;
    text-decoration: none;
    transition: background 0.2s;
    margin-left: 10px;
    flex-shrink: 0;
}

.help-button:hover {
    background: #1976D2;
}

.section-content {
    padding: 8px 10px;
    background: #f0e9e9;
}

/* Property Rows */
.property-row {
    display: flex;
    align-items: flex-start;
    padding: 4px 0;
    border-bottom: 1px solid #f5f5f5;
}

.property-row:last-child {
    border-bottom: none;
}

.property-id {
    width: 50px;
    flex-shrink: 0;
    font-family: var(--font-mono);
    font-size: 11px;
    color: #aaa;
    padding-top: 3px;
}

.property-control {
    flex: 1;
    min-width: 0;
}

.property-group-title {
    font-weight: 600;
    color: var(--secondary);
    padding: 8px 0 4px 0;
    margin-top: 6px;
    border-top: 1px solid #e0e0e0;
    font-size: 13px;
}

.property-group-title:first-child {
    margin-top: 0;
    border-top: none;
    padding-top: 0;
}

/* Form Controls */
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    cursor: pointer;
    margin: 0;
}

.checkbox-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin-top: 1px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.checkbox-label span {
    color: #444;
    font-size: 13px;
    line-height: 1.4;
}

.enum-control,
.number-control,
.text-control {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.enum-control label,
.number-control label,
.text-control label {
    font-size: 13px;
    color: #444;
    margin: 0;
}

.enum-control select,
.number-control input,
.text-control input,
.text-control textarea {
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 14px;
    max-width: 220px;
}

.text-control textarea {
    resize: vertical;
    min-height: 50px;
    font-family: var(--font-mono);
    font-size: 13px;
}

.number-control input {
    width: 80px;
}

/* SQL Panel - Right side */
.sql-panel {
    flex: 1;
    display: flex;
    flex-direction: row;
    min-width: 0;
    background: #f0e9e9;
}

.sql-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 10px;
}

.sql-column:first-child {
    border-right: 1px solid var(--border);
}

.sql-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.sql-header label {
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

#sqlInput {
    flex: 1;
    resize: none;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.5;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f0e9e9;
}

#sqlInput:focus {
    outline: none;
    border-color: var(--primary);
}

#sqlInput::placeholder {
    color: #999;
    font-style: italic;
}

.sql-result {
    flex: 1;
    background-color: #f8f4ec;
    font-size: 14px;
    line-height: 1.5;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: auto;
    font-family: var(--font-mono);
    white-space: pre;
}

/* Footer */
.app-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 16px;
    background: var(--bg-panel);
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
}

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

.wasm-status.loading { color: #3b82f6; }
.wasm-status.ready { color: #22c55e; }
.wasm-status.error { color: #ef4444; }

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.wasm-status.loading .status-dot {
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.format-counter {
    color: #bbb;
    font-size: 12px;
}

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

::-webkit-scrollbar-track {
    background: #f5f5f5;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Responsive */
@media (max-width: 1100px) {
    .header-nav {
        display: none;
    }
    
    .main-layout {
        flex-direction: column;
    }
    
    .settings-panel {
        width: 100%;
        max-height: 50vh;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}

@media (max-width: 768px) {
    .sql-panel {
        flex-direction: column;
    }
    
    .sql-column:first-child {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}
