/* Enhanced Voter Manager Frontend Styles */

.vm-search-container {
    max-width: 800px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.vm-search-card,
.vm-voter-details-card,
.vm-additional-details-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.vm-card-header,
.vm-form-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    margin: 0;
}

.vm-card-header h3,
.vm-form-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Transliteration Toggle Styles */
.vm-transliteration-toggle {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 20px;
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.vm-toggle-label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.vm-toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
    cursor: pointer;
    margin-right: 8px;
}

.vm-toggle-text {
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s ease;
}

.vm-toggle-examples {
    color: #6b7280;
    font-style: italic;
    margin-left: 26px;
}

.vm-toggle-label input[type="checkbox"]:checked + .vm-toggle-text {
    color: #667eea;
}

/* Enhanced Input Styling for Transliteration */
.vm-input.vm-hindi-enabled {
    background: linear-gradient(45deg, transparent 0%, rgba(102, 126, 234, 0.02) 100%);
    border-left: 3px solid #667eea;
    transition: all 0.3s ease;
}

.vm-input.vm-hindi-enabled:focus {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1), 0 0 0 1px #667eea;
    border-left-color: #4f46e5;
}

/* Transliteration Indicator */
.vm-transliteration-indicator {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #667eea;
    pointer-events: none;
    font-weight: 600;
    background: rgba(102, 126, 234, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.3s ease;
    opacity: 0.8;
}

.vm-transliteration-indicator:hover {
    opacity: 1;
    background: rgba(102, 126, 234, 0.15);
}

/* Form Elements */
.vm-form-group {
    margin-bottom: 20px;
    position: relative;
}

.vm-label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #374151;
    font-size: 14px;
}

.vm-input,
.vm-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    background: white;
}

.vm-input:focus,
.vm-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Sector Filter Styling */
#sector-filter-group {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 100px;
        transform: translateY(0);
    }
}

.vm-sector-loading {
    margin-top: 5px;
    color: #6b7280;
    font-style: italic;
}

.vm-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.optional {
    color: #6b7280;
    font-weight: normal;
    font-size: 12px;
}

/* Button Styles */
.vm-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 14px;
}

.vm-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.vm-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.vm-btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.vm-btn-secondary:hover:not(:disabled) {
    background: #e5e7eb;
}

.vm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.vm-btn-add {
    background: #10b981;
    color: white;
    font-size: 13px;
    padding: 8px 12px;
}

.vm-btn-add:hover {
    background: #059669;
    transform: translateY(-1px);
}

.vm-btn-remove {
    background: #ef4444;
    color: white;
    padding: 8px;
    border-radius: 6px;
    min-width: auto;
}

.vm-btn-remove:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Form Layout */
.vm-form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 20px;
    background: #f9fafb;
    margin: 0 -20px -20px -20px;
}

.vm-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.vm-search-fields {
    padding: 20px;
}

.search-field {
    display: none;
}

/* Suggestions */
.vm-suggestions {
    position: relative;
}

.vm-suggestion-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    list-style: none;
    margin: 0;
    padding: 0;
}

.vm-suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: all 0.2s ease;
}

.vm-suggestion-item:hover {
    background: #f3f4f6;
    transform: translateX(2px);
}

.vm-suggestion-item:last-child {
    border-bottom: none;
}

.vm-loading-suggestion,
.vm-no-suggestions {
    padding: 12px 16px;
    text-align: center;
    color: #6b7280;
    font-style: italic;
}

/* Voter Information Display */
.vm-voter-info {
    padding: 20px;
}

.vm-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.vm-info-item {
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s ease;
}

.vm-info-item:hover {
    background: rgba(102, 126, 234, 0.02);
    border-radius: 4px;
    margin: 0 -5px;
    padding: 12px 5px;
}

.vm-info-item:last-child {
    border-bottom: none;
}

.vm-info-item strong {
    color: #374151;
    display: inline-block;
    min-width: 120px;
    font-weight: 600;
}

.vm-info-item span {
    color: #6b7280;
    font-weight: 500;
}

