/* Reset & Base */
*, *::before, *::after { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body { 
    font-family: monospace; 
    font-size: 14px; 
    background: #1c1c1c; 
    color: #eee; 
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 860px;
    margin: 0 auto;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 2px solid #3d3d3d;
    margin-bottom: 20px;
}

h1 {
    margin: 0;
    color: #eee;
    font-size: 1.25rem;
}

.header-controls {
    display: flex;
    gap: 20px;
    align-items: center;
}

.control-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.control-group label {
    color: #888;
    font-size: 0.95em;
}

h2 {
    margin: 30px 0 20px 0;
    color: #eee;
    font-size: 1.1rem;
}

/* Game & IV Buttons */
.game-btn,
.iv-btn {
    padding: 6px 14px;
    font-family: monospace;
    font-size: 13px;
    cursor: pointer;
    border: 2px solid #2a2a2a;
    background: #3d3d3d;
    color: #eee;
    transition: all 0.15s;
}

.game-btn:hover,
.iv-btn:hover {
    background: #2a2a2a;
    border-color: #00d9ff;
    color: #00d9ff;
}

.game-btn.active,
.iv-btn.active {
    background: #2a2a2a;
    color: #00d9ff;
    border-color: #00d9ff;
}

/* Input Section */
.input-section {
    background-color: #2a2a2a;
    padding: 25px;
    border: 2px solid #3d3d3d;
    margin-bottom: 30px;
}

.search-set {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #3d3d3d;
}

.search-set:last-of-type {
    border-bottom: none;
    margin-bottom: 15px;
}

.search-set h3 {
    color: #00d9ff;
    margin-bottom: 15px;
    font-size: 1em;
}

.input-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.input-group {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.input-group label {
    margin-bottom: 5px;
    color: #888;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.input-group input {
    padding: 8px 10px;
    background: #3d3d3d;
    border: 1px solid #2a2a2a;
    color: #eee;
    font-size: 13px;
    font-family: monospace;
    outline: none;
}

.input-group input:focus {
    border-color: #00d9ff;
}

.input-group input::placeholder {
    color: #555;
}

/* Custom Autocomplete Dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #2a2a2a;
    border: 1px solid #3d3d3d;
    border-top: none;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: -1px;
}

.autocomplete-item {
    padding: 6px 10px;
    color: #eee;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid #3d3d3d;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background-color: #3d3d3d;
}

.autocomplete-dropdown::-webkit-scrollbar {
    width: 5px;
}

.autocomplete-dropdown::-webkit-scrollbar-track {
    background: #1c1c1c;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: #3d3d3d;
}

/* Buttons */
.button-row {
    display: flex;
    gap: 15px;
    justify-content: center;
}

button {
    padding: 7px 18px;
    background: #3d3d3d;
    border: 2px solid #00d9ff;
    color: #00d9ff;
    font-family: monospace;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

button:hover {
    background: rgba(0, 217, 255, 0.1);
}

#clearBtn {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

#clearBtn:hover {
    background: rgba(255, 107, 107, 0.1);
}

/* Results Section */
.results-section {
    min-height: 100px;
}

.search-results-section {
    margin-bottom: 40px;
}

.search-results-section:last-child {
    margin-bottom: 0;
}

.search-criteria {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 8px 12px;
    background-color: #3d3d3d;
    border: 2px solid #3d3d3d;
    flex-wrap: wrap;
    font-size: 12px;
}

.search-criteria span {
    color: #888;
}

.no-results {
    text-align: center;
    color: #888;
    font-style: italic;
    padding: 40px;
}

.pokemon-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Pokemon Card */
.pokemon-row {
    background-color: #2a2a2a;
    border: 2px solid #3d3d3d;
    padding: 0;
    display: flex;
    gap: 0;
    transition: border-color 0.2s;
    animation: fadeUp 0.2s ease;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pokemon-row:hover {
    border-color: #00d9ff;
}

.pokemon-image {
    flex-shrink: 0;
    width: 100px;
    background: #3d3d3d;
    border-right: 2px solid #3d3d3d;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.pokemon-sprite {
    width: 80px;
    height: 80px;
    image-rendering: pixelated;
    object-fit: contain;
}

.image-placeholder {
    width: 80px;
    height: 80px;
    background-color: #2a2a2a;
    border: 1px dashed #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    color: #555;
}

.pokemon-info {
    flex: 1;
    padding: 10px 14px;
}

.pokemon-header {
    display: flex;
    align-items: baseline;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #3d3d3d;
}

.pokemon-name {
    font-size: 1.1em;
    font-weight: bold;
    color: #eee;
}

.pokemon-count {
    font-size: 1em;
    color: #00d9ff;
}

.pokemon-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-item {
    display: flex;
    gap: 10px;
    font-size: 13px;
}

.detail-item.moves {
    flex-direction: column;
}

.detail-label {
    color: #888;
    min-width: 80px;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.06em;
}

.detail-value {
    color: #eee;
}

.moves-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: 0;
}

.move {
    background-color: #3d3d3d;
    padding: 4px 10px;
    color: #eee;
    font-size: 12px;
    border: 1px solid #2a2a2a;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .header-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .input-row {
        flex-direction: column;
    }
    
    .input-group {
        min-width: 100%;
    }
    
    .button-row {
        flex-direction: column;
    }
    
    .button-row button {
        width: 100%;
    }
    
    .pokemon-row {
        flex-direction: column;
    }
    
    .pokemon-image {
        width: 100%;
        border-right: none;
        border-bottom: 2px solid #3d3d3d;
    }
    
    .search-criteria {
        flex-direction: column;
        gap: 5px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: #1c1c1c;
}

::-webkit-scrollbar-thumb {
    background: #3d3d3d;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* =====================
   Trainer Lookup
   ===================== */

#find-trainers-btn {
    border-color: #ffd700;
    color: #ffd700;
}

#find-trainers-btn:hover {
    background: rgba(255, 215, 0, 0.1);
}

#trainer-lookup-section {
    margin-bottom: 30px;
}

