/* ── Mind Map Studio — Retro Bold Style ───────────────────────────────── */

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

:root {
    --purple: #2e1065;
    --pink: #f9a8d4;
    --pink-dark: #f472b6;
    --border: #2e1065;
    --shadow: #2e1065;
    --text-secondary: #7c3aed;
    --panel-width: 260px;
    --canvas-bg: #F9FAFB;
}

body {
    font-family: 'Poppins', sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ── Custom scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #fae8ff; }
::-webkit-scrollbar-thumb { background: #c084fc; border-radius: 4px; }

/* ── Retro components ──────────────────────────────────────────────── */
.retro-card {
    border: 3px solid var(--purple);
    box-shadow: 5px 5px 0px var(--purple);
    transition: all 0.2s ease;
}
.retro-card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 7px 7px 0px var(--purple);
}

.retro-btn {
    border: 2px solid var(--purple);
    box-shadow: 3px 3px 0px var(--purple);
    transition: all 0.15s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.retro-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0px var(--purple);
}

/* ── DASHBOARD ─────────────────────────────────────────────────────── */
.dashboard-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.dashboard-header {
    background: white;
    padding: 14px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--purple);
    box-shadow: 0 4px 0px var(--purple);
    z-index: 10;
}

.dashboard-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.doc-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    border: 3px solid var(--purple);
    box-shadow: 5px 5px 0px var(--purple);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.doc-card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 7px 7px 0px var(--purple);
}

.doc-card .doc-icon {
    font-size: 40px;
    margin-bottom: 16px;
    display: block;
}

.doc-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--purple);
    word-break: break-word;
    font-family: 'Fredoka', sans-serif;
}

.doc-card .doc-meta {
    font-size: 13px;
    color: #7c3aed;
    margin-bottom: 16px;
    font-weight: 500;
}

.doc-card .doc-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.doc-card:hover .doc-actions {
    opacity: 1;
}

.new-doc-card {
    background: linear-gradient(135deg, #fce7f3 0%, #f3e8ff 100%);
    border: 3px dashed #c084fc;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 3px 3px 0px rgba(46, 16, 101, 0.15);
}

.new-doc-card:hover {
    border-color: var(--purple);
    border-style: solid;
    background: linear-gradient(135deg, #fbcfe8 0%, #ede9fe 100%);
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0px rgba(46, 16, 101, 0.25);
}

.new-doc-card .plus-icon {
    font-size: 48px;
    color: var(--pink-dark);
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1;
}

.new-doc-card p {
    font-weight: 600;
    color: var(--purple);
    font-family: 'Fredoka', sans-serif;
    font-size: 15px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state .empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 8px;
    font-family: 'Fredoka', sans-serif;
}

.empty-state p {
    font-size: 14px;
}

/* ── EDITOR ────────────────────────────────────────────────────────── */
.editor-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.editor-toolbar {
    background: white;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 3px solid var(--purple);
    box-shadow: 0 4px 0px var(--purple);
    z-index: 20;
    gap: 12px;
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-btn {
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid var(--purple);
    box-shadow: 2px 2px 0px var(--purple);
    transition: all 0.15s ease;
    background: white;
    color: var(--purple);
    font-family: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.toolbar-btn:hover {
    background: #fdf2f8;
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0px var(--purple);
}

.toolbar-btn:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0px var(--purple);
}

.toolbar-btn-primary {
    background: var(--pink) !important;
    color: white !important;
}
.toolbar-btn-primary:hover {
    background: var(--pink-dark) !important;
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background: #e5e7eb;
    margin: 0 4px;
}

.doc-title-input {
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--purple);
    text-align: center;
    font-family: 'Fredoka', sans-serif;
    outline: none;
    transition: all 0.2s;
    width: 280px;
}

.doc-title-input:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(244, 114, 182, 0.2);
}

.save-indicator {
    font-size: 12px;
    color: #10b981;
    font-weight: 500;
    min-width: 60px;
}

/* ── Canvas ────────────────────────────────────────────────────────── */
/* ── Editor Layout ──────────────────────────────────────────────────── */
.editor-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

.canvas-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: var(--canvas-bg);
}

