:root {
    /* Color Palette - Modern & Dark */
    --bg-base: #0f1115;
    --bg-panel: #16181d;
    --bg-panel-hover: #1e2128;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;

    --simon-color: #38bdf8;
    /* Fine Gael leaning */
    --jen-color: #a855f7;
    /* Social Democrats leaning */

    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-light: rgba(255, 255, 255, 0.15);

    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);

    --radius-md: 12px;
    --radius-lg: 16px;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-heading: 'Outfit', var(--font-sans);
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 10;
    height: 100vh;
    overflow: hidden;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h1 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.sidebar-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 4px;
}

.politician-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Custom Scrollbar for Sidebar */
.politician-list::-webkit-scrollbar {
    width: 6px;
}

.politician-list::-webkit-scrollbar-track {
    background: transparent;
}

.politician-list::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.politician-list::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.politician-btn {
    background: transparent;
    border: 1px solid transparent;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.politician-btn:hover {
    background-color: var(--bg-panel-hover);
}

.politician-btn.active {
    background-color: var(--bg-panel-hover);
    border-color: var(--border-color-light);
    box-shadow: var(--shadow-sm);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: #fff;
}

.simon-avatar {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
}

.jen-avatar {
    background: linear-gradient(135deg, #c084fc, #9333ea);
}

.ff-avatar {
    background: linear-gradient(135deg, #4ade80, #16a34a);
}

.sf-avatar {
    background: linear-gradient(135deg, #14b8a6, #0f766e);
}

.lab-avatar {
    background: linear-gradient(135deg, #f43f5e, #be123c);
}

.info .name {
    display: block;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
}

.info .party {
    display: block;
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-top: 2px;
}

/* Built With Section (Sidebar Bottom) */
.built-with {
    margin-top: auto;
    padding: 24px;
    border-top: 1px solid var(--border-color);
}

.built-with h3 {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.built-with ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.built-with li {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.built-with li::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--accent-blue);
}

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

/* Top Bar & Tabs */
.top-bar {
    padding: 0 32px;
    height: 70px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(15, 17, 21, 0.8);
    backdrop-filter: blur(12px);
    z-index: 5;
}

.breadcrumbs {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.tabs {
    display: flex;
    gap: 8px;
    background-color: var(--bg-panel);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.tab-btn.active {
    background-color: var(--border-color);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Tab Content Areas */
.tab-content-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    padding: 32px;
}

.tab-pane {
    position: absolute;
    inset: 32px;
    /* Fill container honoring padding */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
}

.tab-pane.active {
    opacity: 1;
    pointer-events: auto;
}

.pane-header {
    margin-bottom: 24px;
    flex-shrink: 0;
}

.pane-header h2 {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.5rem;
}

.pane-header .subtitle {
    color: var(--text-secondary);
    margin-top: 4px;
    font-size: 0.95rem;
}

/* Scrollable Content inside Tabs */
.content-scroll {
    flex: 1;
    overflow-y: auto;
    padding-right: 12px;
    padding-bottom: 32px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-color-light);
    border-radius: 10px;
}

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

/* Tweets Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.card {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    display: flex;
    flex-direction: column;
}

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

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.card-date {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tweet-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
    flex: 1;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.tweet-metrics {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.metric {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* YouTube View Layout */
.youtube-layout {
    display: flex;
    gap: 24px;
    flex: 1;
    overflow: hidden;
}

.video-list-pane {
    width: 40%;
    min-width: 300px;
    overflow-y: auto;
    padding-right: 16px;
}

.videos-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.video-item {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.video-item:hover {
    background-color: var(--bg-panel-hover);
    border-color: var(--border-color-light);
}

.video-item.active {
    background-color: rgba(59, 130, 246, 0.1);
    border-color: var(--accent-blue);
}

.video-item h4 {
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.video-item .date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.transcript-pane {
    flex: 1;
    background-color: rgba(22, 24, 29, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.transcript-meta {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(22, 24, 29, 0.8);
}

.transcript-meta.placeholder {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: none;
}

.transcript-meta h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.transcript-meta a {
    color: var(--accent-blue);
    text-decoration: none;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.transcript-meta a:hover {
    text-decoration: underline;
}

.transcript-text {
    padding: 24px;
    overflow-y: auto;
    font-size: 1.05rem;
    line-height: 1.8;
    color: #e2e8f0;
    flex: 1;
    white-space: pre-wrap;
}

/* Placeholders */
.placeholder-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1px dashed var(--border-color-light);
    border-radius: var(--radius-lg);
    background-color: rgba(22, 24, 29, 0.3);
    color: var(--text-secondary);
}

.placeholder-box svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.placeholder-box h3 {
    color: var(--text-primary);
    margin-bottom: 8px;
}

.loading-state {
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    grid-column: 1 / -1;
}

/* Analysis Dashboard */
.analysis-grid {
    display: flex;
    flex-direction: column;
    gap: 32px;
    height: 100%;
    overflow-y: auto;
    padding-right: 16px;
    padding-bottom: 24px;
}

.metrics-section {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.metrics-section h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color-light);
}

/* Article Layout for Methodology Tab */
.article-content {
    max-width: 800px;
    margin: 0 auto;
}

.article-content .metrics-section {
    padding: 32px;
}

.article-content h3 {
    margin-bottom: 16px;
    border-bottom: none;
    padding-bottom: 0;
    color: var(--text-primary);
}

.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.metric-card {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.3);
}

.metric-card.highlight-card {
    background: linear-gradient(145deg, rgba(59, 130, 246, 0.1), rgba(37, 99, 235, 0.05));
    border-color: rgba(59, 130, 246, 0.3);
    height: 100%;
    justify-content: center;
}

.metric-card.highlight-card .m-value {
    color: var(--accent-blue);
    font-size: 3rem;
}

.m-value {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 8px;
}

.m-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.m-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.mb-3 {
    margin-bottom: 16px;
}

.structural-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.structural-left {
    width: 100%;
}

.structural-right {
    width: 100%;
    margin-top: 24px;
}

/* POS Bar Chart */
.pos-chart {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pos-bar-container {
    width: 100%;
}

.pos-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-family: monospace;
}

.pos-bar {
    width: 100%;
    height: 8px;
    background-color: var(--bg-base);
    border-radius: 4px;
    overflow: hidden;
}

.pos-fill {
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #3b82f6);
    border-radius: 4px;
}

/* Insights Tab Styles */
.insights-controls {
    display: flex;
    gap: 24px;
    margin-bottom: 32px;
    background-color: var(--bg-panel);
    padding: 20px 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    max-width: 300px;
}

.control-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.insight-select {
    background-color: var(--bg-base);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 10px 12px;
    border-radius: 6px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.insight-select:focus {
    border-color: var(--accent-blue);
}

.insight-select optgroup {
    background-color: var(--bg-panel);
    color: var(--text-secondary);
    font-weight: 600;
}

.insight-select option {
    background-color: var(--bg-panel);
    color: var(--text-primary);
    padding: 8px;
}

.chart-container {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    flex: 1;
    min-height: 400px;
    position: relative;
}