.citizenship-index {
    font-family: 'Montserrat', system-ui, sans-serif;
    background: #f7f9fb;
    padding: 24px;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.citizenship-index * {
    box-sizing: border-box;
}

.ci-header {
    text-align: center;
    margin-bottom: 32px;
}

.ci-header h2 {
    margin: 0 0 8px 0;
    font-size: 32px;
    color: #111827;
    font-weight: 600;
}

.ci-header p {
    margin: 0;
    color: #6b7280;
    font-size: 16px;
}

.ci-toolbar {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.ci-toolbar input {
    flex: 1;
    min-width: 200px;
    padding: 10px 12px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-size: 14px;
}

.ci-toggle {
    padding: 10px 16px;
    background: white;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.ci-toggle:hover {
    background: #f3f4f6;
}

.ci-toggle.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.ci-table-wrapper {
    overflow-x: auto;
    width: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.ci-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.ci-table thead {
    background: #243447;
    color: white;
}

.ci-table th {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 2px solid #1a2632;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

.ci-table td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    vertical-align: middle;
}

/* Flag Styling */
.ci-flag {
    width: 24px;
    height: 18px;
    margin-right: 8px;
    margin-left: 4px;
    vertical-align: middle;
    border-radius: 2px;
    object-fit: cover;
    display: inline-block;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Column Width Distribution */
.ci-col-rank {
    width: 8%;
    min-width: 60px;
}

.ci-col-country {
    width: 22%;
    min-width: 180px;
}

.ci-col-score {
    width: 43%;
    min-width: 200px;
}

.ci-col-dual {
    width: 10%;
    min-width: 70px;
    text-align: center;
}

.ci-col-details {
    width: 12%;
    min-width: 100px;
    text-align: center;
}

.ci-table tbody tr {
    cursor: pointer;
    transition: background 0.2s;
    height: 50px;
}

.ci-table tbody tr:hover {
    background: #f9fafb;
}

.ci-table tbody tr.expanded {
    background: #eff6ff;
}

/* Score Column Styling */
.ci-score-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ci-score-value {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    min-width: 70px;
}

.ci-score-bar {
    flex: 1;
    background: #e5e7eb;
    border-radius: 6px;
    height: 12px;
    position: relative;
    overflow: hidden;
}

.ci-score-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.3s ease, background 0.3s ease;
}

/* Dual Citizenship Icons */
.ci-check {
    color: #22c55e;
    font-weight: bold;
    font-size: 20px;
}

.ci-cross {
    color: #ef4444;
    font-weight: bold;
    font-size: 20px;
}

/* Sortable Headers */
.ci-sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.ci-sortable:hover {
    background: rgba(255,255,255,0.1);
}

.ci-sort-arrow {
    font-size: 14px;
    margin-left: 4px;
    opacity: 0.7;
}

/* Details Button */
.ci-details-btn {
    padding: 6px 14px;
    background: #1a2632;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s;
}

.ci-details-btn:hover {
    background: #1d4ed8;
}

/* Details Row */
.ci-details-row {
    display: none;
}

.ci-details-row.show {
    display: table-row;
}

.ci-details-cell {
    padding: 0 !important;
    background: #f9fafb;
    border-bottom: 2px solid #243447 !important;
}

.ci-details {
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.ci-box {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.ci-box h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    border-bottom: 2px solid #243447;
    padding-bottom: 8px;
}

.ci-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
}

.ci-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.ci-row span:first-child {
    color: #6b7280;
}

.ci-rating {
    color: #2563eb;
    font-weight: 600;
}

/* Mobile Sort Bar - hidden on desktop */
.ci-mobile-sort {
    display: none;
}

/* Tablet Styles */
@media (max-width: 1024px) {
    .ci-score-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .ci-score-bar {
        width: 100%;
    }
    
    .ci-col-score {
        width: 35%;
    }
    
    .ci-col-country {
        width: 25%;
    }
}

/* Mobile Styles - Card Layout */
@media (max-width: 768px) {
    .citizenship-index {
        padding: 5px;
    }
    
    .ci-header h2 {
        font-size: 24px;
    }
    
    .ci-header p {
        font-size: 14px;
    }
    
    .ci-toolbar {
        flex-direction: column;
    }
    
    .ci-toolbar input {
        width: 100%;
    }
    
    .ci-toggle {
        width: 100%;
        text-align: center;
    }

    /* Mobile sort bar */
    .ci-mobile-sort {
        display: flex;
        gap: 8px;
        position: sticky;
        top: 73;
        z-index: 0;
        background: #f7f9fb;
        padding: 10px 0;
        margin-bottom: 8px;
        border-bottom: 1px solid #e5e7eb;
    }

    .ci-sort-select {
        flex: 1;
        padding: 9px 12px;
        border: 1px solid #d0d7de;
        border-radius: 6px;
        font-size: 14px;
        font-family: inherit;
        background: white;
        color: #111827;
        appearance: none;
        -webkit-appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 10px center;
        padding-right: 30px;
        cursor: pointer;
    }

    .ci-sort-direction {
        padding: 9px 14px;
        border: 1px solid #d0d7de;
        border-radius: 6px;
        background: white;
        font-size: 16px;
        cursor: pointer;
        color: #111827;
        transition: all 0.2s;
        white-space: nowrap;
        min-width: 46px;
        text-align: center;
    }

    .ci-sort-direction:hover {
        background: #f3f4f6;
		color: #111827;
    }

    /* Override table wrapper */
    .ci-table-wrapper {
        overflow-x: visible !important;
    }

    /* Hide table headers on mobile */
    .ci-table thead {
        display: none !important;
    }

    /* Convert table to block layout */
    .ci-table,
    .ci-table tbody,
    .ci-table tbody tr {
        display: block !important;
        width: 100% !important;
    }

    /* Card styling for each row */
    .ci-table tbody tr {
        margin-bottom: 16px !important;
        border-radius: 8px !important;
        padding: 16px !important;
        cursor: pointer !important;
        height: auto !important;
    }

    /* Block display for all cells */
    .ci-table td {
        display: block !important;
        width: 100% !important;
        padding: 8px 0 !important;
        border: none !important;
        text-align: left !important;
    }

    /* Add labels before content on mobile */
    .ci-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
        display: inline-block;
        margin-right: 8px;
        min-width: 120px;
    }

    /* Hide label for rank (shows # already) */
    .ci-col-rank::before {
        display: none !important;
    }

    /* Specific mobile styling */
    .ci-col-rank {
        width: 100% !important;
        font-size: 18px !important;
        margin-bottom: 8px !important;
        padding-bottom: 12px !important;
        border-bottom: 2px solid #e5e7eb !important;
    }

    .ci-col-country {
        width: 100% !important;
        font-size: 20px !important;
        margin-bottom: 12px !important;
    }
    
    .ci-col-country::before {
        display: none !important;
    }

    .ci-col-country img {
        width: 32px !important;
        height: 24px !important;
        margin-right: 10px !important;
    }

    .ci-col-score {
        width: 100% !important;
    }

    .ci-score-container {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }

    .ci-score-value {
        font-size: 16px !important;
    }

    .ci-score-bar {
        width: 100% !important;
        height: 12px !important;
    }

    .ci-col-dual {
        width: 100% !important;
    }

    .ci-col-details {
        width: 100% !important;
        margin-top: 12px !important;
    }
    
    .ci-col-details::before {
        display: none !important;
    }

    .ci-details-btn {
        width: 100% !important;
        padding: 10px !important;
        font-size: 14px !important;
    }

    /* Details row - collapsed by default, shown on demand */
    .ci-details-row {
        height: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
    }

    .ci-details-row .ci-details-cell {
        display: none !important;
    }

    .ci-details-row.show {
        height: auto !important;
        overflow: visible !important;
        margin-bottom: 16px !important;
    }

    .ci-details-row.show .ci-details-cell {
        display: block !important;
    }

    .ci-details {
        grid-template-columns: 1fr !important;
        padding: 16px !important;
        gap: 16px !important;
    }
    
    .ci-box {
        padding: 16px !important;
    }
    
    .ci-box h4 {
        font-size: 15px !important;
    }
    
    .ci-row {
        font-size: 13px !important;
    }
    
    .ci-check,
    .ci-cross {
        font-size: 20px !important;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .ci-table th,
    .ci-table td {
        padding: 6px 4px;
        font-size: 12px;
    }
    
    .ci-score-value {
        font-size: 13px;
        min-width: 55px;
    }
    
    .ci-score-bar {
        height: 8px;
    }
    
    .ci-expand-icon {
        font-size: 8px;
        margin-right: 4px;
    }
}