/* =============================================
   TALENT CALCULATOR - Main Styles
   Fully configurable WoW-style talent tree
   ============================================= */
   
/* garante que width inclua padding+borda (sem estourar largura) */
*, *::before, *::after { box-sizing: border-box; }

html, body { overflow: hidden; } /* remove scroll do iframe */

:root {
    /* Color Theme - Easily customizable */
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tree: #0f0f1a;
    --bg-talent: #252540;
    --bg-talent-hover: #353560;
    
    --border-default: #3a3a5a;
    --border-available: #00cc66;
    --border-maxed: #ff8c00;
    --border-locked: #333;
    
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --text-muted: #666666;
    --text-available: #00ff00;
    --text-maxed: #ffd700;
    
    --tree-color-1: #c41f3b; /* Red - e.g., DPS */
    --tree-color-2: #a330c9; /* Purple - e.g., Hybrid */
    --tree-color-3: #00ff96; /* Green - e.g., Healer/Tank */
    
    /* Sizing */
    --talent-size: 36px;
	--talent-gap: 6px;
	--tree-padding: 10px;
	--tree-width: 240px; 
	--tree-height: 330px;
    --icon-border-radius: 6px;
    
    /* Animation */
    --transition-speed: 0.2s;
	
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
	padding: 0;
	margin: 0;
}

/* =============================================
   Calculator Container
   ============================================= */
.talent-calculator {
    max-width: 1400px;
    margin: 0 auto;
}

/* =============================================
   Header
   ============================================= */
.calculator-header {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
}

.calculator-header h1 {
    font-size: 1.8rem;
    color: var(--text-primary);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.class-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.class-selector select {
    padding: 8px 16px;
    font-size: 1rem;
    border-radius: 5px;
    border: 1px solid var(--border-default);
    background: var(--bg-talent);
    color: var(--text-primary);
    cursor: pointer;
}

.level-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.level-selector select {
    padding: 8px 16px;
    font-size: 1rem;
    border-radius: 5px;
    border: 1px solid var(--border-default);
    background: var(--bg-talent);
    color: var(--text-primary);
    cursor: pointer;
}

.level-selector select:hover,
.class-selector select:hover {
    border-color: var(--color-gold);
}

.points-display {
    display: flex;
    gap: 20px;
    font-size: 1rem;
}

.points-display strong {
    color: var(--text-available);
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

.btn {
    padding: 10px 20px;
    font-size: 0.9rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    transform: scale(1);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.btn:active:not(:disabled) {
    transform: scale(0.95);
}

.btn-reset {
    background: #c41f3b;
    color: white;
}

.btn-reset:hover {
    background: #e62346;
}

.btn-export {
    background: #4a9eff;
    color: white;
}

.btn-export:hover {
    background: #6ab0ff;
}

.btn-import {
    background: #00cc66;
    color: white;
}

.btn-import:hover {
    background: #00e676;
}

/* =============================================
   Talent Trees Container
   ============================================= */
.talent-trees-container{
  display: grid !important;
  grid-template-columns: repeat(3, var(--tree-width)) !important;
  gap: 12px !important;
  justify-content: center !important;
  align-items: start !important;
}

/* =============================================
   Individual Tree
   ============================================= */
.talent-tree {
    background-color: var(--bg-tree);
    border-radius: 10px;
    padding: var(--tree-padding);
    border: 2px solid var(--border-default);
    position: relative;
    overflow: hidden;
	
	width: var(--tree-width) !important;
	min-width: var(--tree-width) !important;
	max-width: var(--tree-width) !important;
	
	height: var(--tree-height) !important;
	min-height: var(--tree-height) !important;
	max-height: var(--tree-height) !important;

    
	
	display: flex !important;
	flex-direction: column !important;

    /* fundo igual ao client (sem zoom do cover) */
    background-repeat: no-repeat !important;
	background-position: center top !important;
	background-size: 100% auto !important;
}

/* Semi-transparent overlay for background images */
.talent-tree::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 0;
}

/* Ensure tree content appears above overlay */
.talent-tree > * {
    position: relative;
    z-index: 1;
}

.talent-tree[data-tree-index="0"] {
    border-top-color: var(--tree-color-1);
}

.talent-tree[data-tree-index="1"] {
    border-top-color: var(--tree-color-2);
}

.talent-tree[data-tree-index="2"] {
    border-top-color: var(--tree-color-3);
}

.tree-header {
    text-align: center;
	flex: 0 0 auto;
    margin-bottom: 6px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-default);
}


.tree-header h2{
  font-size: 18px;      /* menor */
  margin-bottom: 5px;
  margin: 0;
  line-height: 1.1;
}

.tree-points {
	font-size: 12px;
	margin-top: 2px;
    color: var(--text-secondary);
}

.tree-points strong {
    color: var(--text-available);
}

/* =============================================
   Talent Grid
   ============================================= */
.talent-grid {
	flex: 1 1 auto !important;
    height: calc(330px - 56px);
	overflow: visible !important;
	display: grid;
    grid-template-columns: repeat(4, var(--talent-size));
    gap: var(--talent-gap);
    justify-content: center;
    position: relative;
}

/* SVG Connector Layer */
.tree-connectors {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.tree-connectors line {
    stroke: var(--border-default);
    stroke-width: 2;
}

.tree-connectors line.active {
    stroke: var(--text-available);
}

/* =============================================
   Individual Talent
   ============================================= */
.talent {
    width: var(--talent-size);
    height: var(--talent-size);
    position: relative;
    cursor: pointer;
    z-index: 2;
    transition: transform var(--transition-speed);
}

.talent:hover {
    transform: scale(1.1);
}

.talent-icon {
    width: 100%;
    height: 100%;
    border-radius: var(--icon-border-radius);
    border: 2px solid var(--border-default);
    background: var(--bg-talent);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: all var(--transition-speed);
}

.talent-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%);
    transition: filter var(--transition-speed);
}

