/* =====================================================
   Pokedex Explorer — Styles
   ===================================================== */

:root {
    --poke-card-bg: #ffffff;
    --poke-hover-bg: #f8fafc;
    --poke-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --poke-hover-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --poke-primary: #ef4444;
    --poke-text: #1e293b;
    --poke-subtext: #64748b;
    --poke-surface: #f8fafc;
    --poke-border: #f1f5f9;
    --poke-collected-glow: 0 0 12px rgba(34, 197, 94, 0.3);
}

/* ---- Header ---- */
.pokedex-header {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 24px;
    padding: 3rem 2rem;
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--poke-border);
}

.pokedex-header::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

/* ---- Search ---- */
.search-input-group {
    position: relative;
    max-width: 500px;
    width: 100%;
    margin-left: auto;
}

.search-input {
    padding: 1rem 1rem 1rem 3rem;
    border-radius: 16px;
    border: 2px solid #fff;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    font-size: 1rem;
    background: #ffffff;
}

.search-input:focus {
    border-color: var(--poke-primary);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
    outline: none;
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 1.2rem;
    pointer-events: none;
}

/* ---- Region ---- */
.region-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-weight: 800;
    color: var(--poke-text);
    letter-spacing: -0.025em;
}

.region-divider {
    flex: 1;
    height: 2px;
    background: var(--poke-border);
    border-radius: 2px;
}

.region-badge {
    background: #fee2e2;
    color: #ef4444;
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 700;
    min-width: 32px;
    text-align: center;
}

.region-progress-badge {
    background: #dcfce7;
    color: #16a34a;
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 700;
    min-width: 60px;
    text-align: center;
}

/* ---- Grid ---- */
.pokemon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
}

/* ---- Pokemon Card ---- */
.pokemon-card {
    background: var(--poke-card-bg);
    border-radius: 20px;
    padding: 1.25rem;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--poke-border);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: visible;
}

.pokemon-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--poke-hover-shadow);
    border-color: transparent;
    z-index: 10;
}

/* ---- Collection State ---- */
.pokemon-card.not-collected {
    opacity: 0.4;
    filter: grayscale(100%);
}

.pokemon-card.not-collected:hover {
    opacity: 0.7;
    filter: grayscale(60%);
}

.pokemon-card.collected {
    border-color: rgba(34, 197, 94, 0.3);
}

.pokemon-card.collected:hover {
    box-shadow: var(--poke-collected-glow), var(--poke-hover-shadow);
}

.collected-check {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 24px;
    height: 24px;
    background: #22c55e;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.75rem;
    z-index: 5;
    box-shadow: 0 2px 4px rgba(34, 197, 94, 0.4);
}

/* ---- Card inner elements ---- */
.poke-id {
    font-family: monospace;
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
    text-align: right;
}

.poke-img-container {
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    position: relative;
}

.poke-img-bg {
    position: absolute;
    width: 100px;
    height: 100px;
    background: var(--poke-surface);
    border-radius: 50%;
    z-index: 0;
    transition: all 0.3s ease;
}

.pokemon-card:hover .poke-img-bg {
    background: #fef2f2;
    transform: scale(1.1);
}

.pokemon-card.collected:hover .poke-img-bg {
    background: #f0fdf4;
}

.poke-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    z-index: 1;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.pokemon-card:hover .poke-img {
    transform: scale(1.15) translateY(-5px);
}

.poke-info {
    text-align: center;
    margin-top: auto;
}

.poke-name {
    font-weight: 700;
    color: var(--poke-text);
    margin: 0;
    font-size: 1.05rem;
    text-transform: capitalize;
    line-height: 1.3;
    transition: color 0.2s;
}

.pokemon-card:hover .poke-name {
    color: var(--poke-primary);
}

.pokemon-card.collected:hover .poke-name {
    color: #16a34a;
}

.poke-region-label {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.25rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ---- Empty state ---- */
.empty-search-message {
    text-align: center;
    padding: 4rem 1rem;
    color: #64748b;
    background: var(--poke-surface);
    border-radius: 20px;
    border: 2px dashed #e2e8f0;
    margin-top: 2rem;
}

.empty-search-message i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
    color: #cbd5e1;
}

.hidden {
    display: none !important;
}

/* ---- Progress Bar Area ---- */
.pokedex-progress-area {
    background: #ffffff;
    border-radius: 20px;
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--poke-border);
    box-shadow: var(--poke-shadow);
}

