:root {
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --surface-hover: #334155;
    --border-color: #334155;
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;

    --primary-color: #8b5cf6;
    --primary-hover: #7c3aed;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;

    --radius: 8px;
    --font: 'Inter', system-ui, sans-serif;
    --transition: all 0.2s ease;
}

.light-theme {
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --surface-hover: #f1f5f9;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-muted: #64748b;
    --primary-color: #7c3aed;
    --primary-hover: #6d28d9;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font);
    line-height: 1.5;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Base Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.app-header {
    height: 60px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 300px;
    background-color: var(--surface-color);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow-y: auto;
}

.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background-color: var(--bg-color);
}

/* UI Elements */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-family: var(--font);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

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

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

.btn-secondary {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--surface-hover);
    border-color: var(--text-muted);
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

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

.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: transparent;
}

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

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: var(--transition);
}

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

.w-full {
    width: 100%;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

input[type="text"],
input[type="url"],
input[type="number"],
select {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.9rem;
    transition: var(--transition);
    outline: none;
}

input:focus,
select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

/* Sidebar Specifics */
.sidebar-section h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.shortcuts-list {
    list-style: none;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.shortcuts-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

kbd {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-primary);
}

/* Workspace */
.workspace-toolbar {
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.tree-container {
    padding: 2rem;
    flex: 1;
}

/* Tree UI */
.tree-node {
    margin: 0.5rem 0;
    position: relative;
}

.tree-node-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    max-width: 400px;
    user-select: none;
}

.tree-node-content:hover {
    border-color: var(--text-muted);
    transform: translateX(4px);
}

.tree-node-content.selected {
    border-color: var(--primary-color);
    background-color: rgba(139, 92, 246, 0.05);
    box-shadow: 0 0 0 1px var(--primary-color);
}

.drag-handle {
    color: var(--text-muted);
    cursor: grab;
    display: flex;
    align-items: center;
}

.drag-handle:active {
    cursor: grabbing;
}

.node-info {
    flex: 1;
    overflow: hidden;
}

.node-title {
    font-weight: 500;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.node-path {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: monospace;
    margin-top: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.node-children {
    padding-left: 2rem;
    border-left: 1px dashed var(--border-color);
    margin-left: 1.5rem;
}

/* Drop target styles */
.drop-target-active {
    border: 2px dashed var(--primary-color);
    background-color: rgba(139, 92, 246, 0.1);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

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

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Print Styles for PDF Export */
@media print {
    body {
        background-color: white !important;
        color: black !important;
    }

    .no-print,
    .app-header,
    .sidebar,
    .workspace-toolbar {
        display: none !important;
    }

    .main-content {
        overflow: visible;
        display: block;
    }

    .workspace {
        overflow: visible;
    }

    .tree-node-content {
        background-color: white !important;
        border-color: #ccc !important;
        box-shadow: none !important;
        transform: none !important;
    }

    .node-title {
        color: black !important;
    }

    .node-path {
        color: #666 !important;
    }

    .node-children {
        border-left-color: #ddd !important;
    }
}