/* Washington State Young Republicans - Slate Comparison Guide */
/* Academic Think Tank Style - Mobile First Design */

/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.6;
    color: #333;
    background-color: #ffffff;
    font-size: 16px;
}

/* Academic Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Arial', 'Helvetica', sans-serif;
    color: #2c3e50;
    margin-bottom: 1rem;
    font-weight: 600;
}

h1 {
    font-size: 1.8rem;
    border-bottom: 3px solid #3498db;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 1.5rem;
    margin-top: 2rem;
    color: #34495e;
}

h3 {
    font-size: 1.3rem;
    margin-top: 1.5rem;
    color: #34495e;
}

h4 {
    font-size: 1.1rem;
    margin-top: 1rem;
    color: #2c3e50;
}

p {
    margin-bottom: 1rem;
    text-align: justify;
}

/* Layout Structure */
.container {
    display: flex;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
}

/* Sticky Sidebar Navigation */
.sidebar {
    width: 280px;
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-right: 1px solid #e9ecef;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-menu {
    list-style: none;
}

.nav-menu li {
    margin-bottom: 0.5rem;
}

.nav-menu a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: #495057;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.nav-menu a:hover {
    background-color: #e9ecef;
    color: #2c3e50;
}

.nav-menu a.active {
    background-color: #3498db;
    color: white;
}

.nav-menu .nav-submenu {
    margin-left: 1rem;
    margin-top: 0.25rem;
}

.nav-menu .nav-submenu a {
    font-size: 0.85rem;
    color: #6c757d;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem;
    max-width: calc(100% - 280px);
}

/* Header Section */
.header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.last-updated {
    background-color: #f8f9fa;
    padding: 0.75rem 1rem;
    border-left: 4px solid #3498db;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: #495057;
}

/* Academic Tables */
.table-container {
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    font-size: 0.9rem;
}

th {
    background-color: #f8f9fa;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    color: #495057;
    font-family: 'Arial', 'Helvetica', sans-serif;
}

td {
    padding: 0.75rem;
    border-bottom: 1px solid #dee2e6;
    vertical-align: top;
}

tr:hover {
    background-color: #f8f9fa;
}

/* Emphasis in tables */
td strong {
    color: #2c3e50;
}

td em {
    color: #6c757d;
    font-style: italic;
}

/* Chart Containers */
.chart-container {
    margin: 2rem 0;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.chart-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #2c3e50;
    text-align: center;
}

.chart-canvas {
    width: 100%;
    height: 300px;
}

/* Delegate Math Visualization */
.delegate-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.delegate-bar {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    margin: 0.25rem;
    border-radius: 4px;
    min-width: 80px;
}

.forged-delegates {
    background-color: #2ecc71;
    flex: 3;
}

.competitive-delegates {
    background-color: #f39c12;
    flex: 1;
}

.threshold-line {
    width: 2px;
    height: 60px;
    background-color: #e74c3c;
    margin: 0 1rem;
    position: relative;
}

.threshold-label {
    position: absolute;
    top: -25px;
    left: -20px;
    font-size: 0.8rem;
    color: #e74c3c;
    font-weight: 600;
    white-space: nowrap;
}

.delegate-summary {
    text-align: center;
    margin-top: 1rem;
    padding: 0.5rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #495057;
}

/* Dynamic Delegate Chart */
.delegate-chart {
    margin: 2rem 0;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.delegate-chart .chart-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #2c3e50;
    text-align: center;
}

.delegate-chart .bar-label {
    font-size: 0.9rem;
    font-weight: 600;
}

/* Simple Delegate Chart (HTML in Markdown) */
.delegate-chart-simple {
    margin: 2rem 0;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    text-align: center;
}

.delegate-chart-simple .chart-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.delegate-bars {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.delegate-bar {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-weight: 600;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.forged-bar {
    background-color: #2ecc71;
    width: 300px; /* 30 delegates = 300px */
}

.competitive-bar {
    background-color: #f39c12;
    width: 100px; /* 10 delegates = 100px */
}

.victory-threshold {
    margin: 1rem 0 0.5rem 0;
    font-weight: 600;
    color: #e74c3c;
    font-size: 0.9rem;
}

.total-summary {
    font-size: 0.9rem;
    color: #495057;
    font-weight: 500;
}

/* Key Statistics Boxes */
.stat-box {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1rem 0;
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c3e50;
    display: block;
}

.stat-label {
    font-size: 0.9rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

/* Endorsement Comparison */
.endorsement-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 1.5rem 0;
}

.slate-column {
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.slate-column h4 {
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
}

.endorsement-count {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin: 1rem 0;
}

.embolden-count {
    color: #e74c3c;
}

.forged-count {
    color: #2ecc71;
}

/* Loading and Error States */
.loading {
    text-align: center;
    padding: 2rem;
    color: #7f8c8d;
    font-style: italic;
}

.error {
    text-align: center;
    padding: 2rem;
    color: #e74c3c;
    background-color: #fdf2f2;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 1rem 0;
}

.error p {
    margin: 0;
    font-weight: 500;
}

/* Enhanced Navigation Styles for Dynamic Content */
.nav-menu a.h2 {
    font-weight: 600;
    color: #2c3e50;
}

.nav-menu a.h3 {
    padding-left: 1rem;
    font-size: 0.9em;
    color: #34495e;
}

/* Table Enhancement for Markdown Tables */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

.table-wrapper {
    overflow-x: auto;
    margin: 1rem 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
    }
    
    .main-content {
        margin-left: 0;
        max-width: 100%;
        padding: 1rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    .table-container {
        font-size: 0.8rem;
    }
    
    th, td {
        padding: 0.5rem;
    }
    
    .endorsement-comparison {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .delegate-visual {
        flex-direction: column;
        align-items: stretch;
    }
    
    .delegate-bar {
        margin: 0.25rem 0;
        min-width: 100%;
    }
    
    .threshold-line {
        width: 100%;
        height: 2px;
        margin: 0.5rem 0;
    }
    
    .threshold-label {
        position: static;
        text-align: center;
        margin-top: 0.25rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .delegate-bars {
        flex-direction: column;
        align-items: stretch;
    }
    
    .forged-bar {
        width: 100%;
    }
    
    .competitive-bar {
        width: 33%; /* Proportional on mobile */
    }
}

/* Print Styles */
@media print {
    .sidebar {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
        max-width: 100%;
    }
    
    .chart-container {
        break-inside: avoid;
    }
    
    table {
        break-inside: avoid;
    }
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus States for Keyboard Navigation */
a:focus,
button:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    body {
        background-color: white;
        color: black;
    }
    
    .sidebar {
        background-color: #f0f0f0;
        border-right: 2px solid black;
    }
    
    th {
        background-color: #e0e0e0;
        border-bottom: 2px solid black;
    }
      td {
        border-bottom: 1px solid black;
    }
}

/* Strategic Vulnerability Analysis */
.vulnerability-analysis {
    margin: 1.5rem 0;
    display: grid;
    gap: 1.5rem;
}

.vulnerability-section {
    background-color: #f8f9fa;
    border-left: 4px solid #6c757d;
    padding: 1rem;
    border-radius: 0 4px 4px 0;
}

.vulnerability-section h4 {
    color: #495057;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.vulnerability-section ul {
    margin-left: 1rem;
}

.vulnerability-section li {
    margin-bottom: 0.5rem;
    color: #495057;
}

.vulnerability-section strong {
    color: #212529;
}

/* Desktop layout for vulnerability analysis */
@media (min-width: 768px) {
    .vulnerability-analysis {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}