#mindmap-canvas {
    position: absolute;
    top: 0;
    left: 0;
    cursor: grab;
}
#mindmap-canvas:active { cursor: grabbing; }
#mindmap-canvas.panning { cursor: grabbing; }

/* ── Editor Properties Panel ────────────────────────────────────────── */
.properties-panel {
    width: var(--panel-width);
    background: white;
    border-left: 3px solid var(--purple);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
    z-index: 50;
}

.panel-header {
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 700;
    color: var(--purple);
    border-bottom: 2px solid #f3e8ff;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Fredoka', sans-serif;
}

.panel-section {
    padding: 14px 16px;
    border-bottom: 1px solid #f3e8ff;
}

.panel-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--purple);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.panel-input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
}
.panel-input:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(244, 114, 182, 0.2);
}

/* Emoji grid */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
}
.emoji-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    background: #f9fafb;
    transition: all 0.15s;
}
.emoji-btn:hover {
    background: #fdf2f8;
    border-color: #f9a8d4;
}
.emoji-btn.selected {
    background: #fdf2f8;
    border-color: var(--purple);
    box-shadow: 2px 2px 0px var(--purple);
}

/* Color picker */
.color-picker-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.color-swatch {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s;
    position: relative;
    overflow: hidden;
}
.color-swatch:hover {
    transform: scale(1.1);
}
.color-swatch.selected {
    border-color: var(--purple);
    box-shadow: 2px 2px 0px var(--purple);
}
.color-swatch input[type="color"] {
    position: absolute;
    top: -4px;
    left: -4px;
    width: calc(100% + 8px);
    height: calc(100% + 8px);
    opacity: 0;
    cursor: pointer;
}

/* Edge style */
.edge-style-options {
    display: flex;
    gap: 6px;
}
.edge-style-btn {
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    background: white;
    color: #6b7280;
    transition: all 0.15s;
    font-family: inherit;
}
.edge-style-btn:hover {
    border-color: #f9a8d4;
    color: var(--purple);
}
.edge-style-btn.selected {
    background: #fdf2f8;
    border-color: var(--purple);
    color: var(--purple);
    box-shadow: 2px 2px 0px var(--purple);
}

/* Buttons inside panel */
.btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}
.btn-sm {
    padding: 6px 12px;
    font-size: 11px;
}
.btn-danger {
    background: #fee2e2;
    color: #dc2626;
    border: 2px solid #fca5a5;
}
.btn-danger:hover {
    background: #fecaca;
}

/* ── Toast Notifications ──────────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    border: 2px solid;
    box-shadow: 3px 3px 0px rgba(0,0,0,0.1);
    animation: toast-in 0.3s ease;
}
.toast.info { background: #dbeafe; border-color: #93c5fd; color: #1e40af; }
.toast.success { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.toast.error { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ── Modal Overlay ────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    border: 3px solid var(--purple);
    box-shadow: 6px 6px 0px var(--purple);
}
.modal-content h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--purple);
    margin-bottom: 8px;
    font-family: 'Fredoka', sans-serif;
}
.modal-content p {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 20px;
}
.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .properties-panel {
        width: 100%;
        max-height: 40vh;
        border-left: none;
        border-top: 3px solid var(--purple);
    }
    .dashboard-content {
        padding: 16px;
    }
    .docs-grid {
        grid-template-columns: 1fr;
    }
    .doc-card .doc-actions {
        opacity: 1;
    }
    .doc-title-input {
        width: 140px;
        font-size: 12px;
    }
    .editor-toolbar {
        padding: 8px 12px;
        flex-wrap: wrap;
        height: auto;
        gap: 4px;
    }
}
