/**
 * Voting Records Importer - Single Page Dashboard (Dark Theme)
 * Inspired by modern parliamentary voting analysis dashboards
 */

/* CSS Reset & Base */
.vri-dashboard-page {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #0a1628;
    color: #e4e6eb;
    line-height: 1.6;
}

.vri-dashboard-page * {
    box-sizing: border-box;
}

/* Dashboard Container */
.vri-dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    overflow-x: hidden;
}

/* Header - Sticky */
.vri-dashboard-header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 20px 0;
    margin: 0 -20px 30px -20px;
    padding-left: 20px;
    padding-right: 20px;
    background: #0a1628;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.vri-logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.vri-logo h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.vri-logo p {
    margin: 0;
    font-size: 13px;
    color: #8b92a6;
    font-weight: 400;
}

/* Filter Controls */
.vri-filter-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.03);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.vri-filter-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #8b92a6;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vri-filter-select {
    width: 100%;
    padding: 12px 16px;
    background: #1a2942;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #e4e6eb;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.vri-filter-select:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: #1f3152;
}

.vri-filter-select:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.vri-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin-top: 20px;
}

.vri-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.vri-checkbox-label span {
    font-size: 14px;
    color: #e4e6eb;
}

/* Dashboard Grid */
.vri-dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

/* Cards */
.vri-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.vri-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.vri-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.vri-card-header svg {
    color: #4a90e2;
    flex-shrink: 0;
}

.vri-card-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: -0.3px;
}

.vri-card-body {
    padding: 24px;
}

/* Member Info */
.vri-member-info {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.vri-member-info h3 {
    margin: 0 0 12px 0;
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.vri-member-meta {
    display: flex;
    gap: 8px;
    font-size: 13px;
    color: #8b92a6;
}

/* Member Badges */
.vri-member-badges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.vri-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.vri-badge svg {
    flex-shrink: 0;
}

.vri-badge-party {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.15) 0%, rgba(74, 144, 226, 0.25) 100%);
    color: #4a90e2;
    border: 1px solid rgba(74, 144, 226, 0.3);
}

.vri-badge-party:hover {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.25) 0%, rgba(74, 144, 226, 0.35) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.2);
}

.vri-badge-district {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(139, 92, 246, 0.25) 100%);
    color: #8b5cf6;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.vri-badge-district:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25) 0%, rgba(139, 92, 246, 0.35) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

/* Votes Table */
.vri-votes-table {
    width: 100%;
    border-collapse: collapse;
}

.vri-votes-table thead th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: #8b92a6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.vri-votes-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.2s ease;
}

.vri-votes-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.vri-votes-table tbody td {
    padding: 14px 8px;
    font-size: 13px;
    color: #e4e6eb;
}

.vri-votes-table tbody td.session-name {
    font-weight: 500;
    color: #ffffff;
}

/* Vote Badges */
.vri-vote-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.vri-vote-badge.vote-yes {
    background: #10b981;
    color: #ffffff;
}

.vri-vote-badge.vote-no {
    background: #ef4444;
    color: #ffffff;
}

.vri-vote-badge.vote-sim {
    background: #10b981;
    color: #ffffff;
}

.vri-vote-badge.vote-nao {
    background: #ef4444;
    color: #ffffff;
}

.vri-vote-badge.vote-não {
    background: #ef4444;
    color: #ffffff;
}

.vri-vote-badge.vote-abstain {
    background: #f59e0b;
    color: #ffffff;
}

.vri-vote-badge.vote-abstencao {
    background: #f59e0b;
    color: #ffffff;
}

.vri-vote-badge.vote-abstenção {
    background: #f59e0b;
    color: #ffffff;
}

.vri-vote-badge.vote-absent {
    background: #6b7280;
    color: #ffffff;
}

.vri-vote-badge.vote-ausente {
    background: #6b7280;
    color: #ffffff;
}

/* Sessions List */
.vri-sessions-list {
    max-height: 400px;
    overflow-y: auto;
}

.vri-sessions-list::-webkit-scrollbar {
    width: 8px;
}

.vri-sessions-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
}

.vri-sessions-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.vri-sessions-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

.vri-session-item {
    padding: 14px 16px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.vri-session-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateX(4px);
}

.vri-session-title {
    font-size: 14px;
    font-weight: 500;
    color: #ffffff;
    margin-bottom: 6px;
}

.vri-session-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #8b92a6;
}

