/* NH Legislative Tracker - Mobile-first responsive CSS */

/* Reset and base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    color: #1f2937;
    background: #f9fafb;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation */
header {
    background: #1e293b;
    color: white;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    max-width: 72rem;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.nav-brand {
    color: white;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.125rem;
    margin-right: auto;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.nav-links a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: background 0.15s, color 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
    background: #334155;
    color: white;
}

/* Main content */
main {
    max-width: 72rem;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    width: 100%;
    flex: 1;
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #111827;
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #1f2937;
}

h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: #374151;
}

.subtitle {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
}

.status-active { background: #2563EB; }
.status-passed { background: #059669; }
.status-dead { background: #9CA3AF; }
.badge-hearing { background: #D97706; }
.badge-chamber {
    background: #6366f1;
    font-size: 0.6875rem;
}
.badge-needs-review {
    background: #9CA3AF;
}

/* Cards and sections */
.card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.card-header a {
    font-weight: 600;
    color: #2563EB;
    text-decoration: none;
}

.card-header a:hover {
    text-decoration: underline;
}

/* Summary counts */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.summary-box {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: center;
}

.summary-box .count {
    font-size: 1.75rem;
    font-weight: 700;
    color: #111827;
    display: block;
}

.summary-box .label {
    font-size: 0.8125rem;
    color: #6b7280;
}

.summary-box[data-filter] {
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.summary-box[data-filter]:hover {
    border-color: #93c5fd;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.summary-box.active {
    border-color: #2563EB;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.summary-box-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

/* Collapsible sections */
details {
    margin-bottom: 0.75rem;
}

details summary {
    cursor: pointer;
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
}

details summary::-webkit-details-marker {
    display: none;
}

details summary::before {
    content: "\25B6";
    font-size: 0.75rem;
    transition: transform 0.2s;
}

details[open] summary::before {
    transform: rotate(90deg);
}

details[open] summary {
    border-radius: 0.5rem 0.5rem 0 0;
    border-bottom: none;
}

details .details-content {
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 0.5rem 0.5rem;
    padding: 0.75rem 1rem;
    background: white;
}

/* Bill list items */
.bill-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f3f4f6;
    flex-wrap: wrap;
}

.bill-row:last-child {
    border-bottom: none;
}

.bill-number {
    font-weight: 600;
    color: #2563EB;
    text-decoration: none;
    white-space: nowrap;
}

.bill-number:hover {
    text-decoration: underline;
}

.bill-title {
    flex: 1;
    min-width: 0;
    color: #4b5563;
    font-size: 0.875rem;
}

/* Progress indicator */
.progress-bar {
    display: flex;
    gap: 0.25rem;
    margin: 1rem 0;
}

.progress-step {
    flex: 1;
    text-align: center;
    padding: 0.375rem 0.25rem;
    font-size: 0.6875rem;
    border-radius: 0.25rem;
    background: #e5e7eb;
    color: #6b7280;
}

.progress-step.active {
    background: #2563EB;
    color: white;
}

.progress-step.completed {
    background: #059669;
    color: white;
}

.progress-step.dead {
    background: #ef4444;
    color: white;
}

/* Timeline */
.timeline {
    list-style: none;
    padding-left: 1.5rem;
    border-left: 2px solid #e5e7eb;
}

.timeline li {
    position: relative;
    padding: 0.5rem 0 0.5rem 1rem;
    font-size: 0.875rem;
}

.timeline li::before {
    content: "";
    position: absolute;
    left: -1.625rem;
    top: 0.875rem;
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 50%;
    background: #9ca3af;
    border: 2px solid white;
}

.timeline .date {
    font-weight: 600;
    color: #374151;
}

.timeline .action {
    color: #6b7280;
}

/* Vote table */
.vote-summary {
    display: flex;
    gap: 1rem;
    margin: 0.5rem 0;
    flex-wrap: wrap;
}

.vote-count {
    font-weight: 600;
}

.vote-yea { color: #059669; }
.vote-nay { color: #dc2626; }
.vote-nv { color: #6b7280; }
.vote-absent { color: #9ca3af; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

th, td {
    text-align: left;
    padding: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

th {
    font-weight: 600;
    color: #374151;
    background: #f9fafb;
}

/* Bill tables */
.table-wrapper {
    overflow-x: auto;
    margin-bottom: 1rem;
}

.bill-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.bill-table th {
    text-align: left;
    padding: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
    font-weight: 600;
    color: #374151;
    background: #f9fafb;
    white-space: nowrap;
}

.bill-table td {
    padding: 0.5rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: top;
}

.bill-table .bill-title {
    min-width: 200px;
    color: #4b5563;
}

.bill-table .event-date {
    white-space: nowrap;
    font-weight: 400;
}

.bill-table .flags-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* Event cards */
.event-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.event-card.hearing {
    border-left: 4px solid #D97706;
}

.event-date {
    font-weight: 600;
    color: #374151;
}

.event-type {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
}

/* Filter buttons */
.filter-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.375rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background: white;
    color: #374151;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.filter-btn:hover {
    background: #f3f4f6;
}

.filter-btn.active {
    background: #2563EB;
    color: white;
    border-color: #2563EB;
}

/* Sponsor cards */
.sponsor-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.sponsor-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: #111827;
}

.sponsor-info {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0.25rem 0;
}

.sponsor-bills {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f3f4f6;
}

/* Alert boxes */
.alert-box {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.alert-box.info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.alert-box.warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.alert-box.action {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

/* Links */
a {
    color: #2563EB;
}

a:hover {
    color: #1d4ed8;
}

/* Search */
.search-input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.9375rem;
    margin-bottom: 0.5rem;
    background: white;
}

.search-input:focus {
    outline: none;
    border-color: #2563EB;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.search-count {
    display: block;
    font-size: 0.8125rem;
    color: #6b7280;
    margin-bottom: 0.75rem;
    min-height: 1.25rem;
}

.event-description {
    font-size: 0.8125rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: #9ca3af;
}

/* Footer */
footer {
    background: #1e293b;
    color: #94a3b8;
    text-align: center;
    padding: 1.5rem 1rem;
    font-size: 0.8125rem;
    margin-top: auto;
}

footer a {
    color: #cbd5e1;
}

/* Responsive breakpoints */
@media (min-width: 480px) {
    .summary-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 768px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.375rem; }
    main { padding: 2rem 1.5rem; }

    .progress-step {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
}