.vm-extra-info {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.vm-extra-info h4 {
    margin: 0 0 15px 0;
    color: #374151;
    font-size: 16px;
}

/* Dynamic Sections */
.vm-dynamic-sections {
    padding: 20px;
}

.vm-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.vm-section:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.vm-section h4 {
    margin: 0 0 15px 0;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
}

.vm-dynamic-list {
    margin-bottom: 15px;
}

.vm-dynamic-item {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.vm-dynamic-item:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.vm-dynamic-item:last-child {
    margin-bottom: 0;
}

/* Results Display */
.vm-matches-container {
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid #e5e7eb;
}

.vm-matches-container h4 {
    margin: 0 0 15px 0;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
}

.vm-matches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.vm-match-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.vm-match-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.vm-match-button {
    width: 100%;
    padding: 15px;
    background: white;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.vm-match-button:hover {
    background: #f3f4f6;
}

/* Message Styles */
.vm-error-message,
.vm-success-message {
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.vm-error-message {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.vm-success-message {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.vm-verified-notice {
    padding: 20px;
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInDown 0.3s ease-out;
}

.required {
    color: #ef4444;
}

/* OTP Section Styles */
.vm-otp-section {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin: 15px 0;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.vm-otp-input-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.vm-otp-input-container input {
    flex: 1;
    text-align: center;
    font-weight: 600;
    letter-spacing: 2px;
    font-size: 16px;
}

.vm-otp-timer {
    font-size: 12px;
    color: #6b7280;
    margin-top: 5px;
    text-align: center;
    font-weight: 500;
}

.vm-otp-status {
    margin-top: 10px;
    padding: 10px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: fadeIn 0.3s ease-out;
}

.vm-otp-status.success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.vm-otp-status.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Mobile Feedback */
.mobile-feedback {
    font-size: 12px;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
}

.mobile-feedback.success {
    color: #166534;
}

.mobile-feedback.error {
    color: #991b1b;
}

/* Loading States */
.vm-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.vm-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #667eea;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

/* Enhanced Responsive Design */
@media (max-width: 768px) {
    .vm-search-container {
        margin: 10px;
        max-width: none;
    }
    
    .vm-form-row,
    .vm-info-grid {
        grid-template-columns: 1fr;
    }
    
    .vm-dynamic-item {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .vm-matches-grid {
        grid-template-columns: 1fr;
    }
    
    .vm-form-actions {
        flex-direction: column;
    }
    
    .vm-otp-input-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .vm-transliteration-toggle {
        margin: 10px;
        padding: 12px;
    }
    
    .vm-toggle-label {
        align-items: flex-start;
    }
    
    .vm-toggle-examples {
        margin-left: 0;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .vm-card-header,
    .vm-form-header {
        padding: 15px;
    }
    
    .vm-card-header h3,
    .vm-form-header h3 {
        font-size: 16px;
    }
    
    .vm-dynamic-sections,
    .vm-voter-info,
    .vm-search-fields {
        padding: 15px;
    }
    
    .vm-section {
        padding: 15px;
    }
    
    .vm-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* Print Styles */
@media print {
    .vm-search-card,
    .vm-additional-details-card,
    .vm-form-actions,
    .vm-btn,
    .vm-transliteration-toggle,
    .vm-otp-section {
        display: none !important;
    }
    
    .vm-voter-details-card {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .vm-card-header {
        background: #000 !important;
        color: #fff !important;
    }
    
    .vm-info-item {
        break-inside: avoid;
    }
}

/* Accessibility Improvements */
.vm-btn:focus,
.vm-input:focus,
.vm-select:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.vm-suggestion-item:focus {
    background: #667eea;
    color: white;
    outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .vm-input,
    .vm-select {
        border-width: 3px;
    }
    
    .vm-btn-primary {
        background: #000;
        border: 2px solid #fff;
    }
    
    .vm-transliteration-toggle {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support (if theme supports it) */
@media (prefers-color-scheme: dark) {
    .vm-search-card,
    .vm-voter-details-card,
    .vm-additional-details-card {
        background: #1f2937;
        border-color: #374151;
        color: #f9fafb;
    }
    
    .vm-input,
    .vm-select {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .vm-input:focus,
    .vm-select:focus {
        border-color: #667eea;
    }
    
    .vm-section {
        background: #374151;
        border-color: #4b5563;
    }
    
    .vm-transliteration-toggle {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .vm-dynamic-item {
        background: #1f2937;
        border-color: #4b5563;
    }
}

/* Custom scrollbar for suggestion lists */
.vm-suggestion-list::-webkit-scrollbar {
    width: 6px;
}

.vm-suggestion-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.vm-suggestion-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.vm-suggestion-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Tooltip-like styling for transliteration indicator */
.vm-transliteration-indicator:hover::after {
    content: 'Hindi typing enabled';
    position: absolute;
    bottom: 100%;
    right: 0;
    background: #1f2937;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 2px;
}

/* Enhanced focus indicators for better accessibility */
.vm-input:focus-visible,
.vm-select:focus-visible,
.vm-btn:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Smooth state transitions */
.vm-input,
.vm-select,
.vm-btn,
.vm-dynamic-item,
.vm-section {
    transition: all 0.2s ease-in-out;
}

/* Enhanced hover effects */
.vm-section:hover h4 {
    color: #667eea;
}

.vm-info-item:hover strong {
    color: #667eea;
}