/* ===== CSS Variables ===== */
:root {
    /* Dark theme (default) */
    --color-bg: #0a0e14;
    --color-bg-secondary: #151b23;
    --color-bg-tertiary: #1d242e;
    --color-surface: #1e2530;
    --color-surface-hover: #252d3a;
    --color-border: #2d3748;
    --color-border-light: #3d4a5c;
    
    --color-primary: #00d9ff;
    --color-primary-hover: #00c4e6;
    --color-primary-muted: rgba(0, 217, 255, 0.15);
    --color-primary-text: #0a0e14;
    
    --color-accent: #ff6b6b;
    --color-accent-hover: #ff5252;
    
    --color-success: #00e676;
    --color-warning: #ffab40;
    --color-danger: #ff5252;
    
    --color-text: #e8eaed;
    --color-text-secondary: #9aa0a6;
    --color-text-muted: #6b7280;
    
    --color-logo-gradient-start: var(--color-primary);
    --color-logo-gradient-end: #fff;
    
    --color-graph-bg: rgba(0, 217, 255, 0.03);
    --color-modal-backdrop: rgba(0, 0, 0, 0.7);
    
    --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(0, 217, 255, 0.2);
    
    --transition: all 0.2s ease;
}

/* ===== Light Theme ===== */
[data-theme="light"] {
    --color-bg: #f5f7fa;
    --color-bg-secondary: #ffffff;
    --color-bg-tertiary: #eef1f5;
    --color-surface: #ffffff;
    --color-surface-hover: #f0f3f7;
    --color-border: #dce1e8;
    --color-border-light: #c5cdd8;
    
    --color-primary: #0095b3;
    --color-primary-hover: #007a94;
    --color-primary-muted: rgba(0, 149, 179, 0.12);
    --color-primary-text: #ffffff;
    
    --color-accent: #e05454;
    --color-accent-hover: #c94545;
    
    --color-success: #00a854;
    --color-warning: #e89b00;
    --color-danger: #dc4545;
    
    --color-text: #1a2233;
    --color-text-secondary: #5a6678;
    --color-text-muted: #8992a3;
    
    --color-logo-gradient-start: #0095b3;
    --color-logo-gradient-end: #004d5c;
    
    --color-graph-bg: rgba(0, 149, 179, 0.04);
    --color-modal-backdrop: rgba(26, 34, 51, 0.5);
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 30px rgba(0, 149, 179, 0.15);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--font-family);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===== Utility Classes ===== */
.hidden { display: none !important; }
.text-muted { color: var(--color-text-muted); }
.flex-1 { flex: 1; }

/* ===== Auth Screen ===== */
.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    padding: 2rem;
    position: relative;
}

.auth-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(ellipse at 20% 50%, var(--color-primary-muted) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(255, 107, 107, 0.06) 0%, transparent 50%);
    pointer-events: none;
}


.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.logo-icon {
    font-size: 3rem;
    filter: drop-shadow(0 0 20px rgba(0, 217, 255, 0.5));
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-logo-gradient-start), var(--color-logo-gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-subtitle {
    color: var(--color-text-secondary);
    font-size: 0.95rem;
}

.auth-form-container {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.auth-form h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--color-text);
}

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.auth-switch a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* ===== Form Elements ===== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-muted);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--color-text-muted);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    display: block;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 0.5rem;
}

.form-row {
    display: flex;
    gap: 1.5rem;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

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

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

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
    box-shadow: var(--shadow-glow);
}

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

.btn-danger:hover:not(:disabled) {
    background: var(--color-accent-hover);
}

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

.btn-ghost:hover:not(:disabled) {
    background: var(--color-surface-hover);
    border-color: var(--color-border-light);
    color: var(--color-text);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-icon {
    font-size: 1.1rem;
}

.btn.loading {
    position: relative;
    color: transparent !important;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Main App ===== */
.main-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ===== Header ===== */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon-small {
    font-size: 1.5rem;
}

.header-left h1 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
}

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

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

.user-icon {
    opacity: 0.7;
}

/* ===== Screens ===== */
.screen {
    flex: 1;
    overflow: auto;
    padding: 2rem;
}

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

.screen-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* ===== Projects Grid ===== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1.5rem;
}

.project-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: var(--transition);
}

.project-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.project-card:hover {
    border-color: var(--color-border-light);
    box-shadow: var(--shadow-md);
}

.project-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.project-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
}

.project-role {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-weight: 500;
}

.project-role.owner {
    background: var(--color-primary-muted);
    color: var(--color-primary);
}

.project-role.editor {
    background: rgba(255, 171, 64, 0.15);
    color: var(--color-warning);
}

.project-role.viewer {
    background: rgba(107, 114, 128, 0.15);
    color: var(--color-text-secondary);
}

