/* 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-color: #f8fafc;
    color: #1e293b;
    line-height: 1.6;
    overflow-x: hidden;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: 280px;
    background: linear-gradient(135deg, #ff90de 0%, #ff48b3 100%);
    color: white;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-menu {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
}

.nav-item {
    margin: 0.25rem 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 0 8px 8px 0;
    margin-right: 1rem;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    transform: translateX(4px);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem;
    min-height: 100vh;
    width: calc(100% - 280px);
}

.page {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e2e8f0;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
}

.page-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* ============================================================
   Members Tree Styles (Migrated for Absolute X,Y)
   ============================================================ */

.tree-container {
    position: relative;
    width: 100%;
    height: 800px;
    /* Dynamic height can be set in JS */
    overflow: auto;
    background: #f8fafc;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
}

.members-tree {
    position: relative;
    width: 100%;
    /* Large enough to allow X coordinates */
    height: 100%;
}

/* SVG Connection Lines */
#tree-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.tree-line {
    fill: none;
    stroke: #94a3b8;
    stroke-width: 2;
    shape-rendering: crispEdges;
}

.tree-node {
    position: absolute;
    /* Uses X, Y from JSON */
    z-index: 2;
}

.node-content {
    background: linear-gradient(135deg, #ffb3e3 0%, #ff3ea8 100%);
    color: rgb(0, 0, 0);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(233, 173, 225, 0.3);
    text-align: center;
    width: 160px;
    /* Fixed width to make line calculation consistent */
}

.node-content:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(234, 102, 190, 0.4);
}

.node-name {
    font-weight: 600;
    font-size: 1rem;
}

.node-role {
    font-size: 0.8rem;
    opacity: 0.9;
}

/* ============================================================
   Tooltip & Other Sections
   ============================================================ */

.member-tooltip {
    position: fixed;
    /* Fixed relative to viewport for better positioning */
    background: white;
    border: 2px solid #ff009d;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.member-tooltip.show {
    opacity: 1;
    visibility: visible;
}

/* Meetings Grid */
.meetings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    padding: 1rem 0;
}

.meeting-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
}

.meeting-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.meeting-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.meeting-card:hover .meeting-image {
    transform: scale(1.05);
}

.meeting-info {
    padding: 1.5rem;
}

.meeting-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.meeting-date {
    color: #64748b;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Meeting Detail Page */
.meeting-detail-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.meeting-header {
    margin-bottom: 2rem;
}

.breadcrumb {
    margin-bottom: 1rem;
}

.breadcrumb-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.3s ease;
}

.breadcrumb-link:hover {
    color: #764ba2;
}

.meeting-title-section h1 {
    font-size: 3rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1rem;
}

.meeting-meta {
    display: flex;
    gap: 2rem;
    color: #64748b;
    font-size: 1rem;
}

.meeting-content {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.meeting-image-container {
    width: 100%;
    max-height: 400px;
    overflow: hidden;
}

.meeting-main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.meeting-blog-content {
    padding: 3rem;
}

.meeting-blog-content section {
    margin-bottom: 3rem;
}

.meeting-blog-content h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.meeting-blog-content p {
    color: #475569;
    line-height: 1.7;
    margin-bottom: 1rem;
}

.agenda-list,
.decisions-list {
    list-style: none;
    padding-left: 0;
}

.agenda-list li,
.decisions-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid #e2e8f0;
    color: #475569;
    position: relative;
    padding-left: 1.5rem;
}

.agenda-list li::before,
.decisions-list li::before {
    content: '•';
    color: #667eea;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.action-item {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid #667eea;
}

.attendees-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.attendee-card {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.attendee-name {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.attendee-role {
    color: #64748b;
    font-size: 0.875rem;
}

.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.photos-grid img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.photos-grid img:hover {
    transform: scale(1.05);
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        transform: none;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
    }

    .meetings-grid {
        grid-template-columns: 1fr;
    }

    .meeting-title-section h1 {
        font-size: 2rem;
    }

    .meeting-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .meeting-blog-content {
        padding: 2rem 1rem;
    }

    .tree-container {
        padding: 0;
    }

    .members-tree {
        min-width: auto;
        flex-direction: column;
        align-items: center;
    }

    .node-children {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .sidebar-header h2 {
        font-size: 1.25rem;
    }

    .nav-link {
        padding: 0.75rem 1rem;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .meeting-title-section h1 {
        font-size: 1.75rem;
    }
}