.trainer-lookup {
    background-color: #2a2a2a;
    border: 2px solid #3d3d3d;
    padding: 25px;
}

.trainer-lookup h2 {
    margin: 0 0 8px 0;
    color: #eee;
    font-size: 1.1rem;
}

.lookup-subtitle {
    color: #888;
    font-size: 12px;
    margin-bottom: 20px;
}

.lookup-subtitle strong {
    color: #ffd700;
}

/* Trainer Group */
.trainer-group {
    border: 1px solid #3d3d3d;
    margin-bottom: 10px;
}

.trainer-group:last-child {
    margin-bottom: 0;
}

.trainer-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #3d3d3d;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.trainer-group-header:hover {
    background: #484848;
}

.trainer-group-header.auto-expanded {
    cursor: default;
    background: #3d3d3d;
    border-bottom: 1px solid #555;
}

.trainer-group-header.auto-expanded:hover {
    background: #3d3d3d;
}

.toggle-arrow {
    color: #ffd700;
    font-size: 11px;
    width: 12px;
    flex-shrink: 0;
}

.trainer-names {
    color: #ffd700;
    font-weight: bold;
    font-size: 13px;
    flex: 1;
}

.trainer-class {
    color: #888;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.candidate-count {
    color: #ffd700;
    font-size: 11px;
    flex-shrink: 0;
}

/* Trainer Candidates Panel */
.trainer-candidates {
    padding: 20px;
    background: #252525;
}

.trainer-candidates h3 {
    color: #00d9ff;
    font-size: 0.95em;
    margin-bottom: 15px;
}

/* Select Button (on Search 1 & 2 cards) */
.select-btn {
    padding: 3px 10px;
    font-size: 11px;
    border: 1px solid #555;
    color: #888;
    background: transparent;
    cursor: pointer;
    margin-left: auto;
    transition: all 0.15s;
}

.select-btn:hover {
    border-color: #00d9ff;
    color: #00d9ff;
    background: transparent;
}

.select-btn.selected {
    border-color: #00d9ff;
    color: #00d9ff;
    background: rgba(0, 217, 255, 0.08);
}

/* Alarm Badge */
.alarm-badge {
    font-size: 11px;
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    padding: 3px 8px;
    margin-bottom: 8px;
    display: inline-block;
}

/* Candidate Filter */
.candidate-filter-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.candidate-filter {
    flex: 1;
    padding: 7px 10px;
    background: #3d3d3d;
    border: 1px solid #555;
    color: #eee;
    font-family: monospace;
    font-size: 13px;
    outline: none;
}

.candidate-filter:focus {
    border-color: #00d9ff;
}

.candidate-filter::placeholder {
    color: #555;
}

.candidate-filter-count {
    color: #555;
    font-size: 11px;
    white-space: nowrap;
}

/* HP filter input */
.candidate-filter-hp {
    width: 80px;
    padding: 7px 10px;
    background: #3d3d3d;
    border: 1px solid #555;
    color: #eee;
    font-family: monospace;
    font-size: 13px;
    outline: none;
}

.candidate-filter-hp:focus {
    border-color: #00d9ff;
}

.candidate-filter-hp::placeholder {
    color: #555;
}

/* Remove number input arrows */
.candidate-filter-hp::-webkit-outer-spin-button,
.candidate-filter-hp::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Trainer lookup header row */
.trainer-lookup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.trainer-lookup-header h2 {
    margin: 0;
}

#undo-trainer-btn {
    border-color: #ff6b6b;
    color: #ff6b6b;
    font-size: 12px;
    padding: 5px 12px;
}

#undo-trainer-btn:hover {
    background: rgba(255, 107, 107, 0.1);
}
