:root {
    --bg-color: #0f172a;
    --text-color: #e2e8f0;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --secondary: #334155;
    --secondary-hover: #475569;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --danger: #ef4444;
    --success: #10b981;
    --border-color: #334155;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.1) 0%, transparent 20%);
}

.hidden {
    display: none !important;
}

/* Layout */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    margin-bottom: 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.logo {
    font-weight: 700;
    font-size: 1.5rem;
    background: linear-gradient(45deg, var(--primary), #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    font-size: 0.9rem;
}

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

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

.btn-secondary {
    background-color: var(--secondary);
    color: white;
}

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

.btn-danger {
    background-color: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-danger:hover {
    background-color: var(--danger);
    color: white;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    background: none;
    font-size: 1.2rem;
    color: var(--text-color);
    padding: 0 0.5rem;
}

/* Login */
.login-card {
    max-width: 400px;
    margin: 4rem auto;
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.form-group {
    margin-bottom: 1rem;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #94a3b8;
}

input {
    width: 100%;
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.5);
    color: white;
    outline: none;
}

input:focus {
    border-color: var(--primary);
}

.error-msg {
    color: var(--danger);
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* Dashboard */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.grid-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.table-card {
    padding: 1.5rem;
    border-radius: 12px;
    transition: transform 0.2s;
    position: relative;
    cursor: pointer;
}

.table-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.table-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.table-card .meta {
    font-size: 0.8rem;
    color: #94a3b8;
}

.table-card .actions {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Editor */
.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

#editor-table-name {
    font-size: 1.2rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px solid transparent;
}

#editor-table-name:focus {
    border-color: var(--primary);
    outline: none;
    background: rgba(0, 0, 0, 0.2);
}

#save-status {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-right: 1rem;
}

.table-wrapper {
    padding: 1rem;
    border-radius: 12px;
    overflow: hidden;
}

.table-controls {
    margin-bottom: 1rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    gap: 0.5rem;
}

.table-scroll {
    overflow: auto;
    max-height: 70vh;
    /* Enable horizontal scrolling */
    max-width: 100%;
}

table {
    /* Remove width 100% to allow expansion */
    border-collapse: collapse;
    table-layout: fixed;
    /* Fixed width cells */
}

td,
th {
    border: 1px solid var(--border-color);
    padding: 0;
    /* Fixed width for cells */
    width: 150px;
    min-width: 150px;
    height: 40px;
    position: relative;
}

/* Selected cell highlight */
td input:focus {
    background: rgba(59, 130, 246, 0.2);
    outline: 2px solid var(--primary);
    z-index: 10;
    position: relative;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--secondary);
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
    z-index: 1000;
}

@keyframes slideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}