.vri-session-meta .badge {
    padding: 3px 8px;
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Session Details */
.vri-session-details {
    text-align: center;
}

.vri-party-details {
    text-align: left;
}

.vri-session-title {
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 8px;
}

.vri-session-date {
    font-size: 13px;
    color: #8b92a6;
    margin-bottom: 24px;
}

.vri-party-name {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 20px;
    text-align: left;
}

/* Vote Summary */
.vri-vote-summary {
    display: flex;
    justify-content: flex-start;
    gap: 60px;
    margin: 20px 0;
}

.vri-session-details .vri-vote-summary {
    justify-content: center;
}

.vri-vote-count {
    text-align: center;
}

.vri-vote-count .label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.vri-vote-count .label.yes {
    color: #10b981;
}

.vri-vote-count .label.no {
    color: #ef4444;
}

.vri-vote-count .value {
    display: block;
    font-size: 36px;
    font-weight: 700;
    color: #ffffff;
}

/* Progress Bar */
.vri-progress-bar-wrapper {
    margin: 30px 0;
}

.vri-progress-bar {
    display: flex;
    height: 40px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
}

.progress-yes,
.progress-no {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    transition: all 0.3s ease;
}

.progress-yes {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.progress-no {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.vri-total-votes {
    text-align: left;
    font-size: 13px;
    color: #8b92a6;
    margin-top: 16px;
}

.vri-session-details .vri-total-votes {
    text-align: center;
}

/* Party Members Votes */
.vri-party-members-votes {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.vri-party-members-votes h4 {
    font-size: 11px;
    font-weight: 600;
    color: #8b92a6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* Empty State */
.vri-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .vri-dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .vri-dashboard-container {
        padding: 0 16px;
    }

    .vri-dashboard-header {
        padding: 16px 0;
        margin: 0 -16px 20px -16px;
        padding-left: 16px;
        padding-right: 16px;
    }

    .vri-logo {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    .vri-logo svg {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }

    .vri-logo h1 {
        font-size: 18px;
        line-height: 1.2;
    }

    .vri-logo p {
        font-size: 12px;
        line-height: 1.3;
    }

    .vri-filter-controls {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 0;
        margin-bottom: 16px;
        background: transparent;
        border: none;
        border-radius: 0;
    }

    .vri-filter-group {
        width: 100%;
        margin-bottom: 12px;
    }

    .vri-filter-group label {
        font-size: 11px;
        margin-bottom: 6px;
    }

    .vri-filter-select {
        padding: 12px 14px;
        font-size: 14px;
        width: 100%;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23e4e6eb' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
        padding-right: 35px;
    }

    .vri-checkbox-label {
        margin-top: 12px;
        font-size: 13px;
    }

    .vri-dashboard-grid {
        gap: 16px;
    }

    .vri-card {
        border-radius: 8px;
    }

    .vri-card-header {
        padding: 14px 16px;
        flex-wrap: nowrap;
    }

    .vri-card-header svg {
        width: 18px;
        height: 18px;
    }

    .vri-card-header h2 {
        font-size: 14px;
        line-height: 1.3;
    }

    .vri-card-body {
        padding: 16px;
    }

    /* Member info mobile */
    .vri-member-info h3 {
        font-size: 18px;
        margin-bottom: 10px;
    }

    .vri-member-badges {
        gap: 8px;
    }

    .vri-badge {
        padding: 6px 12px;
        font-size: 12px;
    }

    .vri-badge svg {
        width: 12px;
        height: 12px;
    }

    /* Vote summary mobile */
    .vri-vote-summary {
        gap: 40px;
        margin: 16px 0;
        flex-wrap: nowrap;
    }

    .vri-vote-count {
        flex: 1;
    }

    .vri-vote-count .label {
        font-size: 11px;
        margin-bottom: 6px;
    }

    .vri-vote-count .value {
        font-size: 28px;
        font-weight: 700;
    }

    /* Progress bar mobile */
    .vri-progress-bar-wrapper {
        margin: 16px 0;
    }

    .vri-progress-bar {
        height: 36px;
        font-size: 12px;
        border-radius: 6px;
    }

    .progress-yes,
    .progress-no {
        font-weight: 600;
    }

    /* Tables mobile - fully responsive without horizontal scroll */
    .vri-votes-list {
        width: 100%;
    }

    .vri-votes-table {
        width: 100%;
        table-layout: auto;
    }

    .vri-votes-table thead th {
        font-size: 10px;
        padding: 10px 8px;
        white-space: nowrap;
    }

    .vri-votes-table tbody td {
        font-size: 13px;
        padding: 12px 8px;
        vertical-align: middle;
    }

    .vri-votes-table tbody td.session-name {
        font-weight: 500;
        max-width: 180px;
        white-space: normal;
        word-break: break-word;
    }

    .vri-vote-badge {
        padding: 4px 10px;
        font-size: 10px;
        white-space: nowrap;
    }

    /* Sessions list mobile */
    .vri-sessions-list {
        max-height: 250px;
    }

    .vri-session-item {
        padding: 12px 14px;
    }

    .vri-session-title {
        font-size: 13px;
    }

    .vri-session-meta {
        font-size: 11px;
    }

    /* Total votes text */
    .vri-total-votes {
        font-size: 12px;
        margin-top: 16px;
    }

    /* Party members votes */
    .vri-party-members-votes {
        margin-top: 24px;
        padding-top: 20px;
    }

    .vri-party-members-votes h4 {
        font-size: 11px;
        margin-bottom: 12px;
        font-weight: 700;
    }

    /* Party details mobile */
    .vri-party-details h3 {
        font-size: 16px;
        margin-bottom: 16px;
    }

    .vri-party-details .vri-vote-summary {
        margin: 16px 0;
    }

    .vri-party-details .vri-total-votes {
        font-size: 12px;
        margin-top: 12px;
    }
}

@media (max-width: 480px) {
    .vri-dashboard-container {
        padding: 0 12px;
    }

    .vri-dashboard-header {
        margin: 0 -12px 16px -12px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .vri-logo {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .vri-logo svg {
        width: 28px;
        height: 28px;
    }

    .vri-logo h1 {
        font-size: 16px;
    }

    .vri-logo p {
        font-size: 10px;
    }

    .vri-filter-controls {
        padding: 12px;
        gap: 10px;
    }

    .vri-filter-select {
        padding: 8px 12px;
        font-size: 12px;
    }

    .vri-card-header {
        padding: 12px 14px;
    }

    .vri-card-header h2 {
        font-size: 13px;
    }

    .vri-card-body {
        padding: 14px;
    }

    .vri-member-info h3 {
        font-size: 16px;
    }

    .vri-badge {
        padding: 5px 10px;
        font-size: 11px;
        gap: 4px;
    }

    .vri-badge svg {
        width: 10px;
        height: 10px;
    }

    .vri-vote-summary {
        gap: 20px;
        margin: 12px 0;
        flex-wrap: nowrap;
    }

    .vri-vote-count {
        flex: 1;
        min-width: 0;
    }

    .vri-vote-count .label {
        font-size: 10px;
        margin-bottom: 4px;
    }

    .vri-vote-count .value {
        font-size: 24px;
        font-weight: 700;
    }

    .vri-progress-bar-wrapper {
        margin: 16px 0;
    }

    .vri-progress-bar {
        height: 32px;
        font-size: 11px;
        border-radius: 6px;
    }

    .progress-yes,
    .progress-no {
        font-weight: 600;
        padding: 0 8px;
    }

    .vri-votes-table {
        width: 100%;
        table-layout: auto;
    }

    .vri-votes-table thead th {
        font-size: 9px;
        padding: 8px 4px;
    }

    .vri-votes-table tbody td {
        font-size: 11px;
        padding: 10px 4px;
    }

    .vri-vote-badge {
        padding: 2px 8px;
        font-size: 9px;
    }

    .vri-session-item {
        padding: 10px 12px;
    }

    .vri-session-title {
        font-size: 12px;
    }

    .vri-session-meta {
        font-size: 10px;
    }

    .vri-total-votes {
        font-size: 11px;
        margin-top: 12px;
    }

    .vri-party-members-votes {
        margin-top: 20px;
        padding-top: 16px;
    }

    .vri-party-members-votes h4 {
        font-size: 10px;
        font-weight: 700;
        margin-bottom: 10px;
    }

    /* Party details for small screens */
    .vri-party-details h3 {
        font-size: 15px;
        margin-bottom: 12px;
    }

    .vri-party-details .vri-total-votes {
        font-size: 11px;
        margin-top: 10px;
    }

    .vri-empty-state {
        padding: 30px 15px;
        font-size: 13px;
        line-height: 1.5;
    }
}

/* Dark Mode Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #0a1628;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Smooth Animations */
.vri-card,
.vri-session-item,
.vri-votes-table tbody tr,
.progress-yes,
.progress-no {
    will-change: transform;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Card body fade-in animation */
.vri-card-body {
    transition: opacity 0.3s ease;
}

.vri-card-body.updating {
    opacity: 0.5;
}

/* Loading State */
.vri-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #4a90e2;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Focus States for Accessibility */
.vri-filter-select:focus,
.vri-session-item:focus,
button:focus {
    outline: 2px solid #4a90e2;
    outline-offset: 2px;
}

/* Touch Targets - Minimum 44x44px for mobile */
@media (max-width: 768px) {
    .vri-filter-select,
    .vri-session-item,
    .vri-votes-table tbody tr {
        min-height: 44px;
    }

    .vri-checkbox-label input[type="checkbox"] {
        width: 44px;
        height: 44px;
    }

    /* Better touch spacing for badges */
    .vri-badge {
        min-height: 32px;
        display: inline-flex;
        align-items: center;
    }

    /* Prevent horizontal scroll */
    .vri-dashboard-container {
        overflow-x: hidden;
        max-width: 100%;
    }

    /* Ensure cards don't overflow */
    .vri-card {
        max-width: 100%;
        overflow: hidden;
    }

    /* Make table cells wrap text instead of scrolling */
    .vri-votes-table tbody td {
        word-wrap: break-word;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .vri-votes-table tbody td.session-name {
        max-width: 200px;
    }
}

/* Print Styles */
@media print {
    .vri-dashboard-page {
        background: white;
        color: black;
    }

    .vri-filter-controls {
        display: none;
    }

    .vri-card {
        break-inside: avoid;
        border: 1px solid #ddd;
    }
}