/* === ESTILOS PARA A NOVA MOCHILA DE ITENS (VERSÃO 3 - 3 COLUNAS E TEMA AZUL) === */

/* Nova paleta de cores Azul */
:root {
    --background-color: #3a7ca5; /* Azul de fundo da página */
    --container-bg: #2f6690;     /* Azul principal da mochila */
    --sidebar-bg: #1d344a;       /* Azul escuro para a sidebar */
    --item-slot-bg: #f7faff;     /* Fundo quase branco para itens/detalhes */
    --item-slot-border: #d8e2ef;
    --item-slot-selected-bg: #fff;
    --item-slot-selected-border: #ffc84a; /* Dourado para seleção */
    --text-color: #fff;
    --details-text-color: #1d344a; /* Texto escuro para contraste */
    --active-category-bg: #ffc84a;
    --active-category-text: #1d344a;
    --font-family: 'Exo 2', sans-serif;
}

/* Container principal que envolve toda a mochila */
.item-box-container {
    display: flex;
    width: 100%;
    max-width: 1024px;
    height: 70vh;
    min-height: 550px;
    margin: 20px auto;
    background-color: var(--container-bg);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    font-family: var(--font-family);
}

/* Coluna Esquerda: Categorias */
.item-box-sidebar {
    width: 220px;
    flex-shrink: 0;
    background-color: var(--sidebar-bg);
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-header {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 15px;
    padding-left: 10px;
}

.item-box-sidebar button {
    width: 100%;
    padding: 12px 20px;
    background: transparent;
    color: #e0e0e0;
    border: none;
    border-radius: 30px; /* Mais arredondado */
    cursor: pointer;
    text-align: left;
    font-size: 16px;
    font-weight: 600;
    position: relative;
    transition: all 0.2s ease;
}

.item-box-sidebar button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.item-box-sidebar button.active {
    background-color: var(--active-category-bg);
    color: var(--active-category-text);
    font-weight: 800;
    box-shadow: 0 0 15px rgba(255, 200, 74, 0.5);
}

/* Seta amarela no botão ativo */
.arrow {
    position: absolute;
    left: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 10px solid var(--active-category-bg);
}

/* Área principal que contém a grade e os detalhes */
.item-box-main {
    flex-grow: 1;
    display: flex;
    background-color: var(--item-slot-bg);
    border-radius: 15px;
    margin: 10px;
    overflow: hidden;
}

/* Coluna Central: Grade de Itens (AJUSTE PRINCIPAL) */
.item-grid {
    flex-grow: 1;
    padding: 20px;
    display: grid;
    /* MUDANÇA-CHAVE: Força exatamente 3 colunas */
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 90px;
    gap: 15px;
    overflow-y: auto;
}

.item-slot {
    background: #fff;
    border: 3px solid var(--item-slot-border);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.item-slot:hover {
    transform: scale(1.05);
    border-color: var(--item-slot-selected-border);
}

.item-slot.selected {
    border-color: var(--item-slot-selected-border);
    border-width: 4px;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 200, 74, 0.7);
}

.item-slot img {
    /* max-width: 70%; */
    max-height: 70%;
    object-fit: contain;
    padding: 0 30px;
}

.item-quantity {
    position: absolute;
    bottom: 5px;
    right: 8px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 10px;
}

.empty-category {
    grid-column: 1 / -1;
    text-align: center;
    color: #888;
    margin-top: 40px;
}

/* Coluna Direita: Detalhes do Item */
.item-details {
    width: 280px;
    flex-shrink: 0;
    background: #f7faff;
    border-left: 2px solid var(--item-slot-border);
    padding: 20px;
    display: flex;
    flex-direction: column;
    color: var(--details-text-color);
}

.details-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.no-item-selected {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    text-align: center;
    color: #aaa;
}

.placeholder-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 5px solid #ddd;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 40px;
    font-weight: bold;
    color: #ddd;
    margin-bottom: 20px;
}

.item-details-header {
    text-align: center;
    margin-bottom: 15px;
}

.item-details-header img {
    width: 80px;
    height: 80px;
    margin-bottom: 10px;
}

.item-details-header h2 {
    margin: 0;
    font-size: 22px;
    word-wrap: break-word;
}

.item-description {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 20px;
    min-height: 80px;
    flex-grow: 1;
}

