:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --secondary: #64748B;
    --background: #F1F5F9;
    --surface: #FFFFFF;
    --text: #0F172A;
    --text-light: #64748B;
    --border: #E2E8F0;
    --danger: #EF4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: #1E293B;
    color: white;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.sidebar .logo h2 {
    margin-bottom: 2rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #60A5FA;
}

.nav-links {
    list-style: none;
}

.nav-links li a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: #94A3B8;
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s;
    margin-bottom: 0.5rem;
}

.nav-links li a:hover,
.nav-links li a.active {
    background-color: #334155;
    color: white;
}

.nav-links li a i {
    margin-right: 0.75rem;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    padding: 0;
}

/* Toolbar */
.toolbar {
    background-color: var(--surface);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.group {
    display: flex;
    gap: 0.5rem;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    border: none;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: 0.2s;
    font-size: 0.875rem;
}

.btn.primary {
    background-color: var(--primary);
    color: white;
}

.btn.primary:hover {
    background-color: var(--primary-hover);
}

.btn.secondary {
    background-color: white;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn.secondary:hover {
    background-color: #F8FAFC;
}

.btn.danger {
    background-color: #FEE2E2;
    color: var(--danger);
}

.btn.danger:hover {
    background-color: #FECACA;
}

.btn.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn.btn-outline:hover {
    background: #EEF2FF;
}

/* Content Layout */
.content-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

.table-container {
    width: 100%;
    height: 100%;
    overflow: auto;
    padding: 1rem;
    background: white;
}

.table-container.hidden {
    display: none;
}

.editor-panel {
    width: 100%;
    height: 100%;
    background: #F8FAFC;
    padding: 2rem;
    overflow-y: auto;
    display: none;
    flex-direction: column;
}

.editor-panel.active {
    display: flex;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.editor-panel h3 {
    margin-bottom: 0;
}

/* Form adjustments for full screen */
#editForm {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);

    /* 2 Column Grid */
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 768px) {
    #editForm {
        grid-template-columns: 1fr;
    }
}

.form-group {
    margin-bottom: 0;
    /* Let gap handle spacing */
    display: flex;
    flex-direction: column;
}

/* Helper for full width items */
.form-group.full-width-group {
    grid-column: 1 / -1;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    white-space: nowrap;
}

th {
    text-align: left;
    padding: 0.75rem 1rem;
    background-color: #F8FAFC;
    position: sticky;
    top: 0;
    border-bottom: 2px solid var(--border);
    color: var(--text-light);
    font-weight: 600;
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

tr:hover td {
    background-color: #F1F5F9;
}

tr.selected td {
    background-color: #E0E7FF;
}

tr.dragging {
    opacity: 0.5;
    background: #e2e8f0;
}


/* Form */


.form-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
}

.form-group input,
.form-group textarea {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-size: 0.9rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: 2px solid var(--primary);
    border-color: transparent;
}

.full-width {
    width: 100%;
    margin-top: 1rem;
}

/* Settings */
.settings-container {
    padding: 2rem;
    overflow-y: auto;
    height: 100%;
    max-width: 100%;
    margin: 0;
}

.card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card h2 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--text);
}

.grid-form {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.floating-save {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Mobile Responsiveness */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }

    #mobile-menu-toggle {
        position: fixed;
        bottom: 1.5rem;
        left: 1.5rem;
        z-index: 1000;
        background: var(--primary);
        color: white;
        border: none;
        border-radius: 50%;
        width: 56px;
        height: 56px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
        cursor: pointer;
    }

    .sidebar {
        position: fixed;
        left: -250px;
        top: 0;
        bottom: 0;
        z-index: 999;
        transition: left 0.3s ease;
        box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        width: 100%;
    }

    .toolbar {
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }

    .toolbar h1 {
        font-size: 1.1rem;
        text-align: center;
    }

    .group {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }

    .table-container {
        padding: 0.25rem;
    }

    table {
        font-size: 0.7rem;
    }

    th,
    td {
        padding: 0.4rem 0.6rem;
    }

    /* Reduce spacing to avoid "zoomed" feel */
    .app-container {
        overflow-x: hidden;
    }
}

/* Auth */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background-color: var(--background);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary);
}

.auth-link {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
}

.auth-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-error {
    background-color: #FEE2E2;
    color: var(--danger);
    border: 1px solid #FECACA;
}

.alert-success {
    background-color: #D1FAE5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}