.project-description {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-meta {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--color-text-secondary);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ===== Tree Screen ===== */
.tree-screen {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.tree-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.tree-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.project-title-section {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.project-title-section .btn-sm {
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.project-title-section:hover .btn-sm {
    opacity: 1;
}

.tree-actions {
    display: flex;
    gap: 0.75rem;
}

.tree-content {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

.graph-container {
    flex: 1;
    min-width: 0; /* Позволяет сжиматься */
    position: relative;
    background: 
        radial-gradient(circle at 50% 50%, var(--color-graph-bg) 0%, transparent 50%),
        var(--color-bg);
}

#cy {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* ===== Panel Resizer ===== */
.panel-resizer {
    width: 6px;
    background: var(--color-border);
    cursor: col-resize;
    flex-shrink: 0;
    transition: background-color 0.15s ease;
    position: relative;
}

.panel-resizer::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 40px;
    background: var(--color-text-muted);
    border-radius: 1px;
    opacity: 0.5;
}

.panel-resizer:hover,
.panel-resizer.resizing {
    background: var(--color-primary);
}

.panel-resizer:hover::before,
.panel-resizer.resizing::before {
    background: var(--color-primary);
    opacity: 1;
}

.panel-resizer.hidden {
    display: none;
}

/* ===== Node Info Panel ===== */
.node-info-panel {
    width: 380px;
    min-width: 250px;
    max-width: 600px;
    flex-shrink: 0;
    background: var(--color-surface);
    border-left: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 10;
}

.node-info-panel.hidden {
    display: none;
}

/* Prevent text selection during resize */
.resizing-active {
    user-select: none;
    cursor: col-resize !important;
}

.resizing-active * {
    cursor: col-resize !important;
}

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

.panel-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.btn-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: var(--transition);
}

.btn-close:hover {
    color: var(--color-text);
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

.node-info-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.node-preview-large {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.node-info-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    word-break: break-word;
}

.node-info-grid {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--color-text-secondary);
    font-size: 0.85rem;
}

.info-value {
    color: var(--color-text);
    font-size: 0.85rem;
    text-align: right;
    word-break: break-all;
}

.hash-value {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.node-locations h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--color-text);
}

.location-item {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.location-user {
    display: block;
    font-weight: 500;
    color: var(--color-primary);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.location-path {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    word-break: break-all;
}

/* ===== Modal ===== */
.modal {
    position: fixed;
    inset: 0;
    background: var(--color-modal-backdrop);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-large {
    max-width: 600px;
}

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

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

.modal-content form {
    padding: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.modal-content form .modal-actions {
    padding: 0;
    padding-top: 1.5rem;
}

/* ===== File Upload ===== */
.file-preview {
    width: 100px;
    height: 100px;
    background: var(--color-bg-secondary);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.file-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.no-preview {
    color: var(--color-text-muted);
    font-size: 0.75rem;
    text-align: center;
}

.default-preview-emoji {
    font-size: 3rem;
    line-height: 1;
}

.file-info-row {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
    padding: 1rem;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
}

.file-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.file-info-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.file-info-value {
    font-size: 0.85rem;
    color: var(--color-text);
}

/* ===== Hash Method Selection ===== */
.hash-method-section {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.25rem;
}

.hash-method-header {
    margin-bottom: 0.75rem;
}

.hash-method-header .info-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text);
}

.hash-method-options {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.hash-method-option {
    flex: 1;
    cursor: pointer;
}

.hash-method-option input {
    display: none;
}

.hash-method-card {
    padding: 0.875rem;
    background: var(--color-bg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.hash-method-option input:checked + .hash-method-card {
    border-color: var(--color-primary);
    background: var(--color-primary-muted);
}

.hash-method-card:hover {
    border-color: var(--color-border-light);
}

.hash-method-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text);
    margin-bottom: 0.375rem;
}

.hash-method-desc {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.hash-method-time {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-primary);
}

.hash-result-row {
    margin-top: 0.5rem;
}

/* Hash method badge */
.hash-method-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 500;
}

.hash-method-badge.sampling {
    background: rgba(255, 171, 64, 0.15);
    color: var(--color-warning);
}

.hash-method-badge.full {
    background: var(--color-primary-muted);
    color: var(--color-primary);
}

/* ===== Alerts ===== */
.alert {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

.alert-warning {
    background: rgba(255, 171, 64, 0.1);
    border: 1px solid rgba(255, 171, 64, 0.3);
    color: var(--color-warning);
}

.alert-warning strong {
    display: block;
    margin-bottom: 0.5rem;
}

.alert-warning p {
    margin: 0.25rem 0;
    font-size: 0.85rem;
    opacity: 0.9;
}

/* ===== Notifications ===== */
.notification-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 2000;
    pointer-events: none;
}

.notification {
    padding: 1rem 1.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 400px;
    pointer-events: auto;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification-success {
    border-color: var(--color-success);
    background: rgba(0, 230, 118, 0.1);
}

.notification-error {
    border-color: var(--color-danger);
    background: rgba(255, 82, 82, 0.1);
}

.notification-warning {
    border-color: var(--color-warning);
    background: rgba(255, 171, 64, 0.1);
}

.notification-info {
    border-color: var(--color-primary);
    background: rgba(0, 217, 255, 0.1);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-border-light);
}

/* ===== Share Modal ===== */
.share-modal-body {
    padding: 1.5rem;
}

.share-section {
    margin-bottom: 2rem;
}

.share-section:last-child {
    margin-bottom: 0;
}

.share-section h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

.access-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.access-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    gap: 1rem;
}

.access-item.owner {
    background: var(--color-primary-muted);
}

.access-user-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.access-username {
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.access-email {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.access-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.role-select {
    padding: 0.375rem 0.75rem;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-size: 0.8rem;
    cursor: pointer;
}

.role-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

.role-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 500;
}

.role-badge.owner {
    background: var(--color-primary);
    color: var(--color-primary-text);
}

.user-search-results {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
}

.user-search-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    gap: 1rem;
}

.user-search-item.has-access {
    opacity: 0.5;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.user-name {
    font-weight: 500;
    color: var(--color-text);
}

.user-email {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.add-user-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.role-select-new {
    padding: 0.375rem 0.75rem;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-size: 0.8rem;
}

/* ===== Improved Node Info ===== */
.preview-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.preview-placeholder {
    width: 100px;
    height: 100px;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin: 0 auto 1rem;
}

.locations-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.locations-header h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.locations-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.location-item {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    padding: 0.75rem;
}

.location-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.location-user {
    font-weight: 500;
    color: var(--color-primary);
    font-size: 0.85rem;
}

.location-date {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.location-path-container {
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    overflow-x: auto;
}

.location-path {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    word-break: break-all;
    white-space: pre-wrap;
}

/* ===== Node Description Section ===== */
.node-description-section {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
}

.description-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.description-header .info-label {
    font-weight: 600;
    font-size: 0.9rem;
}

.description-text {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.description-edit {
    margin-top: 0.5rem;
}

.description-edit textarea {
    width: 100%;
    padding: 0.75rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-family: var(--font-main);
    font-size: 0.9rem;
    resize: vertical;
    min-height: 80px;
}

.description-edit textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.description-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* ===== Node Name Section ===== */
.node-name-section {
    text-align: center;
    width: 100%;
}

.node-name-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.node-name-display h3 {
    margin: 0;
    word-break: break-word;
}

.node-name-edit {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.node-name-edit input {
    flex: 1;
    max-width: 200px;
    padding: 0.5rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
}

.node-name-edit input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.name-edit-actions {
    display: flex;
    gap: 0.25rem;
}

/* ===== Location Delete Button ===== */
.location-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.location-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.btn-danger-text {
    color: var(--color-danger) !important;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.btn-danger-text:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
}

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

/* ===== Delete Dropdown ===== */
.delete-dropdown-container {
    position: relative;
    display: inline-block;
}

.delete-dropdown-container .btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-arrow {
    font-size: 0.65rem;
    opacity: 0.8;
    transition: transform 0.2s ease;
}

.delete-dropdown-container.open .dropdown-arrow {
    transform: rotate(180deg);
}

.delete-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 280px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    overflow: hidden;
    animation: dropdownFadeIn 0.15s ease-out;
}

.delete-dropdown.hidden {
    display: none;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease;
    text-align: left;
    font-family: inherit;
    color: var(--color-text);
}

.dropdown-item:hover {
    background: var(--color-surface-hover);
}

.dropdown-item:not(:last-child) {
    border-bottom: 1px solid var(--color-border);
}

.dropdown-item-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.dropdown-item-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.dropdown-item-title {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--color-text);
}

.dropdown-item-desc {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.dropdown-item-danger .dropdown-item-title {
    color: var(--color-danger);
}

.dropdown-item-danger:hover {
    background: rgba(255, 82, 82, 0.1);
}

/* ===== Find File Dropdown ===== */
.find-dropdown-container {
    position: relative;
    display: inline-block;
}

.find-dropdown-container .btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.find-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 260px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    overflow: hidden;
    animation: dropdownFadeIn 0.15s ease-out;
}

.find-dropdown.hidden {
    display: none;
}

/* ===== Theme Switch ===== */
.theme-switch {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    cursor: pointer;
    user-select: none;
}

.theme-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    background: var(--color-border);
    border-radius: 12px;
    transition: background-color 0.2s ease;
}

.switch-slider::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.theme-switch input:checked + .switch-slider {
    background: var(--color-primary);
}

.theme-switch input:checked + .switch-slider::before {
    transform: translateX(20px);
}

.switch-label {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
}

.auth-theme-switch {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 10;
}

/* Smooth transition for theme change */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
    transition: background-color 0.3s ease, 
                border-color 0.3s ease, 
                color 0.3s ease,
                box-shadow 0.3s ease !important;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .auth-screen {
        padding: 1rem;
    }
    
    .auth-form-container {
        padding: 1.5rem;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .tree-header {
        flex-wrap: wrap;
    }
    
    .tree-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .node-info-panel {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 100%;
        max-width: 380px;
        z-index: 100;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .access-item,
    .user-search-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .access-controls,
    .add-user-controls {
        width: 100%;
        margin-top: 0.5rem;
    }
}
