/* ==========================================================================
   Verge Web Editor Design System - Minimalist & Glassmorphic Redesign
   ========================================================================== */

:root {
    /* Harmonious Obsidian/Navy Dark Theme */
    --bg-main: #07090e;
    --bg-card: rgba(20, 26, 38, 0.45);
    --bg-input: rgba(0, 0, 0, 0.2);
    --border-color: rgba(255, 255, 255, 0.05);
    
    --text-primary: #e6ebf5;
    --text-secondary: #a0aec0;
    --text-muted: #64748b;

    /* Curated Accent Colors */
    --accent-cyan: #00d2ff;
    --accent-cyan-hover: #00b9e0;
    --accent-cyan-glow: rgba(0, 210, 255, 0.15);
    --accent-emerald: #00f5a0;
    --accent-emerald-hover: #00db8f;
    --accent-danger: #ff5b5b;
    --accent-danger-hover: #e04b4b;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.5);
    --transition-speed: 0.2s;
}

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

body {
    /* Beautiful deep radial gradient background */
    background: radial-gradient(circle at 50% 50%, #151922 0%, #06080b 100%);
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Helper Utilities */
.hidden {
    display: none !important;
}

.text-right {
    text-align: right;
}

/* Minimalist Scrollbar */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}

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

/* Minimalist Header with glass effect */
.app-header {
    background: rgba(12, 15, 23, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    height: 64px;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    z-index: 10;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background-image: url('logo.png');
    background-size: cover;
    background-position: center;
    image-rendering: pixelated;
    border-radius: 6px;
    filter: drop-shadow(0 0 4px var(--accent-cyan-glow));
}

.logo-text h1 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: 0.5px;
}

.logo-text span {
    font-size: 9.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent-cyan);
}

/* Buttons */
.btn {
    font-family: var(--font-heading);
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-speed);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 18px;
    font-size: 13px;
    letter-spacing: 0.2px;
}

.btn-primary {
    background-color: var(--accent-cyan);
    color: #05070a;
}
.btn-primary:hover {
    background-color: var(--accent-cyan-hover);
    box-shadow: 0 0 12px rgba(0, 210, 255, 0.25);
    transform: translateY(-0.5px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background-color: rgba(255, 91, 91, 0.06);
    color: var(--accent-danger);
    border: 1px solid rgba(255, 91, 91, 0.15);
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 4px;
}
.btn-danger:hover {
    background-color: var(--accent-danger);
    color: #fff;
    border-color: var(--accent-danger);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 11.5px;
}

/* Layout */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    width: 100%;
}

/* Sidebar styling (clean, borderless cards feel) */
.sidebar {
    width: 260px;
    background: rgba(12, 15, 23, 0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-right: 1px solid var(--border-color);
    padding: 30px 24px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sidebar-section h3 {
    font-family: var(--font-heading);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    font-weight: 500;
}

.nav-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 400;
    color: var(--text-secondary);
    transition: all var(--transition-speed);
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: rgba(0, 210, 255, 0.04);
    color: var(--accent-cyan);
    font-weight: 500;
}

.nav-item-badge {
    font-size: 10px;
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 4px;
    transition: all var(--transition-speed);
}

.nav-item.active .nav-item-badge {
    border-color: rgba(0, 210, 255, 0.15);
    color: var(--accent-cyan);
    background: transparent;
}

/* Editor Workspace Container */
.editor-pane {
    flex: 1;
    overflow-y: auto;
    padding: 50px 40px;
    background-color: transparent;
    display: flex;
    flex-direction: column;
}

.editor-empty {
    margin: auto;
    text-align: center;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    background-image: url('logo.png');
    background-size: cover;
    image-rendering: pixelated;
    opacity: 0.1;
    margin-bottom: 5px;
}

.editor-empty h2 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
}

.editor-empty p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Workspace layout */
.editor-workspace {
    display: flex;
    flex-direction: column;
    gap: 30px;
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
}

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

