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

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #151515;
    --bg-tertiary: #1f1f1f;
    --bg-hover: #2a2a2a;
    
    --color-primary: #a78bfa;
    --color-secondary: #10b981;
    --color-accent: #06b6d4;
    --color-danger: #ef4444;
    
    --text-primary: #ffffff;
    --text-secondary: #a3a3a3;
    --text-muted: #737373;
    
    --border-color: #333333;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.7);
    
    --glow-purple: 0 0 20px rgba(167, 139, 250, 0.3);
    --glow-green: 0 0 20px rgba(16, 185, 129, 0.3);
}

body {
    font-family: 'Poppins', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 2rem;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(167, 139, 250, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(16, 185, 129, 0.08) 0%, transparent 50%);
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(167, 139, 250, 0.03) 0%, transparent 60%),
        radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.03) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

body > * {
    position: relative;
    z-index: 1;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    animation: fadeInDown 0.6s ease-out;
}

.main-layout {
    display: flex;
    gap: 1.5rem;
    height: calc(100vh - 250px);
}

.left-column {
    flex: 0 0 450px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-height: 100%;
    overflow-y: auto;
}

.right-column {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.placeholder-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 2px dashed var(--border-color);
    animation: fadeIn 0.6s ease-out;
}

.placeholder-content {
    text-align: center;
    padding: 3rem;
}

.placeholder-content i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    opacity: 0.5;
}

.placeholder-content h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.placeholder-content p {
    font-size: 1rem;
    color: var(--text-secondary);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.logo {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    box-shadow: 0 10px 30px rgba(167, 139, 250, 0.4);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

header h1 {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 30px rgba(167, 139, 250, 0.3);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 400;
}

.input-section {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    animation: fadeInUp 0.6s ease-out;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

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

.input-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-header h2 i,
.output-header h2 i {
    color: var(--color-primary);
}

.textarea-wrapper {
    position: relative;
}

.textarea-icon {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    color: var(--text-muted);
    font-size: 1.5rem;
    pointer-events: none;
    opacity: 0.3;
    transition: all 0.3s ease;
}

textarea:focus + .textarea-icon {
    color: var(--color-primary);
    opacity: 0.6;
    transform: scale(1.1);
}

textarea {
    width: 100%;
    flex: 1;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    resize: none;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--glow-purple);
}

textarea::placeholder {
    color: var(--text-muted);
}

.input-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-start;
    flex-wrap: nowrap;
}

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

.btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    font-family: 'Inter', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn i {
    font-size: 1rem;
}

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

.btn-primary:hover {
    background: #8b6ef8;
    box-shadow: var(--glow-purple);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

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

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

.btn-accent:hover {
    background: #059669;
    box-shadow: var(--glow-green);
}

.output-section {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    animation: fadeInUp 0.6s ease-out;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.output-section:hover {
    box-shadow: var(--shadow-lg);
}

.output-section.hidden {
    display: none;
}

.placeholder-section.hidden {
    display: none;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.output-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.view-toggle {
    display: flex;
    gap: 0.5rem;
}

.toggle-btn {
    padding: 0.625rem 1.25rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.toggle-btn i {
    font-size: 1.1rem;
}

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

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

.toggle-btn.active:hover {
    background: #8b6ef8;
}

.code-view, .map-view {
    min-height: 400px;
}

.map-view.hidden {
    display: none;
}

.json-display {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 1.5rem;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.8;
    overflow: auto;
    border: 1px solid var(--border-color);
    flex: 1;
    white-space: pre;
    word-wrap: break-word;
}

.json-key {
    color: #fb923c;
    font-weight: 600;
}

.json-string {
    color: #34d399;
    font-style: italic;
}

.json-number {
    color: #60a5fa;
    font-weight: 600;
}

.json-boolean {
    color: #c084fc;
    font-weight: 600;
}

.json-null {
    color: var(--text-muted);
    font-style: italic;
}

.json-bracket {
    color: var(--text-primary);
    font-weight: bold;
}

.mind-map-container {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 2rem;
    min-height: 500px;
    border: 1px solid var(--border-color);
    overflow: auto;
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid var(--color-danger);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    color: var(--color-danger);
    font-weight: 500;
    margin-top: 1rem;
    animation: fadeIn 0.3s ease-out;
}

.error-message.hidden {
    display: none;
}

/* Saved JSONs Section */
.saved-jsons-section {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    min-height: 200px;
    max-height: 400px;
}

.saved-jsons-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.saved-jsons-section h3 i {
    color: var(--color-primary);
}

.saved-jsons-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    flex: 1;
}

.saved-json-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    cursor: pointer;
    flex-shrink: 0;
}

.saved-json-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary);
}

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

.saved-json-item-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.saved-json-item-delete {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--color-danger);
    color: var(--color-danger);
    padding: 0.4rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.saved-json-item-delete:hover {
    background: var(--color-danger);
    color: white;
}

.saved-json-item-preview {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.saved-json-item-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Save Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-content-small {
    position: relative;
    z-index: 10001;
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: 0 0 50px rgba(167, 139, 250, 0.3);
    border: 2px solid var(--color-primary);
    width: 90%;
    max-width: 500px;
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.modal-header-small h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-close-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid var(--color-danger);
    color: var(--color-danger);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close-small:hover {
    background: var(--color-danger);
    color: white;
    transform: rotate(90deg);
}

.modal-body {
    padding: 2rem;
}

.modal-body label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
}

.modal-body input {
    width: 100%;
    padding: 0.875rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.modal-body input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.1);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* 3D Mind Map Modal Styles */
.mind-map-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mind-map-modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    position: relative;
    z-index: 10000;
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 2px solid var(--color-primary);
    box-shadow: 
        0 0 50px rgba(167, 139, 250, 0.3),
        0 0 100px rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 2px solid var(--border-color);
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.1), rgba(16, 185, 129, 0.1));
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid var(--color-danger);
    color: var(--color-danger);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.btn-close:hover {
    background: var(--color-danger);
    color: white;
    transform: rotate(90deg);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}

.modal-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 2px solid var(--border-color);
    background: var(--bg-tertiary);
}

.control-info {
    display: flex;
    gap: 2rem;
}

.info-item {
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    text-transform: none;
}

.three-container {
    flex: 1;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.three-container svg {
    display: block;
    width: 100%;
    height: 100%;
}

.three-container svg text {
    user-select: text;
    cursor: text;
}

.three-container canvas {
    display: block;
    width: 100%;
    height: 100%;
    transition: transform 0.1s ease-out;
}

.canvas-wrapper {
    width: 100%;
    height: 100%;
}

.zoom-controls {
    display: flex;
    gap: 0.5rem;
}

.zoom-controls .btn {
    min-width: 50px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .input-section,
    .output-section {
        padding: 1.5rem;
    }

    .output-header {
        flex-direction: column;
        align-items: stretch;
    }

    .view-toggle {
        width: 100%;
        justify-content: space-between;
    }

    .toggle-btn {
        flex: 1;
    }

    .modal-content {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-header h2 {
        font-size: 1.2rem;
    }

    .modal-controls {
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .control-info {
        flex-direction: column;
        gap: 0.5rem;
    }
}

