/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-color: #f5f5f5;
    --text-color: #333;
    --header-gradient-start: #667eea;
    --header-gradient-end: #764ba2;
    --card-bg: white;
    --border-color: #ddd;
    --button-bg: #e9ecef;
    --button-border: #dee2e6;
    --button-active-start: #667eea;
    --button-active-end: #764ba2;
    --hover-bg: #f8f9fa;
    --shadow-color: rgba(0,0,0,0.1);
    --accent-color: #6f42c1;
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --header-gradient-start: #4a5568;
    --header-gradient-end: #2d3748;
    --card-bg: #2d3748;
    --border-color: #4a5568;
    --button-bg: #2d3748;
    --button-border: #4a5568;
    --button-active-start: #4a5568;
    --button-active-end: #2d3748;
    --hover-bg: #4a5568;
    --shadow-color: rgba(0,0,0,0.5);
    --accent-color: #60a5fa;
}

body {
    font-family: Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

/* Dark Mode Toggle */
.dark-mode-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 25px;
    padding: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.theme-slider {
    position: relative;
    width: 80px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5px;
}

.theme-icon {
    width: 30px;
    height: 30px;
    object-fit: contain;
    z-index: 2;
    transition: opacity 0.3s;
}

.theme-slider-bg {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 36px;
    height: 36px;
    background: #888;
    border-radius: 50%;
    transition: transform 0.3s ease;
    z-index: 1;
}

[data-theme="dark"] .theme-slider-bg {
    transform: translateX(40px);
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--header-gradient-start) 0%, var(--header-gradient-end) 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

.header h1 {
    margin-bottom: 10px;
}

/* Tab Navigation */
.tab-nav {
    background: var(--card-bg);
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: center;
    gap: 0;
}

.tab-button {
    background: var(--card-bg);
    border: none;
    padding: 15px 30px;
    cursor: pointer;
    font-size: 16px;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    color: var(--text-color);
}

.tab-button:hover {
    background: var(--hover-bg);
}

.tab-button.active {
    border-bottom: 3px solid #764ba2;
    color: #764ba2;
    font-weight: bold;
}

.tab-content {
    display: none;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.tab-content.active {
    display: block;
}

/* Data Selector */
.data-selector, .search-controls {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px var(--shadow-color);
}

.data-selector h3, .search-controls h3 {
    margin-bottom: 15px;
    color: var(--text-color);
}

.selector-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.data-button {
    background: var(--button-bg);
    border: 2px solid var(--button-border);
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    color: var(--text-color);
}

.data-button:hover {
    background: var(--hover-bg);
}

.data-button.active {
    background: linear-gradient(135deg, var(--button-active-start) 0%, var(--button-active-end) 100%);
    color: white;
    border-color: #764ba2;
}

/* Status Messages */
.status {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: center;
}

.status.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

[data-theme="dark"] .status.info {
    background-color: #1a4d5a;
    color: #7dd3e8;
    border: 1px solid #2d6a7a;
}

.status.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

[data-theme="dark"] .status.success {
    background-color: #1a4d2e;
    color: #7dd39f;
    border: 1px solid #2d6a4a;
}

.status.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

[data-theme="dark"] .status.error {
    background-color: #5a1a1d;
    color: #f8a5aa;
    border: 1px solid #7a2d31;
}

/* Overview Grid */
.overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.top-sets, .bottom-sets, .teams-section, .matchup-results {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px var(--shadow-color);
}

.teams-section {
    margin-top: 20px;
}

.top-sets h3 {
    color: #28a745;
    margin-bottom: 15px;
}

.bottom-sets h3 {
    color: #dc3545;
    margin-bottom: 15px;
}

.teams-section h3 {
    color: var(--accent-color);
    margin-bottom: 15px;
}

/* Set Lists */
.set-list {
    list-style: none;
}

.set-item {
    display: block;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.set-item:last-child {
    border-bottom: none;
}

.set-name {
    font-weight: 500;
    cursor: pointer;
    color: #667eea;
    transition: color 0.2s;
}

.set-name:hover {
    color: #764ba2;
    text-decoration: underline;
}

.set-score {
    font-weight: bold;
    color: var(--accent-color);
}

/* Details Sections */
.set-details, .team-details {
    padding: 15px;
    background: var(--hover-bg);
    border-radius: 5px;
    margin-top: 8px;
    display: none;
    font-size: 14px;
}

.set-details.expanded, .team-details.expanded {
    display: block;
}

.set-details-row, .team-pokemon-card div {
    margin-bottom: 8px;
}

.set-details-label, .team-pokemon-name {
    font-weight: bold;
    color: var(--accent-color);
}

/* Team Details */
.team-pokemon-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.team-pokemon-card {
    background: var(--card-bg);
    padding: 10px;
    border-radius: 5px;
    font-size: 13px;
}

.team-pokemon-name {
    margin-bottom: 5px;
}

.team-variants {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid var(--button-border);
}

.team-variants-title {
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 8px;
}

.team-variant-item {
    padding: 5px 0;
    font-size: 13px;
}

/* Search Components */
.search-input-container, .filter-input-container {
    position: relative;
    margin-top: 15px;
}

.search-input {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 16px;
    background: var(--card-bg);
    color: var(--text-color);
}

.dropdown, .filter-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 5px 5px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.dropdown-item {
    padding: 10px;
    cursor: pointer;
    transition: background-color 0.2s;
    color: var(--text-color);
}

.dropdown-item:hover {
    background-color: var(--hover-bg);
}

/* Matchup Display */
.set-info-header {
    background: var(--hover-bg);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.set-info-details {
    flex: 1;
}

.set-info-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 10px;
}

.set-info-row {
    margin: 5px 0;
    font-size: 14px;
}

.set-info-label {
    font-weight: bold;
    color: var(--accent-color);
}

/* Filter Controls */
.filter-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 250px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-label {
    font-size: 12px;
    font-weight: bold;
    color: #666;
}

[data-theme="dark"] .filter-label {
    color: #999;
}

.filter-select {
    padding: 8px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 14px;
    background: var(--card-bg);
    color: var(--text-color);
}

/* Matchup Groups */
.matchup-group {
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--hover-bg);
}

.matchup-group-header {
    padding: 12px 15px;
    font-weight: bold;
    color: white;
}

.matchup-group-header.very-favorable {
    background: #28a745;
}

.matchup-group-header.favorable {
    background: #5cb85c;
}

.matchup-group-header.neutral {
    background: #ffc107;
    color: #333;
}

.matchup-group-header.unfavorable {
    background: #fd7e14;
}

.matchup-group-header.very-unfavorable {
    background: #dc3545;
}

.matchup-list {
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.matchup-list-item {
    display: inline-flex;
    align-items: center;
    background: var(--card-bg);
    padding: 6px 10px;
    border-radius: 5px;
    font-size: 14px;
    white-space: nowrap;
    border: 1px solid var(--button-border);
}

.matchup-opponent {
    margin-right: 6px;
}

.matchup-score {
    font-weight: bold;
    color: var(--accent-color);
}

/* Draft Components */
.draft-slots-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.draft-slot {
    background: var(--hover-bg);
    padding: 15px;
    border-radius: 8px;
    border: 2px solid var(--button-border);
}

.draft-slot-label {
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 8px;
}

.draft-slot-search {
    position: relative;
    margin-bottom: 8px;
}

.draft-slot-iv {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.draft-slot-iv-label {
    font-size: 14px;
    font-weight: bold;
    color: #666;
}

[data-theme="dark"] .draft-slot-iv-label {
    color: #999;
}

.draft-slot-iv-select {
    flex: 1;
    padding: 6px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 14px;
    background: var(--card-bg);
    color: var(--text-color);
}

.draft-slot-iv-display {
    flex: 1;
    padding: 6px;
    background: var(--button-bg);
    border: 2px solid var(--button-border);
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
    color: var(--accent-color);
}

/* Draft Results */
.draft-results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.draft-result-card {
    background: var(--hover-bg);
    padding: 15px;
    border-radius: 8px;
    border: 2px solid var(--button-border);
}

.draft-result-name {
    font-weight: bold;
    color: var(--accent-color);
    font-size: 16px;
    margin-bottom: 8px;
}

.draft-result-info {
    font-size: 12px;
    color: var(--text-color);
    margin: 8px 0;
}

.draft-result-info div {
    margin-bottom: 4px;
}

.draft-result-average-display {
    font-size: 14px;
    color: #28a745;
    margin-top: 8px;
    font-weight: bold;
}

.draft-result-average {
    font-size: 24px;
    font-weight: bold;
    color: #28a745;
}

/* Draft Team Combinations */
#draft-results-content h4 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--accent-color);
}

.draft-teams-list {
    background: var(--hover-bg);
    padding: 15px;
    border-radius: 8px;
}

.draft-team-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--button-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.draft-team-item:last-child {
    border-bottom: none;
}

.draft-team-name {
    font-weight: 500;
    color: var(--text-color);
}

.draft-team-score {
    font-weight: bold;
    color: var(--accent-color);
    font-size: 16px;
}

/* Swap Components */
.swap-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.swap-team {
    background: var(--hover-bg);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid var(--button-border);
}

.swap-team-title {
    font-weight: bold;
    font-size: 18px;
    color: var(--accent-color);
    margin-bottom: 15px;
}

.swap-opponent-controls {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.swap-opponent-search {
    flex: 1;
    position: relative;
}

.swap-set-selector {
    width: 150px;
}

/* Set Checkbox Dropdown */
.set-checkbox-dropdown {
    position: relative;
}

.set-checkbox-button {
    width: 100%;
    padding: 8px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    background: var(--card-bg);
    cursor: pointer;
    text-align: left;
    color: var(--text-color);
}

.set-checkbox-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 5px;
    margin-top: 2px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.set-checkbox-menu.show {
    display: block;
}

.set-checkbox-item {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-color);
}

.set-checkbox-item:hover {
    background: var(--hover-bg);
}

.set-checkbox-item input[type="checkbox"] {
    cursor: pointer;
}

/* Swap Results */
.swap-results-list {
    background: var(--hover-bg);
    padding: 15px;
    border-radius: 8px;
}

.swap-result-item {
    padding: 12px;
    border-bottom: 1px solid var(--button-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.swap-result-item:last-child {
    border-bottom: none;
}

.swap-result-description {
    flex: 1;
}

.swap-result-score {
    font-weight: bold;
    color: var(--accent-color);
    font-size: 16px;
    margin-left: 15px;
}

/* Quick Team Input */
.quick-team-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 15px;
    background: var(--hover-bg);
    border-radius: 8px;
}

.quick-team-label {
    font-weight: bold;
    white-space: nowrap;
}

.quick-team-input {
    flex: 1;
    padding: 8px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 14px;
    background: var(--card-bg);
    color: var(--text-color);
}

.quick-team-button {
    padding: 8px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
}

.quick-team-button:hover {
    opacity: 0.9;
}

/* About Section */
.about-content {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 2px 5px var(--shadow-color);
    line-height: 1.6;
}

.about-content h2 {
    color: var(--accent-color);
    margin-bottom: 20px;
}

.about-content h3 {
    color: var(--accent-color);
    margin-top: 30px;
    margin-bottom: 15px;
}

.about-content p {
    margin-bottom: 15px;
    color: var(--text-color);
}

.about-content a {
    color: #667eea;
    text-decoration: none;
}

.about-content a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.about-links {
    list-style: none;
    padding-left: 0;
}

.about-links li {
    margin-bottom: 10px;
}

/* Utility Classes */
.placeholder {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 2px 5px var(--shadow-color);
    text-align: center;
    color: #666;
}

.hidden {
    display: none;
}