/* Pokemon Team Builder - Mobile First Design */
:root {
    --primary-color: #3b82f6;
    --secondary-color: #1e40af;
    --accent-color: #f59e0b;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;

    /* Type Colors */
    --type-normal: #a8a878;
    --type-fire: #f08030;
    --type-water: #6890f0;
    --type-electric: #f8d030;
    --type-grass: #78c850;
    --type-ice: #98d8d8;
    --type-fighting: #c03028;
    --type-poison: #a040a0;
    --type-ground: #e0c068;
    --type-flying: #a890f0;
    --type-psychic: #f85888;
    --type-bug: #a8b820;
    --type-rock: #b8a038;
    --type-ghost: #705898;
    --type-dragon: #7038f8;
    --type-dark: #705848;
    --type-steel: #b8b8d0;
    --type-fairy: #ee99ac;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
        Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
}

.app-container {
    max-width: 100vw;
    min-height: 100vh;
    padding: 0;
    overflow-x: hidden;
}

/* Header */
.app-header {
    background: linear-gradient(
        135deg,
        var(--primary-color),
        var(--secondary-color)
    );
    color: white;
    padding: 2rem 1rem 1.5rem 1rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    position: sticky;
    top: 0;
    z-index: 100;
    border-radius: 0 0 1rem 1rem;
    margin: 0 1rem;
}

.app-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Header Navigation */
.header-nav {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
}

.nav-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: nowrap;
    flex: 1;
    align-items: stretch;
}

.nav-btn {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.3);
    min-width: 0;
    justify-content: center;
    flex: 0 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 100%;
    box-sizing: border-box;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.nav-btn.active {
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
    font-weight: bold;
}

.generation-selector {
    width: 100%;
    margin-top: 0.5rem;
}

.generation-selector select {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 0.75rem;
    border: none;
    border-radius: 0.5rem;
    background-color: rgba(255, 255, 255, 0.2);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='white' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    color: white;
    font-size: 0.9rem;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
}

.generation-selector select option {
    background: var(--surface-color);
    color: var(--text-primary);
}

