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

:root {
    --primary-color: #10b981;
    --primary-dark: #059669;
    --secondary-color: #ef4444;
    --danger-color: #dc2626;
    --warning-color: #f59e0b;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

html {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

body > header {
    flex-shrink: 0;
}

body > main,
body > div:not(.header):first-of-type {
    flex: 1 0 auto;
}

body > footer {
    flex-shrink: 0;
}

/* Header */
.header {
    background: var(--bg-primary);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    flex-shrink: 0;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    flex-direction: column;
    gap: 4px;
    margin-left: auto;
    order: 2;
}

.nav-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s;
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.nav-menu {
    display: flex;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-menu li {
    margin: 0;
}

.nav-menu a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    display: block;
    padding: 0.5rem 0;
    white-space: nowrap;
    position: relative;
}

.nav-menu a:hover {
    color: var(--primary-color);
}

.nav-menu a.active {
    color: var(--text-primary);
}

.nav-menu a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #dc2626;
}

/* Search Bar */
.search-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

@media (max-width: 768px) {
    .search-container {
        padding: 0 1rem;
        margin: 1rem auto;
    }
}

.search-box {
    display: flex;
    gap: 1rem;
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.search-box input,
.search-box select {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
}

.constituency-select-wrapper {
    flex: 1;
    position: relative;
}

.constituency-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background: var(--bg-primary);
    cursor: pointer;
}

.constituency-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Constituency Search Modal */
.constituency-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 1rem;
}

.constituency-search-content {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
}

.constituency-search-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.constituency-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.constituency-search-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 1rem;
}

.constituency-search-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.constituency-search-item:last-child {
    border-bottom: none;
}

.constituency-search-item:hover {
    background: var(--bg-secondary);
}

.constituency-search-close {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 1rem;
}

.constituency-search-close:hover {
    background: var(--primary-dark);
}

