/* Main Container */
table td, table th {
    border: unset;
}
table tbody>tr:nth-child(odd)>td, table tbody>tr:nth-child(odd)>th {
    background-color: unset;
}
table caption+thead tr:first-child td, table caption+thead tr:first-child th, table colgroup+thead tr:first-child td, table colgroup+thead tr:first-child th, table thead:first-child tr:first-child td, table thead:first-child tr:first-child th {
    border-block-start: unset;
}
table th {
    font-weight: unset;
}

#graveyard-search-container {
    position: relative;
    width: 100%;
    /* margin: 20px auto; */
    font-family: "Northern Ireland-Regular", Sans-serif;
}

/* Search Input Wrapper */
.search-input-wrapper {
    position: relative;
    width: 100%;
}

#graveyard-search-input {
    width: 100%;
    padding: 15px 40px 15px 15px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 0px;
    outline: none;
    box-sizing: border-box;
}

#graveyard-search-input:focus {
    border-color: #757575;
}

/* Clear Button */
.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: #999;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 10;
}

.search-clear:hover {
    background: #666;
}

/* Results Container */
#search-results {
    margin-top: 50px;
}

.results-container {
    overflow: hidden;
}

/* Results Header */
.results-header {
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    /* justify-content: space-between; */
    align-items: center;
    flex-wrap: wrap;
    gap: 35px;
}

.searchedWord {
    font-size: 24px;
    font-weight: 700;
}

/* Sort Section */
.sort-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-section label {
    font-weight: 600;
    color: #333;
    font-size: 18px;
    white-space: nowrap;
}

.sort-select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    background: white;
    font-size: 16px;
    color: #333;
    cursor: pointer;
    min-width: 200px;
}

.sort-select:hover {
    border-color: #0073aa;
}

.sort-select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0,115,170,0.2);
}

/* Table Styles */
.table-responsive {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.graveyard-results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.graveyard-results-table th {
    padding: 12px 15px;
    text-align: left;
    color: #1E1E1E;
    border-bottom: 1px solid #ddd;
    font-weight: bold;
}

.graveyard-results-table td {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}

/* Pagination */
.pagination-container {
    padding: 15px 20px;
    background: transparent;
    border-top: none;
}

.pagination {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}

.page-btn {
    padding: 6px 9px;
    border: 1px solid #f5f5f5;
    background: #f5f5f5;
    color: #404B52;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    min-width: 40px;
    transition: all 0.2s ease;
}

.page-btn:hover:not(:disabled) {
    background: #1E1E1E;
    color: #fff;
    border-color: #1E1E1E;
}

.page-btn.active {
    background: #1E1E1E;
    color: white;
    border-color: #5932EA;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-dots {
    padding: 0 5px;
    color: #666;
}

[type=button]:focus, [type=button]:hover, [type=submit]:focus, [type=submit]:hover, button:focus, button:hover {
    background-color: #757575;
    color: #fff;
    text-decoration: none;
}

/* States */
.loading-state,
.no-results,
.error-state {
    padding: 30px;
    text-align: center;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
}

/* Results Footer */
.results-footer {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    /* border-top: 1px solid #ddd; */
}

.results-count {
    color: #757575;
    font-size: 14px;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablet Styles (768px and below) */
@media screen and (max-width: 768px) {
    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .searchedWord {
        font-size: 20px;
    }
    
    .sort-section {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .sort-section label {
        width: 100%;
        margin-bottom: -5px;
    }
    
    .sort-select {
        width: 100%;
        min-width: unset;
        max-width: none;
    }
    
    .results-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .results-count {
        width: 100%;
        text-align: left;
    }
    
    .pagination-container {
        width: 100%;
    }
    
    .pagination {
        justify-content: flex-start;
        width: 100%;
    }
}

/* Mobile Styles (600px and below) */
@media screen and (max-width: 600px) {
    /* Transform table to cards */
    .graveyard-results-table,
    .graveyard-results-table thead,
    .graveyard-results-table tbody,
    .graveyard-results-table th,
    .graveyard-results-table td,
    .graveyard-results-table tr {
        display: block;
    }
    
    /* Hide table headers */
    .graveyard-results-table thead {
        display: none;
    }
    
    /* Card styling for each row */
    .graveyard-results-table tr {
        margin-bottom: 20px;
        border: 1px solid #ddd;
        border-radius: 8px;
        background: white;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        overflow: hidden;
    }
    
    /* Style each cell as a card row */
    .graveyard-results-table td {
        display: flex;
        padding: 12px 15px;
        border: none;
        border-bottom: 1px solid #f0f0f0;
        position: relative;
        gap: 10px;
    }
    
    .graveyard-results-table td:last-child {
        border-bottom: none;
    }
    
    /* Add labels to each cell */
    .graveyard-results-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #0073aa;
        min-width: 100px;
        max-width: 100px;
        font-size: 13px;
    }
    
    /* Content styling */
    .graveyard-results-table td:not(:empty) {
        color: #333;
        flex: 1;
        word-break: break-word;
    }
    
    /* Improve clear button for mobile */
    .search-clear {
        width: 32px;
        height: 32px;
        font-size: 30px;
        right: 10px;
        line-height: 0.5;
    }
    
    /* Larger input for better touch */
    #graveyard-search-input {
        padding: 15px 50px 15px 15px;
        font-size: 16px;
    }
    
    /* Pagination adjustments */
    .page-btn {
        padding: 8px 12px;
        min-width: 44px;
        min-height: 44px;
        font-size: 14px;
    }
    
    /* Show fewer page numbers on very small screens */
    .pagination .page-btn:not(.prev-btn):not(.next-btn):not(.active) {
        display: none;
    }
    
    /* Add page indicator */
    .pagination {
        position: relative;
        padding-bottom: 25px;
    }
    
    /* .pagination::after {
        content: "Page " attr(data-current) " of " attr(data-total);
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        text-align: center;
        font-size: 12px;
        color: #666;
        margin-top: 10px;
    } */
}

/* Small Mobile Styles (400px and below) */
@media screen and (max-width: 400px) {
    .graveyard-results-table td {
        flex-direction: column;
        gap: 5px;
        padding: 12px;
    }
    
    .graveyard-results-table td::before {
        min-width: unset;
        max-width: unset;
        width: 100%;
    }
    
    .searchedWord {
        font-size: 18px;
    }
    
    .results-footer {
        padding: 12px 15px;
    }
    
    .pagination {
        gap: 3px;
    }
    
    .page-btn {
        min-width: 36px;
        min-height: 36px;
        padding: 6px 8px;
        font-size: 13px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .page-btn,
    .search-clear,
    .sort-select {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    }
    
    .page-btn:active,
    .search-clear:active {
        transform: scale(0.95);
    }
}

/* Print Styles */
@media print {
    .search-input-wrapper,
    .sort-section,
    .pagination-container,
    .search-clear {
        display: none !important;
    }
    
    .graveyard-results-table {
        font-size: 12pt;
        border-collapse: collapse;
        width: 100%;
    }
    
    .graveyard-results-table th,
    .graveyard-results-table td {
        border: 1px solid #000;
        padding: 8px;
    }
}