.progress-main {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.progress-circle {
    width: 80px;
    height: 80px;
    position: relative;
    flex-shrink: 0;
}

.progress-circle svg {
    width: 80px;
    height: 80px;
    transform: rotate(-90deg);
}

.progress-circle-bg {
    fill: none;
    stroke: #e5e7eb;
    stroke-width: 6;
}

.progress-circle-fill {
    fill: none;
    stroke: var(--poke-primary);
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease;
}

.progress-circle-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--poke-text);
}

.progress-info h5 {
    margin: 0 0 0.25rem;
    font-weight: 700;
    color: var(--poke-text);
}

.progress-info p {
    margin: 0;
    color: var(--poke-subtext);
    font-size: 0.9rem;
}

.progress-bar-track {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ef4444, #f97316);
    border-radius: 4px;
    transition: width 1s ease;
}

/* ---- Filter Buttons ---- */
.pokedex-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pokedex-filter-btn {
    padding: 0.5rem 1.25rem;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    background: #ffffff;
    color: var(--poke-subtext);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pokedex-filter-btn:hover {
    border-color: var(--poke-primary);
    color: var(--poke-primary);
}

.pokedex-filter-btn.active {
    background: var(--poke-primary);
    border-color: var(--poke-primary);
    color: #ffffff;
}

/* ---- Binder Setup Banner ---- */
.pokedex-setup-banner {
    background: linear-gradient(135deg, #fef2f2 0%, #fff7ed 100%);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 2px dashed #fecaca;
    text-align: center;
}

.pokedex-setup-banner h4 {
    color: var(--poke-text);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.pokedex-setup-banner p {
    color: var(--poke-subtext);
    margin-bottom: 1.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.setup-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-pokedex-primary {
    background: var(--poke-primary);
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 14px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-pokedex-primary:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-pokedex-secondary {
    background: #ffffff;
    color: var(--poke-text);
    border: 2px solid #e5e7eb;
    padding: 0.75rem 1.5rem;
    border-radius: 14px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-pokedex-secondary:hover {
    border-color: var(--poke-primary);
    color: var(--poke-primary);
    transform: translateY(-2px);
}

/* ---- Binder Selector Modal ---- */
.pokedex-binder-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.pokedex-binder-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.pokedex-binder-modal {
    background: #fff;
    border-radius: 24px;
    padding: 2rem;
    max-width: 480px;
    width: 90%;
    max-height: 70vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
}

.pokedex-binder-modal-overlay.show .pokedex-binder-modal {
    transform: scale(1) translateY(0);
}

.pokedex-binder-modal h5 {
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--poke-text);
}

.binder-select-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.binder-select-item:hover {
    border-color: var(--poke-primary);
    background: #fef2f2;
}

.binder-select-item.selected {
    border-color: var(--poke-primary);
    background: #fef2f2;
}

.binder-color-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

.binder-select-name {
    font-weight: 600;
    color: var(--poke-text);
    font-size: 0.95rem;
}

.binder-select-badge {
    margin-left: auto;
    font-size: 0.75rem;
    color: #94a3b8;
}

/* ---- Active Binder Info Bar ---- */
.pokedex-active-binder {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #ffffff;
    padding: 0.75rem 1.25rem;
    border-radius: 14px;
    border: 1px solid var(--poke-border);
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    flex-wrap: wrap;
}

.active-binder-label {
    font-size: 0.85rem;
    color: var(--poke-subtext);
    font-weight: 500;
}

.active-binder-name {
    font-weight: 700;
    color: var(--poke-text);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.active-binder-actions {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
}

.btn-binder-action {
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: transparent;
    color: var(--poke-subtext);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.btn-binder-action:hover {
    border-color: var(--poke-primary);
    color: var(--poke-primary);
}

.btn-binder-action.danger:hover {
    border-color: #ef4444;
    color: #ef4444;
}

/* ---- New Binder Form ---- */
.new-binder-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.new-binder-form input {
    flex: 1;
    padding: 0.65rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.new-binder-form input:focus {
    border-color: var(--poke-primary);
}

/* =====================================================
   Dark Theme
   ===================================================== */
.theme-dark .pokedex-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-color: #334155;
}

.theme-dark .pokedex-header::before {
    background: radial-gradient(circle, rgba(239, 68, 68, 0.2) 0%, transparent 70%);
}

.theme-dark .pokedex-header h1.text-dark,
.theme-dark .region-title,
.theme-dark .poke-name,
.theme-dark .progress-info h5,
.theme-dark .progress-circle-text,
.theme-dark .binder-select-name,
.theme-dark .active-binder-name {
    color: #e2e8f0 !important;
}

.theme-dark .pokedex-header p.text-muted,
.theme-dark .poke-id,
.theme-dark .poke-region-label,
.theme-dark .empty-search-message,
.theme-dark .progress-info p,
.theme-dark .active-binder-label {
    color: #94a3b8 !important;
}

.theme-dark .search-input {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

.theme-dark .search-input::placeholder {
    color: #94a3b8;
}

.theme-dark .pokemon-card {
    background: #1e293b;
    border-color: #334155;
}

.theme-dark .pokemon-card:hover {
    border-color: #6366f1;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.45), 0 10px 10px -5px rgba(0, 0, 0, 0.35);
}

.theme-dark .pokemon-card.collected {
    border-color: rgba(34, 197, 94, 0.4);
}

.theme-dark .pokemon-card.collected:hover {
    border-color: #22c55e;
    box-shadow: 0 0 16px rgba(34, 197, 94, 0.2), 0 20px 25px -5px rgba(0, 0, 0, 0.45);
}

.theme-dark .poke-img-bg {
    background: #0f172a;
}

.theme-dark .pokemon-card:hover .poke-img-bg {
    background: rgba(99, 102, 241, 0.2);
}

.theme-dark .pokemon-card.collected:hover .poke-img-bg {
    background: rgba(34, 197, 94, 0.15);
}

.theme-dark .region-divider {
    background: #334155;
}

.theme-dark .region-badge {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.theme-dark .region-progress-badge {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

.theme-dark .empty-search-message {
    background: #1e293b;
    border-color: #334155;
}

.theme-dark .empty-search-message i {
    color: #64748b;
}

.theme-dark .alert.alert-info {
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155 !important;
}

.theme-dark .pokedex-progress-area {
    background: #1e293b;
    border-color: #334155;
}

.theme-dark .progress-circle-bg {
    stroke: #334155;
}

.theme-dark .progress-bar-track {
    background: #334155;
}

.theme-dark .pokedex-filter-btn {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

.theme-dark .pokedex-filter-btn:hover {
    border-color: var(--poke-primary);
    color: var(--poke-primary);
}

.theme-dark .pokedex-filter-btn.active {
    background: var(--poke-primary);
    border-color: var(--poke-primary);
    color: #ffffff;
}

.theme-dark .pokedex-setup-banner {
    background: linear-gradient(135deg, #1e293b 0%, #1a1a2e 100%);
    border-color: #334155;
}

.theme-dark .pokedex-setup-banner h4 {
    color: #e2e8f0;
}

.theme-dark .pokedex-setup-banner p {
    color: #94a3b8;
}

.theme-dark .btn-pokedex-secondary {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

.theme-dark .btn-pokedex-secondary:hover {
    border-color: var(--poke-primary);
    color: var(--poke-primary);
}

.theme-dark .pokedex-binder-modal {
    background: #1e293b;
}

.theme-dark .pokedex-binder-modal h5 {
    color: #e2e8f0;
}

.theme-dark .binder-select-item {
    border-color: #334155;
}

.theme-dark .binder-select-item:hover,
.theme-dark .binder-select-item.selected {
    border-color: var(--poke-primary);
    background: rgba(239, 68, 68, 0.1);
}

.theme-dark .pokedex-active-binder {
    background: #1e293b;
    border-color: #334155;
}

.theme-dark .btn-binder-action {
    border-color: #334155;
    color: #94a3b8;
}

.theme-dark .new-binder-form input {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

.theme-dark .new-binder-form input::placeholder {
    color: #64748b;
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 768px) {
    .pokedex-header {
        padding: 2rem 1.5rem;
        text-align: center;
    }

    .search-input-group {
        margin: 1.5rem auto 0;
    }

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

    .progress-main {
        flex-direction: column;
        text-align: center;
    }

    .pokedex-filters {
        justify-content: center;
    }

    .pokedex-active-binder {
        flex-direction: column;
        text-align: center;
    }

    .active-binder-actions {
        margin-left: 0;
    }

    .setup-actions {
        flex-direction: column;
        align-items: center;
    }
}
