/**
 * GT Champions Database Query Tool Styles
 * @since 2.1.0
 */

/* ============================================
   WRAPPER
   ============================================ */
.ast-db-query-wrap {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #ffffff;
}

.ast-db-query-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 3px solid #c8102e; /* Racing red accent */
    color: #ffffff;
}

/* ============================================
   SECTIONS & FORM ELEMENTS
   ============================================ */
.ast-db-query-section {
    margin-bottom: 20px;
}

.ast-db-query-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ast-db-query-select {
    width: 100%;
    max-width: 500px;
    padding: 10px 14px;
    font-size: 14px;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    background-color: #1a1a2e !important;
    color: #ffffff !important;
    cursor: pointer;
    transition: border-color 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23ffffff' stroke-width='2' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.ast-db-query-select option,
.ast-db-query-select optgroup {
    background-color: #1a1a2e !important;
    color: #ffffff !important;
}

.ast-db-query-select:focus {
    border-color: #c8102e;
    outline: none;
    box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.15);
}

.ast-db-query-select optgroup {
    font-weight: 700;
    font-style: normal;
    color: #ff6b6b !important;
}

/* ============================================
   FILTER FIELDS
   ============================================ */
#ast-db-filter-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

#ast-db-filter-fields .ast-db-filter-group {
    flex: 1 1 220px;
    min-width: 200px;
    max-width: 280px;
}

#ast-db-filter-fields .ast-db-filter-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #cccccc;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

#ast-db-filter-fields .ast-db-filter-group select {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    background-color: #1a1a2e !important;
    color: #ffffff !important;
    cursor: pointer;
    transition: border-color 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23ffffff' stroke-width='2' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

#ast-db-filter-fields .ast-db-filter-group select option {
    background-color: #1a1a2e !important;
    color: #ffffff !important;
}

#ast-db-filter-fields .ast-db-filter-group select:focus {
    border-color: #c8102e;
    outline: none;
    box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.15);
}

/* ============================================
   BUTTON
   ============================================ */
.ast-db-query-button {
    display: inline-block;
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background-color: #c8102e;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ast-db-query-button:hover {
    background-color: #a00d24;
    transform: translateY(-1px);
}

.ast-db-query-button:active {
    transform: translateY(0);
}

.ast-db-query-button:disabled {
    background-color: #999;
    cursor: not-allowed;
    transform: none;
}

.ast-db-loading {
    display: inline-block;
    margin-left: 12px;
    font-size: 14px;
    color: #cccccc;
    font-style: italic;
}

.ast-db-loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #ccc;
    border-top-color: #c8102e;
    border-radius: 50%;
    animation: ast-spin 0.6s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes ast-spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   RESULTS
   ============================================ */
.ast-db-results-title {
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 4px;
}

.ast-db-results-info {
    font-size: 13px;
    color: #cccccc;
    margin-bottom: 16px;
}

.ast-db-results-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.ast-db-results-table {
    width: 100%;
    min-width: 700px;
    border-collapse: collapse;
    font-size: 14px;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    table-layout: auto;
}

.ast-db-results-table thead th {
    background-color: #1a1a2e;
    color: #fff;
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.ast-db-results-table thead th:first-child {
    text-align: center;
    width: 50px;
}

.ast-db-results-table tbody tr {
    border-bottom: 1px solid #eee;
    transition: background-color 0.15s ease;
}

.ast-db-results-table tbody tr:hover {
    background-color: #f8f4f5;
}

.ast-db-results-table tbody tr:nth-child(even) {
    background-color: #fafafa;
}

.ast-db-results-table tbody tr:nth-child(even):hover {
    background-color: #f8f4f5;
}

.ast-db-results-table tbody td {
    padding: 10px 14px;
}

.ast-db-results-table tbody td:first-child {
    text-align: center;
    font-weight: 700;
    color: #888;
}

/* Highlight top 3 */
.ast-db-results-table tbody tr:nth-child(1) td:first-child { color: #FFD700; }
.ast-db-results-table tbody tr:nth-child(2) td:first-child { color: #C0C0C0; }
.ast-db-results-table tbody tr:nth-child(3) td:first-child { color: #CD7F32; }

/* No results message */
.ast-db-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #cccccc;
    font-size: 16px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    border: 2px dashed rgba(255,255,255,0.2);
}

/* Error message */
.ast-db-error {
    padding: 12px 16px;
    background-color: #fef0f0;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    color: #721c24;
    font-size: 14px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .ast-db-query-wrap {
        padding: 12px;
    }

    .ast-db-query-select {
        max-width: 100%;
    }

    #ast-db-filter-fields {
        flex-direction: column;
    }

    #ast-db-filter-fields .ast-db-filter-group {
        max-width: 100%;
    }

    .ast-db-results-table {
        font-size: 12px;
        min-width: 500px;
    }

    .ast-db-results-table thead th,
    .ast-db-results-table tbody td {
        padding: 8px 8px;
    }
}