.item-info {
    margin-bottom: 20px;
    font-size: 16px;
}

.item-actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.action-btn {
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}
.action-btn:hover { filter: brightness(1.1); }
.action-btn.use { background-color: #4CAF50; color: white; }
.action-btn.sell { background-color: #f44336; color: white; }
.action-btn img { width: 18px; height: 18px; vertical-align: middle; }

/* --- REGRAS DE RESPONSIVIDADE (VERSÃO MOBILE APRIMORADA) --- */
@media (max-width: 850px) {
    .item-box-container {
        flex-direction: column;
        height: auto;
                max-height: 110vh; /* Limita a altura na viewport do celular */
    }

    /* AJUSTE-CHAVE: Barra de categorias com quebra de linha */
    .item-box-sidebar {
        width: 100%;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap; /* Permite que os botões quebrem para a próxima linha */
        justify-content: center; /* Centraliza as linhas de botões */
        padding: 10px 5px; /* Reduz o padding lateral */
        gap: 5px; /* Espaço entre os botões */
        /* REMOVIDO: overflow-x: auto; */
    }
    
    .sidebar-header { display: none; }

    /* AJUSTE-CHAVE: Botões menores e flexíveis */
    .item-box-sidebar button {
        flex-grow: 1; /* Permite que os botões cresçam para preencher o espaço */
        min-width: 120px; /* Largura mínima para cada botão */
        padding: 8px 10px; /* Padding interno menor */
        font-size: 14px; /* Fonte um pouco menor */
        text-align: center; /* Centraliza o texto do botão */
        max-width: 135px;
    }

    .arrow { display: none; }

    .item-box-main {
        flex-direction: column;
        margin: 0 10px 10px 10px;
        min-height: 0; /* Corrige potencial problema de overflow no flexbox */
    }

    .item-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .item-details {
        width: 88%;
        
        height: 370px;
        flex-shrink: 0;
        border-left: none;
        border-top: 2px solid var(--item-slot-border);
        overflow-y: auto;
    }
    
    .item-description { min-height: 60px; }
    .item-details-header img {
    width: 50px;
    height: 50px;}
}

@media (max-width: 480px) {
    /* Em telas muito pequenas, podemos voltar para 2 colunas para não espremer demais */
    .item-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-auto-rows: 85px;; 
    }
    .item-slot {
    padding: 0 ;
}
}

/* Estilos do Modal (mantidos) */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-content { background: #333; padding: 20px; border-radius: 8px; min-width: 300px; max-width: 90%; color: white; border: 1px solid #555; }
.pokemon-selection-list { display: flex; flex-direction: column; gap: 10px; margin-top: 15px; margin-bottom: 15px; }
.pokemon-option { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 8px; background: #444; border-radius: 5px; cursor: pointer; transition: background 0.2s; }
.pokemon-option:hover { background: #5e5e5e; }
.pokemon-hp { font-size: 0.9em; color: #ccc; }
.btn-cancel { padding: 10px 20px; background: #f44336; color: white; border: none; border-radius: 5px; cursor: pointer; }


.sell-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.quantity-selector {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px; /* Espaçamento entre os botões e o input */
}

/* Estilo do campo de input do número */
.quantity-selector input {
    width: 50px;
    height: 35px;
    text-align: center;
    border: 2px solid #c5d1e0; /* Borda sutil */
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700; /* Deixa o número mais forte */
    color: #1d344a; /* Cor do texto escura para ser visível */
    background-color: #eef2f7; /* Fundo claro para o input */
    -moz-appearance: textfield; /* Remove setas padrão no Firefox */
}

/* Remove setas padrão no Chrome, Safari, Edge */
.quantity-selector input::-webkit-outer-spin-button,
.quantity-selector input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Estilo dos botões de + e - */
.quantity-selector button {
    width: 35px;
    height: 35px;
    border-radius: 50%; /* Botões perfeitamente redondos */
    border: none;
    background-color: #4a5c70; /* Cor escura e neutra */
    color: white;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1; /* Ajusta o alinhamento vertical do texto */
    transition: background-color 0.2s;
}

.quantity-selector button:hover {
    background-color: #627489; /* Cor um pouco mais clara no hover */
}

/* ESPECIALISTA POKEMON */

/* ==========================================================================
   ESTILOS PARA A PÁGINA DE ESPECIALISTAS
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. LAYOUT PRINCIPAL (Container, Sidebar, Main)
   -------------------------------------------------------------------------- */
.specialists-container {
    display: flex;
    width: 100%;
    max-width: 1024px;
    height: 70vh;
    min-height: 550px;
    margin: 20px auto;
    background-color: #2f6690; /* Cor de fundo principal */
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    font-family: 'Exo 2', sans-serif;
}

.specialists-sidebar {
    width: 220px;
    flex-shrink: 0;
    background-color: #1d344a;
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-header {
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 15px;
    padding-left: 10px;
}

.specialists-sidebar button {
    width: 100%;
    padding: 12px 20px;
    background: transparent;
    color: #e0e0e0;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    text-align: left;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.specialists-sidebar button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.specialists-sidebar button.active {
    background-color: #ffc84a;
    color: #1d344a;
    font-weight: 800;
}

.specialists-main {
    flex-grow: 1;
    display: flex;
    background-color: #f7faff;
    border-radius: 15px;
    margin: 10px;
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   2. COLUNA DO MEIO (Seleção de Time)
   -------------------------------------------------------------------------- */
.pokemon-team-selection {
    width: 250px;
    flex-shrink: 0;
    border-right: 2px solid #d8e2ef;
    display: flex;
    flex-direction: column;
}

.team-header {
    padding: 15px;
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    color: #1d344a;
    border-bottom: 2px solid #d8e2ef;
}

.team-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.team-member {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 30px;
    background-color: #fff;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.team-member:hover {
    border-color: #ffc84a;
    transform: scale(1.03);
}

.team-member.active {
    border-color: #ffc84a;
    background-color: #fffbeb;
    border-width: 3px;
}

.team-member img {
    width: 50px;
    height: 50px;
    margin-right: 15px;
}

.team-member-info {
    display: flex;
    flex-direction: column;
}

.team-member-info span {
    font-weight: 600;
    color: #333;
}

.team-member-info small {
    color: #777;
}

/* --------------------------------------------------------------------------
   3. COLUNA DA DIREITA (Área de Ação)
   -------------------------------------------------------------------------- */
.specialist-action-area {
    flex-grow: 1;
    padding: 25px;
    overflow-y: auto;
    position: relative;
}

.no-selection {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    text-align: center;
    color: #aaa;
}

.placeholder-icon {
    width: 80px; height: 80px; border-radius: 50%; border: 5px solid #ddd;
    display: flex; justify-content: center; align-items: center;
    font-size: 40px; font-weight: bold; color: #ddd; margin-bottom: 20px;
}

.action-details h3 {
    text-align: center;
    font-size: 24px;
    color: #1d344a;
    margin-top: 0;
}

.action-details p {
    text-align: center;
    color: #667;
    margin-bottom: 30px;
}

.comparison-view {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.pokemon-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.pokemon-view img {
    width: 120px;
    height: 120px;
}
.pokemon-view span {
    font-weight: bold;
    color: #555;
}

.arrow-separator {
    font-size: 40px;
    color: #ccc;
    font-weight: bold;
}

.cost-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 20px;
}
.cost-display img {
    width: 24px;
    height: 24px;
}

.action-btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}
.action-btn.shiny {
    background-color: #ffc84a;
    color: #1d344a;
}
.action-btn:hover {
    filter: brightness(1.1);
}

.feedback-message {
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    text-align: center;
}
.feedback-message.green { background-color: #4CAF50; }
.feedback-message.red { background-color: #f44336; }
.feedback-message.blue { background-color: #2196F3; }

/* --------------------------------------------------------------------------
   4. RESPONSIVIDADE
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
    .specialists-container {
        flex-direction: column;
        height: auto;
        max-height: 95vh;
    }
    .specialists-sidebar {
        flex-direction: row;
        width: 100%;
        overflow-x: auto;
    }
    .specialists-sidebar button {
        flex-shrink: 0;
    }
    .specialists-main {
        flex-direction: column;
    }
    .pokemon-team-selection {
        width: 100%;
        border-right: none;
        border-bottom: 2px solid #d8e2ef;
    }
    .team-list {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 15px;
    }
    .team-member {
        flex-direction: column;
        padding: 10px;
        min-width: 100px;
    }
    .team-member img {
        margin-right: 0;
        margin-bottom: 5px;
    }
}
