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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 15px;
}

.header-count {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

#topResultCount {
    font-size: 18px;
    margin: 0;
}

#topResultCount strong {
    font-size: 20px;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.controls {
    padding: 25px;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.search-section {
    margin-bottom: 20px;
}

.search-box {
    width: 100%;
    padding: 12px 20px;
    font-size: 16px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.search-box:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Prevent browser autofill styling */
.search-box:-webkit-autofill,
.search-box:-webkit-autofill:hover,
.search-box:-webkit-autofill:focus,
.search-box:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px white inset !important;
    -webkit-text-fill-color: #495057 !important;
    box-shadow: 0 0 0 30px white inset !important;
    background-color: white !important;
    background-clip: content-box !important;
}

.search-box[readonly] {
    background-color: white;
    cursor: text;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}

.filter-select {
    width: 100%;
    padding: 10px 15px;
    font-size: 14px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px 0;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

.table-container {
    overflow-x: auto;
    max-height: 70vh;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

thead th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

tbody tr {
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

tbody td {
    padding: 12px 15px;
    color: #495057;
}

.mobile-cell {
    white-space: nowrap;
}

.mobile-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: inline-block;
}

.mobile-link:hover {
    background-color: #f0f4ff;
    color: #5568d3;
    text-decoration: underline;
}

.mobile-link:active {
    background-color: #e0e8ff;
}

tbody td.loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-style: italic;
}

.footer {
    padding: 20px 25px;
    background: #f8f9fa;
    border-top: 2px solid #e9ecef;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#resultCount {
    color: #495057;
    font-weight: 500;
    font-size: 18px;
    margin: 0;
}

#resultCount strong {
    color: #667eea;
    font-size: 20px;
}

.print-btn,
.export-btn {
    padding: 10px 20px;
    font-size: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.print-btn:hover,
.export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.print-btn:active,
.export-btn:active {
    transform: translateY(0);
}

.export-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.export-btn:hover {
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* Scrollbar styling */
.table-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.table-container::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

/* Multi-select styles */
.district-multi-select {
    position: relative;
}

.multi-select-wrapper {
    position: relative;
}

.multi-select-display {
    width: 100%;
    padding: 10px 15px;
    font-size: 14px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 42px;
    display: flex;
    align-items: center;
}

.multi-select-display:hover {
    border-color: #667eea;
}

.multi-select-display::after {
    content: '▼';
    float: right;
    font-size: 10px;
    margin-left: auto;
    color: #6c757d;
}

.multi-select-wrapper.active .multi-select-display {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.multi-select-wrapper.active .multi-select-display::after {
    content: '▲';
}

.multi-select-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    margin-top: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

.multi-select-wrapper.active .multi-select-dropdown {
    display: block;
}

.multi-select-options {
    max-height: 250px;
    overflow-y: auto;
    padding: 5px;
}

.multi-select-option {
    padding: 10px 15px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.multi-select-option:hover {
    background-color: #f8f9fa;
}

.multi-select-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: #667eea;
}

.multi-select-option label {
    cursor: pointer;
    flex: 1;
    margin: 0;
    font-weight: normal;
    color: #495057;
}

.multi-select-actions {
    padding: 10px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
}

.select-all-btn,
.clear-all-btn {
    flex: 1;
    padding: 8px 15px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.select-all-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.clear-all-btn:hover {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.loading-content {
    background: white;
    padding: 30px 40px;
    border-radius: 12px;
    text-align: center;
    min-width: 300px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loadingText {
    margin: 15px 0;
    color: #495057;
    font-weight: 500;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

/* Bookmark styles */
.bookmark-cell {
    text-align: center;
    width: 50px;
}

.bookmark-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    color: #6c757d;
    transition: all 0.2s ease;
    line-height: 1;
}

.bookmark-btn:hover {
    transform: scale(1.2);
    color: #ffc107;
}

.bookmark-btn.bookmarked {
    color: #ffc107;
}

.bookmark-btn.bookmarked:hover {
    color: #ff9800;
}

tbody tr.bookmarked {
    background-color: #fff9e6;
}

tbody tr.bookmarked:hover {
    background-color: #fff3cd;
}

tbody tr.web-options {
    background-color: #e8f5e9;
}

tbody tr.web-options:hover {
    background-color: #c8e6c9;
}

/* Web Options button */
.web-options-cell {
    text-align: center;
    width: 50px;
}

.web-options-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    color: #6c757d;
    transition: all 0.2s ease;
    line-height: 1;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.web-options-btn:hover {
    transform: scale(1.2);
    background-color: #e8f5e9;
    color: #4caf50;
}

.web-options-btn.active {
    color: #4caf50;
    background-color: #c8e6c9;
    font-weight: bold;
}

.web-options-btn.active:hover {
    background-color: #a5d6a7;
    color: #2e7d32;
}

/* PIN Modal */
.pin-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10001;
}

.pin-modal-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    min-width: 300px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.pin-modal-content h2 {
    margin-bottom: 20px;
    color: #495057;
}

#pinInput {
    width: 100%;
    padding: 12px;
    font-size: 18px;
    text-align: center;
    letter-spacing: 4px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 15px;
    font-family: 'Courier New', monospace;
}

#pinInput:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.pin-submit-btn {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s ease;
}

.pin-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.pin-error {
    color: #dc3545;
    margin-top: 10px;
    font-size: 14px;
    min-height: 20px;
}

/* Bookmark Modal */
.bookmark-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.bookmark-modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    min-width: 400px;
    max-width: 600px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.bookmark-modal-content h3 {
    margin-bottom: 15px;
    color: #495057;
}

.bookmark-reg-id {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-weight: 600;
    color: #667eea;
    font-family: 'Courier New', monospace;
}

#bookmarkNote {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    resize: vertical;
    font-family: inherit;
    margin-bottom: 15px;
}

#bookmarkNote:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.bookmark-hints {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.hint-label {
    font-size: 13px;
    color: #6c757d;
    font-weight: 500;
}

.hint-btn {
    padding: 6px 12px;
    font-size: 12px;
    background: #e9ecef;
    color: #495057;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.hint-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.2);
}

.hint-btn:active {
    transform: translateY(0);
}

.bookmark-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.bookmark-save-btn,
.bookmark-remove-btn,
.bookmark-cancel-btn {
    padding: 10px 20px;
    font-size: 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.bookmark-save-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.bookmark-save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.bookmark-remove-btn {
    background: #dc3545;
    color: white;
    margin-right: auto;
}

.bookmark-remove-btn:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.bookmark-cancel-btn {
    background: #6c757d;
    color: white;
}

.bookmark-cancel-btn:hover {
    background: #5a6268;
}

/* Registration ID Cell with Notes */
.reg-id-cell {
    position: relative;
}

.reg-id-wrapper {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.reg-id-text {
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

.bookmark-note {
    font-size: 12px;
    color: #667eea;
    background: #f0f4ff;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-style: italic;
}

/* Print styles */
@media print {
    .no-print,
    .controls,
    .footer,
    .loading-overlay,
    .bookmark-btn,
    .multi-select-wrapper,
    header {
        display: none !important;
    }
    
    .container {
        box-shadow: none;
        border-radius: 0;
        max-width: 100%;
    }
    
    .table-container {
        max-height: none;
        overflow: visible;
    }
    
    table {
        font-size: 10px;
    }
    
    thead th,
    tbody td {
        padding: 6px 4px;
    }
    
    tbody tr {
        page-break-inside: avoid;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .filters {
        flex-direction: column;
    }

    .filter-group {
        min-width: 100%;
    }

    header h1 {
        font-size: 1.5rem;
    }

    table {
        font-size: 12px;
    }

    thead th,
    tbody td {
        padding: 10px 8px;
    }

    .bookmark-modal-content {
        min-width: 90%;
        margin: 20px;
    }

    .pin-modal-content {
        min-width: 90%;
        margin: 20px;
    }
}