/* Sections */
section {
    padding: 1rem;
    margin: 0 auto 1rem;
    width: calc(100% - 2rem);
    max-width: calc(100% - 2rem);
    box-sizing: border-box;
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Pokemon Search */
.pokemon-search {
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    border-radius: 0 0 1rem 1rem;
    margin-top: -1rem;
    padding-top: 1.5rem;
    padding-bottom: 0.5rem;
    position: relative;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.search-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Search Input Wrapper for Clear Button */
.search-input-wrapper {
    position: relative;
    flex: 1;
}

.search-input-wrapper input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 0.75rem; /* Extra right padding for clear button */
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.search-input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Clear Button - More specific selector to override search-container button styles */
.search-input-wrapper .clear-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: #f3f4f6 !important;
    border: none;
    color: #6b7280 !important;
    cursor: pointer;
    padding: 0.25rem !important;
    border-radius: 50% !important;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem !important;
    height: 1.5rem !important;
    transition: opacity 0.2s, visibility 0.2s, color 0.2s, background-color 0.2s;
    opacity: 0;
    visibility: hidden;
    font-size: 0.75rem;
}

.search-input-wrapper .clear-btn:hover {
    color: #4b5563 !important;
    background-color: #e5e7eb !important;
}

.search-input-wrapper .clear-btn:active {
    color: #374151 !important;
    background-color: #d1d5db !important;
}

/* Show clear button when input has content */
.search-input-wrapper.has-content .clear-btn {
    opacity: 1;
    visibility: visible;
}

.search-container button {
    padding: 0.75rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.search-container button:hover {
    background: var(--secondary-color);
}

.search-results {
    max-height: 300px;
    overflow-y: auto;
    border-radius: 0.5rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    display: none;
}

.search-results.show {
    display: block;
}

.search-result-item {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: background-color 0.2s;
}

.search-result-item:hover {
    background: var(--background-color);
}

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

.pokemon-sprite {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.pokemon-info h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    text-transform: capitalize;
}

.pokemon-types {
    display: flex;
    gap: 0.25rem;
}

.type-badge {
    padding: 0.2rem 0.4rem;
    border-radius: 0.8rem;
    font-size: 0.65rem;
    font-weight: bold;
    color: white;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    height: 1.3rem;
    box-sizing: border-box;
    line-height: 1.2;
}

.type-icon {
    width: 16px;
    height: 16px;
}

/* Type Colors */
.type-normal {
    background-color: var(--type-normal);
}
.type-fire {
    background-color: var(--type-fire);
}
.type-water {
    background-color: var(--type-water);
}
.type-electric {
    background-color: var(--type-electric);
}
.type-grass {
    background-color: var(--type-grass);
}
.type-ice {
    background-color: var(--type-ice);
}
.type-fighting {
    background-color: var(--type-fighting);
}
.type-poison {
    background-color: var(--type-poison);
}
.type-ground {
    background-color: var(--type-ground);
}
.type-flying {
    background-color: var(--type-flying);
}
.type-psychic {
    background-color: var(--type-psychic);
}
.type-bug {
    background-color: var(--type-bug);
}
.type-rock {
    background-color: var(--type-rock);
}
.type-ghost {
    background-color: var(--type-ghost);
}
.type-dragon {
    background-color: var(--type-dragon);
}
.type-dark {
    background-color: var(--type-dark);
}
.type-steel {
    background-color: var(--type-steel);
}
.type-fairy {
    background-color: var(--type-fairy);
}

/* Team Section */
.team-section {
    background: var(--surface-color);
    overflow-x: hidden;
    width: 100%;
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.team-slot {
    aspect-ratio: 1;
    border: 2px dashed var(--border-color);
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    background: var(--background-color);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

.team-slot.empty {
    color: var(--text-secondary);
}

.team-slot.empty:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.team-slot.filled {
    border: 2px solid var(--border-color);
    background: var(--surface-color);
    padding: 0.5rem;
}

.team-slot .pokemon-sprite {
    width: 80px;
    height: 80px;
    margin-bottom: 0.5rem;
}

.team-slot .pokemon-name {
    font-weight: bold;
    font-size: 0.9rem;
    text-transform: capitalize;
    margin-bottom: 0.25rem;
}

.team-slot .remove-btn {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

/* Action Menu */
.action-menu-container {
    position: absolute;
    top: 0.25rem;
    left: 0.25rem;
    z-index: 10;
}

.action-menu-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.action-menu-btn:hover {
    background: #d97706;
    transform: scale(1.1);
}

.action-menu-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    overflow: hidden;
}

.action-menu-dropdown.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.action-menu-item {
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid var(--border-color);
}

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

.action-menu-item:hover {
    background: var(--background-color);
}

.action-menu-item i {
    font-size: 1rem;
    width: 16px;
    text-align: center;
    color: var(--primary-color);
}

.action-menu-item span {
    flex: 1;
}

.team-slot.menu-open {
    z-index: 5;
}

/* Type Coverage */
.type-coverage-section {
    background: var(--surface-color);
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.type-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 0.5rem;
}

.type-coverage-item {
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
    overflow: hidden;
}

.coverage-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.75rem 0.5rem;
    border-radius: 0.5rem 0.5rem 0 0;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Type-colored headers */
.coverage-header.type-normal {
    background-color: var(--type-normal);
    color: white;
}
.coverage-header.type-fire {
    background-color: var(--type-fire);
    color: white;
}
.coverage-header.type-water {
    background-color: var(--type-water);
    color: white;
}
.coverage-header.type-electric {
    background-color: var(--type-electric);
    color: black;
}
.coverage-header.type-grass {
    background-color: var(--type-grass);
    color: white;
}
.coverage-header.type-ice {
    background-color: var(--type-ice);
    color: black;
}
.coverage-header.type-fighting {
    background-color: var(--type-fighting);
    color: white;
}
.coverage-header.type-poison {
    background-color: var(--type-poison);
    color: white;
}
.coverage-header.type-ground {
    background-color: var(--type-ground);
    color: black;
}
.coverage-header.type-flying {
    background-color: var(--type-flying);
    color: white;
}
.coverage-header.type-psychic {
    background-color: var(--type-psychic);
    color: white;
}
.coverage-header.type-bug {
    background-color: var(--type-bug);
    color: white;
}
.coverage-header.type-rock {
    background-color: var(--type-rock);
    color: white;
}
.coverage-header.type-ghost {
    background-color: var(--type-ghost);
    color: white;
}
.coverage-header.type-dragon {
    background-color: var(--type-dragon);
    color: white;
}
.coverage-header.type-dark {
    background-color: var(--type-dark);
    color: white;
}
.coverage-header.type-steel {
    background-color: var(--type-steel);
    color: black;
}
.coverage-header.type-fairy {
    background-color: var(--type-fairy);
    color: white;
}

.type-coverage-item .type-name {
    font-size: 1rem;
    font-weight: bold;
    text-transform: capitalize;
}

.coverage-header .type-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.coverage-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
}

.coverage-pokemon-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--surface-color);
    border-radius: 0.25rem;
    border: 1px solid var(--border-color);
    min-width: 0;
    overflow: hidden;
    min-height: 80px;
}

.coverage-pokemon-icon {
    width: 55px;
    height: 55px;
    min-width: 55px;
    min-height: 55px;
    max-width: 55px;
    max-height: 55px;
    object-fit: contain;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
    margin: 0;
}

.coverage-pokemon-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    flex-shrink: 0;
    min-width: 80px;
}

