/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.app-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2563eb;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-title i {
    font-size: 1.8rem;
    color: #3b82f6;
}

.search-container {
    position: relative;
    flex: 1;
    max-width: 500px;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    border: 2px solid #e5e7eb;
    border-radius: 50px;
    font-size: 1rem;
    background: white;
    transition: all 0.3s ease;
    outline: none;
}

.search-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    font-size: 1.1rem;
}

.clear-search {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.clear-search:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Main Content Layout */
.main-content {
    flex: 1;
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    gap: 0;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    padding: 2rem 0;
    overflow-y: auto;
    max-height: calc(100vh - 80px);
}

.sidebar-header {
    padding: 0 2rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 1rem;
}

.sidebar-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #374151;
}

.strand-list {
    list-style: none;
}

.strand-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.strand-item:hover {
    background: rgba(59, 130, 246, 0.05);
    border-left-color: #3b82f6;
}

.strand-item.active {
    background: rgba(59, 130, 246, 0.1);
    border-left-color: #3b82f6;
    color: #2563eb;
    font-weight: 500;
}

.strand-item i {
    font-size: 1.2rem;
    width: 20px;
    text-align: center;
}

/* Mind Map Container */
.mind-map-container {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    max-height: calc(100vh - 80px);
}

.mind-map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.mind-map-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

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

.control-btn {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-btn:hover {
    background: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Mind Map Content */
.mind-map-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Topic Cards */
.topic-card {
    background: white;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    border-left: 4px solid #3b82f6;
}

.topic-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.topic-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topic-title {
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topic-icon {
    font-size: 1.3rem;
}

.expand-icon {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.topic-card.expanded .expand-icon {
    transform: rotate(180deg);
}

.topic-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.topic-card.expanded .topic-content {
    max-height: 2000px;
}

.topic-body {
    padding: 1.5rem;
}

/* Subtopic Styles */
.subtopic {
    margin-bottom: 1.5rem;
    border-left: 3px solid #e5e7eb;
    padding-left: 1rem;
}

.subtopic-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.subtopic-title:hover {
    background: #f9fafb;
    color: #2563eb;
}

.subtopic-content {
    margin-left: 1rem;
}

/* Content Lists */
.content-list {
    list-style: none;
    margin: 0.5rem 0;
}

.content-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    padding: 0.5rem;
    margin-bottom: 0.25rem;
}

.content-item:hover {
    background: #f8fafc;
    color: #2563eb;
    transform: translateX(4px);
}

.content-item:last-child {
    border-bottom: none;
}

/* Tables */
.content-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.content-table th {
    background: #3b82f6;
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.content-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.content-table tr:hover {
    background: #f8fafc;
}

/* Modal Styles */
.search-modal,
.topic-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.search-modal-content,
.topic-modal-content {
    background: white;
    border-radius: 16px;
    max-width: 800px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

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

.search-modal-header,
.topic-modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.search-modal-header h3,
.topic-modal-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #374151;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-modal:hover {
    background: #e5e7eb;
    color: #374151;
}

.search-results,
.topic-modal-body {
    padding: 2rem;
    max-height: 60vh;
    overflow-y: auto;
}

.search-result-item {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.search-result-item:hover {
    background: #f8fafc;
    transform: translateX(4px);
}

.search-result-title {
    font-weight: 600;
    color: #2563eb;
    margin-bottom: 0.25rem;
}

.search-result-path {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.search-result-snippet {
    font-size: 0.9rem;
    color: #374151;
    line-height: 1.5;
}

.highlight {
    background: #fef3c7;
    padding: 0.1rem 0.2rem;
    border-radius: 3px;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .app-title {
        font-size: 1.3rem;
    }
    
    .search-container {
        max-width: 100%;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .strand-list {
        display: flex;
        overflow-x: auto;
        padding: 0 1rem;
        gap: 0.5rem;
    }
    
    .strand-item {
        white-space: nowrap;
        min-width: fit-content;
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 1rem;
    }
    
    .strand-item:hover,
    .strand-item.active {
        border-left: none;
        border-bottom-color: #3b82f6;
    }
    
    .mind-map-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .mind-map-header h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 0 1rem;
    }
    
    .app-title {
        font-size: 1.2rem;
    }
    
    .mind-map-container {
        padding: 1rem;
    }
    
    .mind-map-content {
        padding: 1rem;
    }
    
    .topic-header {
        padding: 1rem;
    }
    
    .topic-title {
        font-size: 1.1rem;
    }
    
    .topic-body {
        padding: 1rem;
    }
    
    .search-modal,
    .topic-modal {
        padding: 1rem;
    }
    
    .search-modal-content,
    .topic-modal-content {
        max-height: 90vh;
    }
    
    .search-modal-header,
    .topic-modal-header {
        padding: 1rem;
    }
    
    .search-results,
    .topic-modal-body {
        padding: 1rem;
        max-height: 70vh;
    }
}

@media (max-width: 480px) {
    .view-controls {
        flex-direction: column;
        width: 100%;
    }
    
    .control-btn {
        justify-content: center;
        width: 100%;
    }
    
    .content-table {
        font-size: 0.9rem;
    }
    
    .content-table th,
    .content-table td {
        padding: 0.5rem;
    }
}

/* Loading Animation */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

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

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

/* Utility Classes */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

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

.slide-in {
    animation: slideIn 0.3s ease;
}

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

/* Print Styles */
@media print {
    .header,
    .sidebar,
    .view-controls,
    .search-modal,
    .topic-modal {
        display: none !important;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .mind-map-container {
        padding: 0;
    }
    
    .topic-content {
        max-height: none !important;
    }
    
    .topic-card {
        break-inside: avoid;
        margin-bottom: 1rem;
    }
}

