/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* Screen management */
.screen {
    display: none !important;
    width: 100%;
    height: 100vh;
}

.screen.active {
    display: block !important;
}

/* Login Screen */
#login-screen {
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#login-screen.active {
    display: flex !important;
}

/* Dashboard Screen */
#dashboard-screen.active {
    display: block !important;
}

/* Editor Screen */
#editor-screen.active {
    display: block !important;
}

.login-container {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-form h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: #333;
}

.login-form p {
    text-align: center;
    margin-bottom: 2rem;
    color: #666;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

button {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

button:hover {
    background: #5a67d8;
}

.login-form button {
    width: 100%;
    margin-top: 1rem;
}

.error-message {
    color: #e53e3e;
    font-size: 12px;
    margin-top: 0.5rem;
    display: none;
}

.demo-credentials {
    margin-top: 2rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 5px;
    border-left: 4px solid #667eea;
}

.demo-credentials h3 {
    margin-bottom: 0.5rem;
    font-size: 14px;
    color: #333;
}

.demo-credentials p {
    font-size: 12px;
    margin-bottom: 0.25rem;
    text-align: left;
}

/* Dashboard Screen */
.dashboard-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.dashboard-header {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-header h1 {
    color: #333;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info span {
    font-weight: 500;
    color: #555;
}

.dashboard-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.dashboard-actions {
    margin-bottom: 2rem;
}

.primary-btn {
    background: #48bb78;
    padding: 1rem 2rem;
    font-size: 16px;
}

.primary-btn:hover {
    background: #38a169;
}

.mindmap-list h2 {
    margin-bottom: 1rem;
    color: #333;
}

.mindmaps-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.mindmap-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.mindmap-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.mindmap-card h3 {
    margin-bottom: 0.5rem;
    color: #333;
}

.mindmap-card .meta {
    font-size: 12px;
    color: #666;
}

/* Editor Screen */
.editor-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.editor-header {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.editor-nav h1 {
    color: #333;
}

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

.view-btn {
    background: #e2e8f0;
    color: #4a5568;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    font-size: 12px;
}

.view-btn.active {
    background: #667eea;
    color: white;
}

.editor-actions {
    display: flex;
    gap: 1rem;
}

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

/* View Panels */
.view-panel {
    display: none;
    height: 100%;
}

.view-panel.active {
    display: block;
}

/* Mindmap Canvas */
.mindmap-canvas-container {
    width: 100%;
    height: 100%;
    background: #fafafa;
    position: relative;
    overflow: hidden;
}

#mindmap-canvas {
    cursor: grab;
    width: 100%;
    height: 100%;
}

#mindmap-canvas:active {
    cursor: grabbing;
}

/* Node Detail Panel */
.detail-panel {
    position: absolute;
    right: -400px;
    top: 0;
    width: 400px;
    height: 100%;
    background: white;
    box-shadow: -2px 0 8px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.detail-panel.open {
    right: 0;
}

.panel-header {
    padding: 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

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

.detail-section h4 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 14px;
}

/* Checklist and Task Items */
.checklist-item, .task-item {
    background: #f8f9fa;
    border-radius: 5px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-left: 3px solid #e2e8f0;
    transition: all 0.2s ease;
}

.task-item.completed {
    background: #f0f8f0;
    border-left-color: #48bb78;
}

.task-header {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.task-text {
    flex: 1;
    font-weight: 500;
}

.task-text.strikethrough {
    text-decoration: line-through;
    color: #666;
}

.task-meta {
    display: flex;
    gap: 1rem;
    font-size: 12px;
    color: #666;
    flex-wrap: wrap;
}

.task-meta .assignee,
.task-meta .deadline {
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

.task-timestamps {
    font-size: 11px;
    color: #888;
    border-top: 1px solid #e2e8f0;
    padding-top: 0.5rem;
}

.task-timestamps > div {
    margin: 2px 0;
}

.created-info {
    color: #666;
}

.completed-info {
    color: #48bb78;
    font-weight: 500;
}

.modified-info {
    color: #667eea;
}

.checklist-item input[type="checkbox"] {
    margin-top: 0.25rem;
}

.task-item .task-content {
    flex: 1;
}

.task-meta {
    font-size: 12px;
    color: #666;
    margin-top: 0.25rem;
}

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

.item-actions button {
    background: none;
    border: 1px solid #ddd;
    color: #666;
    padding: 0.25rem 0.5rem;
    font-size: 12px;
    border-radius: 3px;
}

.item-actions button:hover {
    background: #e2e8f0;
}

.item-actions .delete-btn {
    color: #e53e3e;
    border-color: #e53e3e;
}

.item-actions .delete-btn:hover {
    background: #fed7d7;
}

/* List View */
.list-controls {
    padding: 1rem 2rem;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.list-controls input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.list-controls select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: white;
}

.list-content {
    flex: 1;
    overflow-y: auto;
}

#tasks-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

#tasks-table th,
#tasks-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

#tasks-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

#tasks-table tbody tr:hover {
    background: #f8f9fa;
}

/* List view enhancements */
.item-type-badge {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    color: white;
    text-align: center;
    line-height: 20px;
    font-size: 10px;
    font-weight: bold;
    margin-right: 8px;
}

.item-type-badge.task {
    background: #667eea;
}

.item-type-badge.checklist {
    background: #48bb78;
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.status-badge.completed {
    background: #c6f6d5;
    color: #22543d;
}

.status-badge.pending {
    background: #fed7d7;
    color: #742a2a;
}

.completed-item {
    opacity: 0.7;
}

.completed-item td {
    text-decoration: line-through;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-content {
    padding: 1.5rem;
}

.form-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.modal-cancel {
    background: #e2e8f0;
    color: #4a5568;
}

.modal-cancel:hover {
    background: #cbd5e0;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
    .dashboard-header,
    .editor-header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .editor-nav {
        flex-direction: column;
        gap: 1rem;
    }
    
    .detail-panel {
        width: 100%;
        right: -100%;
    }
    
    .mindmaps-container {
        grid-template-columns: 1fr;
    }
    
    .list-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    #tasks-table {
        font-size: 12px;
    }
    
    #tasks-table th,
    #tasks-table td {
        padding: 0.5rem;
    }
}