.search-box button {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.search-box button:hover {
    background: var(--primary-dark);
}

/* Main Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

/* Cards */
.card {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.card-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.card-body {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-answered {
    background: #d1fae5;
    color: #065f46;
}

.badge-unanswered {
    background: #fee2e2;
    color: #991b1b;
}

.badge-new {
    background: #dbeafe;
    color: #1e40af;
}

.badge-under-review {
    background: #fef3c7;
    color: #92400e;
}

.badge-resolved {
    background: #d1fae5;
    color: #065f46;
}

.badge-pending {
    background: #f3f4f6;
    color: #374151;
}

.badge-in-progress {
    background: #dbeafe;
    color: #1e40af;
}

.badge-completed {
    background: #d1fae5;
    color: #065f46;
}

.badge-active {
    background: #dbeafe;
    color: #1e40af;
}

.badge-closed {
    background: #f3f4f6;
    color: #374151;
}

.badge-high {
    background: #fee2e2;
    color: #991b1b;
}

.badge-medium {
    background: #fef3c7;
    color: #92400e;
}

.badge-low {
    background: #d1fae5;
    color: #065f46;
}

/* Representative Info */
.rep-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.rep-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.rep-name {
    font-weight: 600;
    color: var(--text-primary);
}

.rep-constituency {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Stats */
.stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stat-item svg {
    width: 16px;
    height: 16px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-primary);
    background: var(--bg-primary);
}

.pagination a:hover {
    background: var(--bg-tertiary);
}

.pagination .current {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Welcome Section */
.welcome-section {
    text-align: center;
    margin: 2rem 0;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 1rem;
}

.welcome-section h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.welcome-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.welcome-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    display: inline-block;
    transition: all 0.2s;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
}

.btn-outline {
    background: var(--bg-primary);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 4rem;
}

/* Loading */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Status Indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    font-size: 0.875rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.status-indicator::before {
    content: '✓';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Responsive */
@media (max-width: 768px) {
    .header-container {
        padding: 1rem;
        position: relative;
    }

    .logo {
        order: 1;
    }

    .nav-toggle {
        display: flex;
        order: 2;
    }

    nav {
        order: 3;
        width: 100%;
    }

    nav {
        width: 100%;
        order: 3;
    }

    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-primary);
        flex-direction: column;
        gap: 0;
        max-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        transition: max-height 0.3s ease-out;
        box-shadow: var(--shadow-md);
        padding: 0;
        z-index: 1000;
        -webkit-overflow-scrolling: touch;
    }

    .nav-menu.active {
        max-height: calc(100vh - 70px);
        padding: 0.5rem 0;
    }

    .nav-menu li {
        border-bottom: 1px solid var(--border-color);
    }

    .nav-menu a {
        padding: 1rem 2rem;
        width: 100%;
    }

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

    .search-box {
        flex-direction: column;
    }

    .search-box input,
    .search-box select,
    .constituency-select-wrapper {
        width: 100%;
    }

    .logo {
        font-size: 1.25rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .card {
        padding: 1rem;
    }

    .card-title {
        font-size: 1.1rem;
    }

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

    .pagination {
        gap: 0.25rem;
    }

    .pagination a,
    .pagination span {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .header-container {
        padding: 0.75rem;
    }

    .container {
        padding: 0.75rem;
    }

    .search-container {
        padding: 0 0.75rem;
    }

    .logo {
        font-size: 1.1rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    .card {
        padding: 0.75rem;
    }

    .rep-info {
        flex-wrap: wrap;
    }

    .rep-avatar {
        width: 32px;
        height: 32px;
    }

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

    .welcome-subtitle {
        font-size: 1rem;
    }

    .welcome-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .btn {
        width: 100%;
        padding: 0.875rem 1.5rem;
    }
}

@media (max-width: 768px) {
    .welcome-section h1 {
        font-size: 2rem;
    }

    .welcome-subtitle {
        font-size: 1.1rem;
    }
}

/* Date Range Calendar Styles */
.date-range-calendar-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.date-range-calendar-content {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.date-range-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.date-range-calendar-months {
    display: flex;
    gap: 2rem;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.date-range-calendar-nav {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0 0.5rem;
    transition: color 0.2s;
}

.date-range-calendar-nav:hover {
    color: var(--primary-dark);
}

.date-range-calendar-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.date-range-calendar-month {
    min-width: 0;
}

.date-range-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.date-range-calendar-weekday {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0.5rem;
}

.date-range-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
}

.date-range-calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.2s;
    position: relative;
}

.date-range-calendar-day-empty {
    cursor: default;
    visibility: hidden;
}

.date-range-calendar-day-past {
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.5;
}

.date-range-calendar-day-today {
    font-weight: 600;
    background: var(--bg-secondary);
}

.date-range-calendar-day:hover:not(.date-range-calendar-day-empty):not(.date-range-calendar-day-past) {
    background: var(--bg-secondary);
}

.date-range-calendar-day-start {
    background: var(--primary-color) !important;
    color: white !important;
    font-weight: 600;
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.date-range-calendar-day-end {
    background: var(--primary-color) !important;
    color: white !important;
    font-weight: 600;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

.date-range-calendar-day-in-range {
    background: rgba(16, 185, 129, 0.2) !important;
    color: var(--text-primary) !important;
    border-radius: 0;
}

.date-range-calendar-day-start.date-range-calendar-day-end {
    border-radius: 6px;
}

.date-range-calendar-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.date-range-calendar-btn {
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.date-range-calendar-btn:hover {
    background: var(--bg-secondary);
}

.date-range-calendar-btn-primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.date-range-calendar-btn-primary:hover {
    background: var(--primary-dark);
}

@media (max-width: 768px) {
    .date-range-calendar-body {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .date-range-calendar-months {
        flex-direction: column;
        gap: 0.5rem;
        font-size: 0.95rem;
    }
    
    .date-range-calendar-content {
        padding: 1rem;
        max-width: 95%;
    }
}