/* Talent States */
.talent.locked .talent-icon {
    border-color: var(--border-locked);
    opacity: 0.5;
}

.talent.locked .talent-icon img {
    filter: grayscale(100%);
}

.talent.available .talent-icon {
    border-color: var(--border-available);
    box-shadow: 0 0 10px rgba(0, 204, 102, 0.5);
}

.talent.available .talent-icon img {
    filter: grayscale(0%);
}

.talent.partial .talent-icon {
    border-color: var(--border-available);
}

.talent.partial .talent-icon img {
    filter: grayscale(0%);
}

.talent.maxed .talent-icon {
    border-color: var(--border-maxed);
    box-shadow: 0 0 15px rgba(255, 140, 0, 0.5);
}

.talent.maxed .talent-icon img {
    filter: grayscale(0%);
}

/* Rank Display */
.talent-rank {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 3px;
    border: 1px solid var(--border-default);
    min-width: 24px;
    text-align: center;
}

.talent.available .talent-rank,
.talent.partial .talent-rank {
    color: var(--text-available);
}

.talent.maxed .talent-rank {
    color: var(--text-maxed);
    border-color: var(--text-maxed);
}

/* Empty Talent Slot */
.talent.empty {
    visibility: hidden;
    pointer-events: none;
}

/* =============================================
   Tier Labels
   ============================================= */
.tier-label {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 5px 0;
    border-top: 1px dashed var(--border-default);
    margin-top: 5px;
}

.tier-label:first-child {
    border-top: none;
    margin-top: 0;
}

/* =============================================
   Modal
   ============================================= */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-content h2 {
    margin-bottom: 15px;
}

.modal-content textarea {
    width: 100%;
    padding: 10px;
    font-family: monospace;
    font-size: 0.9rem;
    background: var(--bg-talent);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
    border-radius: 5px;
    resize: none;
}

.modal-buttons {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

/* =============================================
   Responsive
   ============================================= */


@media (max-width: 768px){
  .talent-trees-container{
    grid-template-columns: 1fr !important;
    justify-items: center !important;
  }

  /* no celular, a árvore se adapta à tela sem criar scroll horizontal */
  .talent-tree{
    width: min(var(--tree-width), 92vw) !important;
    min-width: min(var(--tree-width), 92vw) !important;
    max-width: min(var(--tree-width), 92vw) !important;
  }

  /* header do calculator quebra bonitinho */
  .calculator-header{
    gap: 10px !important;
    padding: 12px !important;
  }

  .class-selector,
  .level-selector,
  .points-display{
    width: 100% !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
  }

  .action-buttons{
    width: 100% !important;
    justify-content: center !important;
    margin-left: 0 !important;
    flex-wrap: wrap !important;
  }
}