.workspace-title-area h2 {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.workspace-title-area span {
    font-size: 12.5px;
    color: var(--text-muted);
}

/* Glassmorphic cards for sections */
.workspace-section {
    background: rgba(20, 26, 38, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.workspace-section h3 {
    font-family: var(--font-heading);
    font-size: 14.5px;
    font-weight: 500;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 12px;
    letter-spacing: 0.3px;
}

/* Metadata Layout */
.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.input-group input, .input-group select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 9px 12px;
    font-size: 13.5px;
    font-family: var(--font-body);
    transition: all var(--transition-speed);
    width: 100%;
    outline: none;
}

.input-group input:focus, .input-group select:focus {
    border-color: rgba(0, 210, 255, 0.4);
    background: rgba(0, 0, 0, 0.3);
}

/* Parents Section */
.parents-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 5px;
}

.parents-area label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.chip span {
    color: var(--text-secondary);
}

.chip-remove {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    transition: color var(--transition-speed);
}

.chip-remove:hover {
    color: var(--accent-danger);
}

.add-parent-row {
    display: flex;
    gap: 10px;
    max-width: 320px;
    margin-top: 5px;
}

.add-parent-row select {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 6px 10px;
    font-size: 13px;
    outline: none;
    transition: all var(--transition-speed);
}

.add-parent-row select:focus {
    border-color: rgba(0, 210, 255, 0.4);
    background: rgba(0, 0, 0, 0.3);
}

/* Permissions layout */
.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 12px;
}

.section-header-row h3 {
    border-bottom: none;
    padding-bottom: 0;
}

.search-wrap input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 6px 12px;
    font-size: 12.5px;
    width: 220px;
    transition: all var(--transition-speed);
    outline: none;
}

.search-wrap input:focus {
    border-color: rgba(0, 210, 255, 0.4);
    background: rgba(0, 0, 0, 0.3);
}

.add-permission-card {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 16px;
}

.add-perm-grid {
    display: flex;
    gap: 12px;
}

.add-perm-grid input {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 9px 12px;
    font-size: 13.5px;
    transition: all var(--transition-speed);
    outline: none;
}

.add-perm-grid input:focus {
    border-color: rgba(0, 210, 255, 0.4);
    background: rgba(0, 0, 0, 0.3);
}

.add-perm-grid select {
    width: 140px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 9px 12px;
    font-size: 13.5px;
    transition: all var(--transition-speed);
    outline: none;
}

.add-perm-grid select:focus {
    border-color: rgba(0, 210, 255, 0.4);
    background: rgba(0, 0, 0, 0.3);
}

/* Permissions Table */
.table-container {
    width: 100%;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.15);
}

.permissions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.permissions-table th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    font-weight: 500;
    padding: 10px 16px;
    position: sticky;
    top: 0;
    z-index: 1;
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 11px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.permissions-table td {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.permissions-table tr:last-child td {
    border-bottom: none;
}

.permissions-table tr:hover {
    background-color: rgba(255, 255, 255, 0.01);
}

.permission-node {
    font-family: monospace;
    color: #a7b8cc;
    font-size: 13px;
    word-break: break-all;
}

.badge-val {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    text-align: center;
    min-width: 60px;
    transition: all var(--transition-speed);
}

.badge-val.true {
    background-color: rgba(0, 245, 160, 0.05);
    color: var(--accent-emerald);
    border: 1px solid rgba(0, 245, 160, 0.15);
}
.badge-val.true:hover {
    background-color: rgba(0, 245, 160, 0.12);
}

.badge-val.false {
    background-color: rgba(255, 91, 91, 0.05);
    color: var(--accent-danger);
    border: 1px solid rgba(255, 91, 91, 0.15);
}
.badge-val.false:hover {
    background-color: rgba(255, 91, 91, 0.12);
}

/* Modals & Overlays */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(5, 7, 10, 0.8);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.spinner-box, .error-box, .success-box {
    background: rgba(20, 26, 38, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 40px;
    width: 440px;
    max-width: 90%;
    text-align: center;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* Spinner */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(0, 210, 255, 0.15);
    border-top: 3px solid var(--accent-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.error-icon {
    font-size: 36px;
    color: var(--accent-danger);
}

.success-icon {
    font-size: 40px;
    color: var(--accent-emerald);
    background-color: rgba(0, 245, 160, 0.05);
    border: 1px solid rgba(0, 245, 160, 0.2);
    border-radius: 50%;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.command-box {
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    width: 100%;
    word-break: break-all;
}

.command-box code {
    font-family: monospace;
    color: #ffd000;
    font-size: 13.5px;
}
