/* Modern CSS resets & variables */
:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #131b2e;
    --bg-tertiary: #1e293b;
    --glass-bg: rgba(19, 27, 46, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-teal: #14b8a6;
    --accent-emerald: #10b981;
    --accent-orange: #f59e0b;
    
    --node-web: linear-gradient(135deg, #2563eb, #3b82f6);
    --node-mobile: linear-gradient(135deg, #7c3aed, #8b5cf6);
    --node-office: linear-gradient(135deg, #0d9488, #14b8a6);
    --node-external: linear-gradient(135deg, #d97706, #f59e0b);
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    --border-radius: 12px;
    --transition-speed: 0.25s;
    --font-primary: 'Outfit', sans-serif;
    --font-secondary: 'Plus Jakarta Sans', sans-serif;
    
    --connector-color: rgba(148, 163, 184, 0.25);
    --connector-width: 2px;
}

/* Light Theme overrides */
body.light-theme {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(0, 0, 0, 0.08);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --node-web: linear-gradient(135deg, #3b82f6, #60a5fa);
    --node-mobile: linear-gradient(135deg, #8b5cf6, #a78bfa);
    --node-office: linear-gradient(135deg, #14b8a6, #2dd4bf);
    --node-external: linear-gradient(135deg, #f59e0b, #fbbf24);
    
    --shadow-glass: 0 8px 32px 0 rgba(15, 23, 42, 0.08);
    --connector-color: rgba(71, 85, 105, 0.15);
}

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

body {
    font-family: var(--font-primary);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

/* App Container Layout */
.app-container {
    display: flex;
    height: 100%;
    width: 100%;
    position: relative;
}

/* Sidebar Styling */
.sidebar {
    width: 380px;
    height: 100%;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color var(--transition-speed);
    position: absolute;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-glass);
}

.sidebar.open {
    transform: translateX(0);
    position: relative;
}

.close-sidebar-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
}

.close-sidebar-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 40px 24px 24px;
    overflow-y: auto;
}

.sidebar-header {
    margin-bottom: 28px;
}

.category-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* Category Specific Tags */
.category-web { background-color: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.category-mobile { background-color: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.category-office { background-color: rgba(20, 184, 166, 0.15); color: #2dd4bf; }
.category-external { background-color: rgba(245, 158, 11, 0.15); color: #fbbf24; }

#sidebar-title {
    font-family: var(--font-secondary);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.25;
}

.sidebar-body {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.info-section h3 {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-section h3 i {
    width: 16px;
    height: 16px;
}

#sidebar-desc, #sidebar-note {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.links-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.links-list li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background-color: var(--bg-tertiary);
    border-radius: var(--border-radius);
    color: var(--accent-blue);
    text-decoration: none;
    font-size: 0.9rem;
    word-break: break-all;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.links-list li a:hover {
    border-color: var(--accent-blue);
    background-color: rgba(59, 130, 246, 0.05);
    transform: translateY(-2px);
}

.links-list li a i {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* Top Navigation Bar (Always light to ensure transparent logos are visible) */
.top-bar {
    height: 72px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #ffffff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    z-index: 90;
    transition: background-color var(--transition-speed);
}

.company-logos {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0;
    height: 100%;
    overflow-x: auto;
    max-width: 65%;
}

.company-logos::-webkit-scrollbar {
    display: none; /* Hide bar if overflow occurs on small screens */
}

.company-logo {
    max-height: 40px;
    width: auto;
    object-fit: contain;
    filter: none;
    opacity: 1;
    mix-blend-mode: multiply; /* Always blend with light header background */
    transition: all var(--transition-speed) ease;
}

.company-logo:hover {
    filter: grayscale(1) opacity(0.5) !important;
    transform: scale(0.96); /* Subtle scale down to emphasize focus/pressing effect on hover */
}

/* Force light styling for all controls inside top-bar */
.top-bar .search-box input {
    background-color: #f1f5f9;
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #0f172a;
}

.top-bar .search-box input::placeholder {
    color: #94a3b8;
}

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

.top-bar .search-icon, 
.top-bar .clear-search-btn {
    color: #94a3b8;
}

.top-bar .clear-search-btn:hover {
    color: #0f172a;
}

.top-bar .btn-secondary, 
.top-bar .btn-icon {
    background-color: #f1f5f9;
    border-color: rgba(0, 0, 0, 0.08);
    color: #475569;
}

.top-bar .btn-secondary:hover, 
.top-bar .btn-icon:hover {
    background-color: #ffffff;
    color: #0f172a;
    border-color: #94a3b8;
}

.controls-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Search Box */
.search-box {
    position: relative;
    width: 260px;
}

.search-box input {
    width: 100%;
    height: 40px;
    padding: 0 16px 0 40px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

.search-box input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    width: 320px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    width: 16px;
    height: 16px;
}

.clear-search-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
}

.clear-search-btn:hover {
    color: var(--text-primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border-radius: var(--border-radius);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

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

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

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    background-color: var(--bg-tertiary);
    border-color: var(--glass-border);
    color: var(--text-secondary);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

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

/* Theme Icons Toggle */
body.light-theme .sun-icon { display: none; }
body.dark-theme .moon-icon { display: none; }

/* Mind Map Workspace */
.workspace {
    flex: 1;
    position: relative;
    overflow: hidden;
    cursor: grab;
}

.workspace:active {
    cursor: grabbing;
}

/* SVG Connectors Layer */
.svg-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.connector-line {
    fill: none;
    stroke: var(--connector-color);
    stroke-width: var(--connector-width);
    stroke-linecap: round;
    transition: stroke var(--transition-speed), stroke-width var(--transition-speed);
}

.connector-line.active {
    stroke: var(--accent-blue);
    stroke-width: 3px;
}

/* Zoomable Map Container */
.map-container {
    position: absolute;
    left: 50%;
    top: 50%;
    transform-origin: center center;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    pointer-events: none; /* Let clicks pass to child nodes */
}

/* Nodes Styling */
.map-root-node, .category-node, .leaf-node {
    pointer-events: auto; /* Active for interactions */
    border-radius: var(--border-radius);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
    cursor: pointer;
}

/* Root Node */
.map-root-node {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 2px solid var(--accent-blue);
    padding: 16px 28px;
    z-index: 10;
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.25);
    position: absolute;
}

body.light-theme .map-root-node {
    background: linear-gradient(135deg, #ffffff, #f1f5f9);
    color: #0f172a;
}

.map-root-node .node-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.root-icon {
    width: 24px;
    height: 24px;
    color: var(--accent-blue);
}

/* Category Node */
.category-node {
    padding: 12px 20px;
    color: white;
    font-weight: 600;
    font-size: 1.05rem;
    z-index: 8;
    position: absolute;
    width: max-content;
}

.category-node[data-category="web"] { background: var(--node-web); }
.category-node[data-category="mobile"] { background: var(--node-mobile); }
.category-node[data-category="office"] { background: var(--node-office); }
.category-node[data-category="external"] { background: var(--node-external); }

.category-node:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Leaf/Tool Node */
.leaf-node {
    background-color: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    padding: 10px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    z-index: 6;
    position: absolute;
    width: max-content;
    max-width: 220px;
    text-align: center;
    line-height: 1.4;
}

.leaf-node:hover {
    border-color: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.leaf-node.active-node {
    border-color: var(--accent-blue);
    background-color: rgba(59, 130, 246, 0.05);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.2);
}

/* Highlighted Node Search Result */
.node-highlighted {
    animation: pulse-highlight 1.5s infinite alternate;
    border-color: var(--accent-orange) !important;
}

@keyframes pulse-highlight {
    0% { box-shadow: 0 0 4px rgba(245, 158, 11, 0.4); }
    100% { box-shadow: 0 0 16px rgba(245, 158, 11, 0.8); }
}

/* Zoom Panel Overlay */
.zoom-controls {
    position: absolute;
    bottom: 24px;
    right: 24px;
    background-color: var(--glass-bg);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-md);
    z-index: 50;
    user-select: none;
}

.zoom-controls button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
}

.zoom-controls button:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

#zoom-level {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: center;
}

/* Structured List/Tree View */
.list-view-container {
    flex: 1;
    overflow-y: auto;
    padding: 40px 24px;
    background-color: var(--bg-primary);
    z-index: 80;
    display: flex;
    justify-content: center;
}

.list-view-content {
    max-width: 900px;
    width: 100%;
}

.list-category-section {
    background-color: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.list-category-header {
    font-family: var(--font-secondary);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.list-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.list-tool-card {
    background-color: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    padding: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.list-tool-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-md);
}

.list-tool-card h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.list-tool-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

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

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

/* Request Access Button */
.request-access-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-radius: var(--border-radius);
    color: white !important;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.request-access-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
}

.request-access-btn i {
    width: 18px;
    height: 18px;
}
