/**
 * Kannada Search - Styles
 * 
 * CSS for search interface with Kannada text support
 */

/* Base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Nirmala UI', 'Tunga', 'Kannada Sangam MN', 'Noto Sans Kannada', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    padding: 20px;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Header */
.header {
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 20px;
}

.header h1 {
    font-size: 2em;
    color: #2c3e50;
    margin-bottom: 10px;
}

/* Search section */
.search-section {
    margin-bottom: 30px;
}

.search-box {
    position: relative;
    margin-bottom: 20px;
}

#searchBox {
    width: 100%;
    padding: 15px 20px;
    font-size: 1.1em;
    font-family: inherit;
    border: 2px solid #ddd;
    border-radius: 6px;
    transition: border-color 0.3s;
}

#searchBox:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Filters */
.filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.filter-group select {
    width: 100%;
    padding: 10px;
    font-family: inherit;
    font-size: 1em;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
}

/* Results count */
#resultsCount {
    color: #666;
    font-size: 0.95em;
    margin-bottom: 15px;
}

/* Results container */
#results {
    display: grid;
    gap: 20px;
}

/* Result card */
.result-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    transition: box-shadow 0.3s, transform 0.2s;
}

.result-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Card header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.card-title strong {
    font-size: 1.2em;
    color: #2c3e50;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    background: #3498db;
    color: white;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: normal;
}

.card-reg-no {
    color: #7f8c8d;
    font-size: 0.9em;
    font-family: monospace;
}

/* Card body */
.card-body {
    margin-bottom: 15px;
}

.card-field {
    margin-bottom: 10px;
    display: flex;
    gap: 10px;
}

.card-field .label {
    font-weight: 600;
    color: #555;
    min-width: 100px;
}

.card-field .value {
    color: #333;
    flex: 1;
}

/* Status styling */
.status-completed {
    color: #27ae60;
    font-weight: 600;
}

.status-pending {
    color: #f39c12;
    font-weight: 600;
}

.status-rejected {
    color: #e74c3c;
    font-weight: 600;
}

/* Highlight matches */
mark {
    background: #fff59d;
    color: #333;
    padding: 2px 4px;
    border-radius: 2px;
    font-weight: 600;
}

/* Card actions */
.card-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-family: inherit;
    font-size: 0.95em;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-speak {
    background: #3498db;
    color: white;
}

.btn-speak:hover {
    background: #2980b9;
}

.btn-speak.speaking {
    background: #e74c3c;
    animation: pulse 1.5s infinite;
}

.btn-view {
    background: #2ecc71;
    color: white;
}

.btn-view:hover {
    background: #27ae60;
}

/* Speaking animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Loading indicator */
#loadingIndicator {
    text-align: center;
    padding: 30px;
    color: #666;
}

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.no-results p {
    font-size: 1.2em;
}

/* Error message */
.error-message {
    background: #fee;
    color: #c33;
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid #c33;
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 1.5em;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .card-header {
        flex-direction: column;
    }
    
    .card-actions {
        justify-content: stretch;
    }
    
    .btn {
        flex: 1;
    }
    
    .card-field {
        flex-direction: column;
        gap: 5px;
    }
    
    .card-field .label {
        min-width: auto;
    }
}

/* Print styles */
@media print {
    .search-section,
    .card-actions,
    .filters {
        display: none;
    }
    
    .result-card {
        page-break-inside: avoid;
        border: 1px solid #000;
        margin-bottom: 10px;
    }
}

/* Accessibility */
.btn:focus,
#searchBox:focus,
select:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .result-card {
        border: 2px solid #000;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

.modal-large {
    max-width: 1100px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
    color: #2c3e50;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2em;
    color: #7f8c8d;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #2c3e50;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Advanced search modal */
.advanced-search-box {
    margin-bottom: 20px;
}

.advanced-search-box input {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    font-family: inherit;
    border: 2px solid #ddd;
    border-radius: 6px;
    transition: border-color 0.3s;
}

.advanced-search-box input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-info {
    margin-top: 10px;
    font-size: 0.9em;
    color: #7f8c8d;
}

.advanced-results {
    min-height: 400px;
}

.advanced-results-header {
    padding: 15px;
    background: #ecf0f1;
    border-radius: 6px;
    margin-bottom: 20px;
}

.advanced-results-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.2em;
}

.table-results {
    margin-bottom: 30px;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #3498db;
    color: white;
    border-radius: 6px 6px 0 0;
}

.table-header h4 {
    margin: 0;
    font-size: 1.1em;
}

.table-header .badge {
    background: white;
    color: #3498db;
}

.table-records {
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 6px 6px;
}

.record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.record-item:last-child {
    border-bottom: none;
}

.record-item:hover {
    background: #f8f9fa;
}

.record-text {
    flex: 1;
}

.record-action {
    color: #3498db;
    font-weight: 600;
    margin-left: 15px;
}

.loading-message,
.empty-message,
.error-message {
    text-align: center;
    padding: 60px 20px;
}

.loading-message p,
.empty-message p,
.error-message p {
    margin-top: 20px;
    color: #7f8c8d;
    font-size: 1.1em;
}

.error-message p {
    color: #e74c3c;
}

/* Detail modal */
.detail-content {
    min-height: 300px;
}

.detail-grid {
    display: grid;
    gap: 15px;
}

.detail-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.detail-label {
    font-weight: 600;
    color: #555;
}

.detail-value {
    color: #333;
    word-break: break-word;
}

/* Advanced search button */
.btn-advanced {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-family: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-advanced:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-advanced:active {
    transform: translateY(0);
}

/* Responsive modal */
@media (max-width: 768px) {
    .modal {
        padding: 0;
    }
    
    .modal-content {
        max-height: 100vh;
        border-radius: 0;
    }
    
    .detail-row {
        grid-template-columns: 1fr;
        gap: 5px;
    }
    
    .record-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .record-action {
        margin-left: 0;
    }
}
