/* assets/style.css */

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

html, body {
    height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #030712;
    color: #f5f5f5;
}

body {
    display: flex;
    justify-content: center;
    align-items: stretch;
}

.app-container {
    width: 100%;
    max-width: 1400px;
    margin: 16px;
    border-radius: 16px;
    overflow: hidden;
    background: radial-gradient(circle at top left, #111827, #020308);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 32px);
}

/* Header */

.app-header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: #020202;
}

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #e5e7eb;
    margin-right: 24px;
}

.menu {
    display: flex;
    gap: 8px;
    flex: 1;
    align-items: center;
}

.menu-item {
    display: flex;
    gap: 4px;
    align-items: center;
}

.menu-item input[type="file"] {
    font-size: 0.75rem;
    color: #e5e7eb;
}

.menu-item button {
    background: #3b82f6;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    color: #f9fafb;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
}

.menu-item button[disabled] {
    background: #4b5563;
    cursor: default;
    opacity: 0.5;
}

.menu-item button:not([disabled]):hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(59,130,246,0.35);
}

.current-db {
    font-size: 0.8rem;
    color: #9ca3af;
}

.current-db a {
    color: #60a5fa;
    text-decoration: none;
}

/* Layout */

.main-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 0;
    flex: 1;
}

/* Sidebar */

.sidebar {
    border-right: 1px solid rgba(255,255,255,0.06);
    padding: 16px;
    background: #1f2933;
    overflow-y: auto;
}

.sidebar h2 {
    font-size: 0.95rem;
    margin-bottom: 8px;
    color: #e5e7eb;
}

.table-list {
    list-style: none;
    margin-bottom: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.table-list li {
    margin-bottom: 4px;
}

.table-list a {
    display: block;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #e5e7eb;
    text-decoration: none;
    background: transparent;
    border: 1px solid transparent;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s;
}

.table-list li.active a,
.table-list a:hover {
    background: rgba(59,130,246,0.16);
    border-color: rgba(59,130,246,0.7);
    transform: translateX(1px);
}

.sidebar-section {
    margin-top: 12px;
}

.sidebar-section h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    margin-bottom: 6px;
}

.create-table-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.create-table-form input {
    background: #020617;
    border-radius: 6px;
    border: 1px solid rgba(148,163,184,0.5);
    color: #e5e7eb;
    padding: 4px 6px;
    font-size: 0.8rem;
}

.create-table-form button {
    margin-top: 4px;
    background: #3b82f6;
    border: none;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #f9fafb;
    cursor: pointer;
}

.hint {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 8px;
}

/* Content */

.content {
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #ffffff;
    color: #111827;
    overflow-y: auto;
}

.welcome h1,
.welcome h2 {
    margin-bottom: 8px;
}

.welcome p {
    color: #4b5563;
    font-size: 0.9rem;
}

/* Alerts */

.alert {
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 0.85rem;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* Tabs */

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #d1d5db;
    margin-bottom: 10px;
}

.tab {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 8px 8px 0 0;
    text-decoration: none;
    color: #6b7280;
    background: transparent;
    border-bottom: 2px solid transparent;
}

.tab.active {
    color: #111827;
    background: #ffffff;
    border-bottom-color: #3b82f6;
}

.tab:hover:not(.active) {
    color: #111827;
}

/* Tabellenansicht */

.tab-content h2 {
    font-size: 1rem;
    margin-bottom: 10px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 10px;
    overflow: hidden;
    font-size: 0.8rem;
    background: #ffffff;
    color: #111827;
    border: 1px solid #e5e7eb;
}

.data-table thead {
    background: #f3f4f6;
}

.data-table th,
.data-table td {
    border-bottom: 1px solid #e5e7eb;
    padding: 6px 8px;
    text-align: left;
}

.data-table th {
    font-weight: 600;
}

.data-table tbody tr:nth-child(even) {
    background: #f9fafb;
}

.data-table tbody tr:hover {
    background: #e0edff;
}

.cell-input {
    width: 100%;
    background: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    padding: 4px;
    color: #111827;
    font-size: 0.78rem;
}

.actions {
    white-space: nowrap;
}

.actions button {
    background: #3b82f6;
    border: none;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.75rem;
    margin-right: 4px;
    cursor: pointer;
    color: #f9fafb;
}

.actions button:nth-child(2) {
    background: #ef4444;
    color: #f9fafb;
}

.new-row {
    background: #dbeafe;
}

/* Struktur & WebApp */

.structure-actions {
    margin-top: 12px;
}

.structure-actions button {
    background: #3b82f6;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    color: #f9fafb;
    margin-top: 8px;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
}

.inline-form input[type="text"] {
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    color: #111827;
    padding: 4px 6px;
    font-size: 0.8rem;
}

.inline-form select {
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    color: #111827;
    padding: 3px 6px;
    font-size: 0.8rem;
}

.inline-form label {
    font-size: 0.8rem;
    color: #374151;
}

.inline-form button {
    background: #3b82f6;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    color: #f9fafb;
}

.structure-form select {
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    color: #111827;
    padding: 3px 6px;
    font-size: 0.8rem;
}

.structure-form input[type="text"] {
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    color: #111827;
    padding: 3px 6px;
    font-size: 0.8rem;
}

.small-btn {
    background: #e5e7eb;
    color: #111827;
    border-radius: 6px;
    border: none;
    padding: 3px 6px;
    font-size: 0.75rem;
    cursor: pointer;
}

.center {
    text-align: center;
}

/* Bearbeiten */

.edit-section {
    margin-bottom: 16px;
}

.danger-btn {
    background: #ef4444;
    color: #f9fafb;
}

/* SQL */

.sql-form textarea {
    width: 100%;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.85rem;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #111827;
}

.sql-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.sql-actions button {
    background: #3b82f6;
    border: none;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    color: #f9fafb;
}

/* Responsiv */

@media (max-width: 960px) {
    .app-container {
        margin: 0;
        border-radius: 0;
        height: 100vh;
    }
    .main-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        border-right: none;
        border-bottom: 1px solid rgba(55,65,81,0.7);
    }
    .app-header {
        flex-wrap: wrap;
        gap: 8px;
    }
}