.coverage-pokemon-right {
    flex: 1;
    display: flex;
    align-items: flex-start;
    padding-left: 0.5rem;
    min-width: 0;
}

.coverage-pokemon-name {
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: capitalize;
    text-align: left;
    width: 100%;
    line-height: 1.2;
}

.coverage-pokemon-reasons {
    font-size: 0.75rem;
    color: var(--text-primary);
    line-height: 1.4;
    font-weight: 500;
    white-space: pre-line;
    text-align: left;
    width: 100%;
}

.no-coverage {
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-align: center;
    font-style: italic;
}

/* Stats Section */
.stats-section {
    background: var(--surface-color);
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.stats-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--background-color);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.stats-controls label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.stats-controls select {
    padding: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    background: var(--surface-color);
}

.stats-controls select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.stats-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--background-color);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.stat-row:hover {
    background: var(--surface-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.stat-arrow {
    font-size: 1.5rem;
    min-width: 40px;
    text-align: center;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-arrow.arrow-up {
    color: #22c55e;
}

.stat-arrow.arrow-down {
    color: #ef4444;
}

.stat-arrow.arrow-neutral {
    color: #6b7280;
}

.stat-pokemon-sprite {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 50%;
    border: 2px solid var(--border-color);
}

.stat-pokemon-info {
    flex: 1;
    min-width: 0;
}

.stat-pokemon-name {
    font-size: 1.1rem;
    font-weight: bold;
    text-transform: capitalize;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.stat-pokemon-types {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-primary);
    min-width: 60px;
    text-align: right;
}

.no-stats {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 2rem;
    background: var(--background-color);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

/* Battle Section */
.battle-section {
    border-radius: 1rem;
    background: var(--surface-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.opponent-search {
    margin-bottom: 1rem;
}

/* Opponent search uses the same wrapper styling as other search inputs */

.battle-recommendations {
    background: var(--background-color);
    border-radius: 0.5rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
}

.opponent-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--surface-color);
    border-radius: 0.5rem;
    border: 2px solid var(--primary-color);
}

.opponent-sprite {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.opponent-info h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    text-transform: capitalize;
    color: var(--text-primary);
}

.opponent-types {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.recommendation-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--surface-color);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-color);
}

.recommendation-item:last-child {
    margin-bottom: 0;
}

.recommendation-score {
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: bold;
    min-width: fit-content;
}

.recommendation-score.success {
    background: var(--success-color);
}

.recommendation-score.danger {
    background: var(--danger-color);
}

.recommendation-score.warning {
    background: var(--warning-color);
}

.recommendation-reason {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.immunity-highlight {
    color: var(--primary-color);
    font-weight: bold;
}

.super-effective-highlight {
    color: var(--success-color);
    font-weight: bold;
}

.resistance-highlight {
    color: var(--warning-color);
    font-weight: bold;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
}

.loading-spinner i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Responsive Design */
@media (min-width: 480px) {
    .team-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .type-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .type-coverage-item {
        padding: 0;
    }

    .coverage-pokemon-icon {
    }

    .coverage-pokemon-left {
        min-width: 70px;
    }

    .stats-controls {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .stats-controls > div {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }
}

@media (min-width: 640px) {
    .team-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 100%;
        margin: 0 auto;
        width: 100%;
    }
}

@media (min-width: 768px) {
    .app-container {
        max-width: 768px;
        margin: 0 auto;
    }

    .app-header {
        margin: 0;
    }

    .header-nav {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 2rem;
    }

    .header-nav h1 {
        margin: 0;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .nav-buttons-wrapper {
        justify-content: flex-end;
        order: 2;
    }

    .nav-buttons {
        justify-content: flex-end;
    }

    .generation-selector {
        margin-top: 1rem;
    }

    .team-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 100%;
        margin: 0 auto;
        width: 100%;
    }

    .type-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .coverage-pokemon-icon {
    }

    .coverage-pokemon-left {
        min-width: 65px;
    }

    section {
        padding: 1.5rem;
        background: var(--surface-color);
        margin: 1rem auto;
        border-radius: 1rem;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
        width: calc(100% - 2rem);
        max-width: calc(100% - 2rem);
        box-sizing: border-box;
    }
}

@media (min-width: 1024px) {
    .app-container {
        max-width: 1200px;
    }

    .team-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 100%;
        margin: 0 auto;
        width: 100%;
    }

    .type-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .coverage-pokemon-icon {
    }

    .coverage-pokemon-left {
        min-width: 70px;
    }
}

@media (min-width: 1200px) {
    .app-container {
        max-width: 1400px;
    }

    .team-grid {
        grid-template-columns: repeat(6, 1fr);
        max-width: 100%;
        margin: 0 auto;
        gap: 1.5rem;
        width: 100%;
    }

    .team-slot {
        min-width: 0;
    }

    .coverage-pokemon-icon {
    }

    .coverage-pokemon-left {
        min-width: 75px;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: 0.25rem;
}
.mt-2 {
    margin-top: 0.5rem;
}
.mt-3 {
    margin-top: 0.75rem;
}
.mt-4 {
    margin-top: 1rem;
}

.mb-1 {
    margin-bottom: 0.25rem;
}
.mb-2 {
    margin-bottom: 0.5rem;
}
.mb-3 {
    margin-bottom: 0.75rem;
}
.mb-4 {
    margin-bottom: 1rem;
}

.no-opponent {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

/* Reset Section */
.reset-section {
    background: var(--surface-color);
    text-align: center;
    margin-top: 2rem;
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.reset-button {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem auto;
}

.reset-button:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.reset-button:active {
    transform: translateY(0);
}

.reset-warning {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0;
    font-style: italic;
}

/* Profile Icon Button */
.nav-buttons-wrapper {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    width: 100%;
    justify-content: flex-end;
    flex-wrap: nowrap;
    min-width: 0;
    overflow: hidden;
}

.profile-icon-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.2;
    min-width: 0;
    white-space: nowrap;
    text-decoration: none;
    box-sizing: border-box;
    flex: 0 1 auto;
}

.profile-icon-btn i {
    font-size: 0.85rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-icon-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.profile-icon-btn.active {
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
    font-weight: bold;
}

/* Team Section Header */
.team-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: nowrap;
    gap: 1rem;
    min-width: 0;
}

.team-section-header h2 {
    margin-bottom: 0;
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.save-team-btn {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
    white-space: nowrap;
}

.save-team-btn:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.save-team-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.save-team-btn.hidden {
    display: none;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background: var(--surface-color);
    border-radius: 1rem;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
}

.profile-modal-content {
    max-width: 600px;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.modal-body {
    margin-top: 1rem;
}

.modal-body h2 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.modal-body p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

/* Login Modal */
.login-modal-content {
    max-width: 450px;
}

.email-password-form {
    margin-bottom: 1.5rem;
}

.auth-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    background: var(--background-color);
    padding: 0.25rem;
    border-radius: 0.5rem;
}

.auth-toggle-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.auth-toggle-btn.active {
    background: var(--surface-color);
    color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.email-signin-btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.email-signin-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.email-signin-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.auth-divider span {
    padding: 0 1rem;
}

.social-signin-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.social-signin-btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.social-signin-btn:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.social-signin-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.google-signin-btn {
    margin-top: 0;
}

.github-signin-btn {
    background: #24292e;
    color: white;
    border-color: #24292e;
}

.github-signin-btn:hover {
    background: #2f363d;
    border-color: #2f363d;
    box-shadow: 0 4px 12px rgba(36, 41, 46, 0.3);
}

.error-message {
    color: var(--danger-color);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 0.25rem;
}

.error-message.hidden {
    display: none;
}

/* Profile Modal */
.profile-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.profile-photo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin-bottom: 1rem;
    border: 3px solid var(--primary-color);
    object-fit: cover;
    object-position: center;
}

.profile-photo[src$=".svg"] {
    object-fit: contain;
    background: var(--background-color);
    padding: 0.5rem;
}

.profile-header h2 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.profile-header p {
    color: var(--text-secondary);
    margin-bottom: 0;
}

.profile-teams-section {
    margin-bottom: 2rem;
}

.profile-teams-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.teams-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.no-teams {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 2rem;
}

.team-item {
    background: var(--background-color);
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    transition: all 0.2s;
}

.team-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.team-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.team-item-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.team-generation-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.team-pokemon-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.team-item-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-open-team,
.btn-delete-team {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-open-team {
    background: var(--primary-color);
    color: white;
}

.btn-open-team:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
}

.btn-delete-team {
    background: var(--danger-color);
    color: white;
}

.btn-delete-team:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.team-preview {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.team-preview-sprite {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.no-pokemon-preview {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.9rem;
}

.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 2px solid var(--border-color);
}

.logout-btn,
.delete-account-btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.logout-btn {
    background: var(--text-secondary);
    color: white;
}

.logout-btn:hover {
    background: #4b5563;
    transform: translateY(-1px);
}

.delete-account-btn {
    background: var(--danger-color);
    color: white;
}

.delete-account-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Delete Modals */
.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

.btn-danger,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    transform: translateY(-1px);
}

.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
    transform: translateY(-1px);
}

.warning-text {
    color: var(--danger-color);
    font-weight: 500;
}

.confirm-email-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.confirm-email-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .app-header {
        padding: 2.5rem 1rem 1rem 1rem;
    }

    .app-header h1 {
        margin-bottom: 0.5rem;
    }

    .nav-buttons-wrapper {
        flex-direction: row;
        gap: 0.4rem;
        justify-content: flex-end;
        flex-wrap: nowrap;
        align-items: stretch;
    }

    .nav-buttons {
        flex: 1;
        justify-content: center;
        flex-wrap: nowrap;
        min-width: 0;
        gap: 0.4rem;
        align-items: stretch;
    }

    .nav-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        line-height: 1.2;
        gap: 0.3rem;
        box-sizing: border-box;
    }

    .profile-icon-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        line-height: 1.2;
        box-sizing: border-box;
    }

    .profile-icon-btn i {
        font-size: 0.8rem;
        line-height: 1;
    }

    .team-section-header {
        flex-wrap: nowrap;
        gap: 0.75rem;
    }

    .team-section-header h2 {
        font-size: 1.1rem;
    }

    .save-team-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        gap: 0.3rem;
    }

    .modal-content {
        padding: 1.5rem;
        margin: 1rem;
    }

    /* Team item styles moved to profile.css for profile page */

    .modal-actions {
        flex-direction: column;
    }

    .btn-danger,
    .btn-secondary {
        width: 100%;
    }
}

/* Footer */
.app-footer {
    margin-top: 4rem;
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.75rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--background-color);
}

.app-footer p {
    margin: 0;
    line-height: 1.5;
}

.app-footer a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

.app-footer a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

@media (min-width: 768px) {
    .app-footer {
        padding: 1.5rem 2rem;
        font-size: 0.875rem;
    }
}
