@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700;900&display=swap');

/* ─── BASE ───────────────────────────────────────────────────────── */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: #e6e6e6;
    font-family: 'Cinzel', serif;
}

/* ─── FONDO ──────────────────────────────────────────────────────── */
.background {
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(255, 180, 0, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(255, 140, 0, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 80%, rgba(200, 100, 0, 0.05) 0%, transparent 50%),
        linear-gradient(160deg, #0a0a0f 0%, #0f0d0a 40%, #0c0b08 70%, #080808 100%);
}

/* ─── CONTAINER ──────────────────────────────────────────────────── */
.container {
    width: 80%;
    margin: auto;
    padding: 18px;
    background: rgba(12, 12, 12, 0.85);
    border-radius: 14px;
    border: 1px solid rgba(255, 215, 0, 0.15);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7), 0 0 60px rgba(255, 215, 0, 0.04);
    backdrop-filter: blur(6px);
    --nivel-poder: 0;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Efecto dinámico según nivel */
.container {
    border-color: rgba(255, 215, 0, calc(0.1 + 0.5 * var(--nivel-poder)));
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.7),
        0 0 calc(20px + 60px * var(--nivel-poder)) rgba(255, 215, 0, calc(0.03 + 0.12 * var(--nivel-poder)));
}

/* ─── TÍTULO ─────────────────────────────────────────────────────── */
h1 {
    text-align: center;
    color: #ffd700;
    padding: 20px 0 10px;
    margin: 0;
    font-size: 2rem;
    letter-spacing: 0.1em;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.4), 0 0 40px rgba(255, 180, 0, 0.2);
    animation: goldenGlow 3s ease-in-out infinite;
}

@keyframes goldenGlow {
    0%, 100% { text-shadow: 0 0 15px rgba(255,215,0,0.4), 0 0 30px rgba(255,180,0,0.2); color: #ffd700; }
    50%       { text-shadow: 0 0 25px rgba(255,215,0,0.7), 0 0 50px rgba(255,160,0,0.3); color: #ffed4e; }
}

/* ─── DISCLAIMER ─────────────────────────────────────────────────── */
.disclaimer {
    text-align: center;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.3);
    font-family: sans-serif;
    padding: 4px 20px 12px;
    margin: 0;
    letter-spacing: 0.02em;
}

/* ─── LAYOUT ─────────────────────────────────────────────────────── */
.main {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.left  { flex: 3; }
.right { flex: 1; }

/* ─── CARDS ──────────────────────────────────────────────────────── */
.card {
    background: rgba(18, 18, 18, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 12px;
}

/* ─── TÍTULOS ────────────────────────────────────────────────────── */
h2 {
    color: #f5e6a1;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    margin: 0 0 14px 0;
}

h3 {
    color: #f5e6a1;
    font-size: 0.95rem;
    margin: 0 0 10px 0;
}

/* ─── NOMBRE DE BUILD ────────────────────────────────────────────── */
.build-name-field {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 215, 0, 0.15);
    border-radius: 32px;
    padding: 12px 18px;
}

.build-name-icon {
    font-size: 1.4rem;
    color: #ffd966;
    flex-shrink: 0;
}

.input-wrapper {
    position: relative;
    flex: 1;
}

.build-name-input {
    width: 90%;
    padding: 14px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 215, 0, 0.15);
    background: rgba(255, 255, 255, 0.03);
    color: #f5e6a1;
    font-size: 1rem;
    font-family: 'Cinzel', serif;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.build-name-input:hover {
    border-color: rgba(255, 215, 0, 0.3);
}

.build-name-input:focus,
.build-name-input:not(:placeholder-shown) {
    border-color: rgba(255, 215, 0, 0.7);
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.08);
}

.floating-label {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: rgba(245, 230, 161, 0.45);
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    transition: transform 0.2s ease, font-size 0.2s ease, color 0.2s ease;
}

.build-name-input:focus + .floating-label,
.build-name-input:not(:placeholder-shown) + .floating-label {
    transform: translateY(-26px);
    font-size: 0.75rem;
    color: rgba(255, 215, 0, 0.8);
}

/* ─── BOTONES ────────────────────────────────────────────────────── */
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 18px;
    background: rgba(20, 20, 20, 0.9);
    color: #f5e6a1;
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 999px;
    font-family: 'Cinzel', serif;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    margin-bottom: 8px;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

button:hover {
    background: rgba(30, 30, 30, 0.95);
    border-color: rgba(255, 215, 0, 0.5);
    color: #fff9cc;
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

/* ─── EQUIPAMIENTO SUBTÍTULOS ────────────────────────────────────── */
.equip-subtitle {
    color: rgba(255, 215, 0, 0.6);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin: 14px 0 8px 0;
    border-bottom: 1px solid rgba(255, 215, 0, 0.1);
    padding-bottom: 4px;
}

/* ─── EQUIP SLOTS ────────────────────────────────────────────────── */
.equip-slots {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 6px;
}

.equip-slot {
    position: relative;
    height: 68px;
    border-radius: 10px;
    background: linear-gradient(145deg, #0c0c0c, #151515);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px;
    font-size: 0.72rem;
    font-family: 'Cinzel', serif;
    color: rgba(255, 255, 255, 0.4);
    text-transform: none;
    letter-spacing: 0.03em;
    cursor: pointer;
    margin-bottom: 0;
    overflow: hidden;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.equip-slot:hover {
    border-color: rgba(255, 215, 0, 0.5);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.15);
    transform: translateY(-2px);
    color: rgba(255, 215, 0, 0.8);
}

/* Slot con item equipado — pulso sutil */
.equip-slot[data-itemname]:not([data-itemname=""]) {
    border-color: rgba(255, 215, 0, 0.25);
    animation: slotIdle 3s ease-in-out infinite;
}

@keyframes slotIdle {
    0%, 100% { box-shadow: 0 0 0 rgba(255,215,0,0); }
    50%       { box-shadow: 0 0 8px rgba(255,215,0,0.12); }
}

/* Slot vacío — ícono + */
.equip-slot:not([data-itemname])::before,
.equip-slot[data-itemname=""]::before {
    content: "+";
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.12);
    margin-right: 4px;
}

/* Ocultar texto si hay imagen */
.equip-slot img + span { display: none; }

/* Tooltip */
.equip-slot::after {
    content: attr(data-itemname);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    background: rgba(0, 0, 0, 0.92);
    color: #f5e6a1;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.68rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    border: 1px solid rgba(255, 215, 0, 0.25);
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 10;
}

.equip-slot:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* Flash al equipar */
.equip-slot.equip-anim {
    animation: equipFlash 0.4s ease;
}

@keyframes equipFlash {
    0%   { transform: scale(1); box-shadow: none; }
    35%  { transform: scale(1.1); box-shadow: 0 0 20px rgba(255,215,0,0.5); }
    70%  { transform: scale(0.97); }
    100% { transform: scale(1); box-shadow: none; }
}

/* ─── IMÁGENES DE ITEMS ───────────────────────────────────────────── */
.item-img {
    width: 34px;
    height: 34px;
    object-fit: contain;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 215, 0, 0.12);
    flex-shrink: 0;
}

.slot-img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    flex-shrink: 0;
}

/* ─── CLASE SELECT ───────────────────────────────────────────────── */
.class-select {
    width: 100%;
    padding: 12px 40px 12px 16px;
    background: rgba(20, 20, 20, 0.9);
    color: #f5e6a1;
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 999px;
    font-family: 'Cinzel', serif;
    font-size: 0.88rem;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23ffd700' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    transition: border-color 0.2s ease;
}

.class-select:hover { border-color: rgba(255, 215, 0, 0.4); }
.class-select:focus  { border-color: rgba(255, 215, 0, 0.8); box-shadow: 0 0 0 2px rgba(255,215,0,0.08); }
.class-select option { background: #111; color: #f5e6a1; }

/* ─── STATS SLIDERS ──────────────────────────────────────────────── */
.stat-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px 4px;
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-row label {
    width: 110px;
    font-size: 0.82rem;
    color: #bbb;
    flex-shrink: 0;
    letter-spacing: 0.04em;
}

.stat-row input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    flex-grow: 1;
    height: 14px;
    border-radius: 4px;
    background: #111;
    outline: none;
    border: 1px solid rgba(255,255,255,0.06);
    overflow: hidden;
    cursor: pointer;
}

.stat-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #fff;
    border: 2px solid gold;
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
}

.stat-row input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #fff;
    border: 2px solid gold;
    cursor: pointer;
}

.stat-value {
    width: 28px;
    text-align: right;
    font-weight: bold;
    font-size: 0.9rem;
    flex-shrink: 0;
    --valor-stat: 0;
    color: rgb(
        calc(200 + (55 * var(--valor-stat) / 99)),
        calc(180 + (40 * var(--valor-stat) / 99)),
        calc(150 - (100 * var(--valor-stat) / 99))
    );
    text-shadow: 0 0 calc(1px + 6px * var(--valor-stat) / 99) rgba(255, 215, 0, calc(var(--valor-stat) / 130));
    transition: all 0.1s ease;
}

/* ─── BUILD STATS ────────────────────────────────────────────────── */
.bstat-grid { display: flex; flex-direction: column; gap: 18px; }
.bstat-group { display: flex; flex-direction: column; gap: 10px; }

.bstat-group-title {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 215, 0, 0.6);
    border-bottom: 1px solid rgba(255, 215, 0, 0.1);
    padding-bottom: 5px;
}

.bstat-row { display: flex; align-items: center; gap: 10px; }

.bstat-label {
    width: 88px;
    font-size: 0.76rem;
    color: #bbb;
    flex-shrink: 0;
}

.bstat-bar-wrap {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.bstat-bar {
    height: 100%;
    width: var(--pct, 0%);
    background: var(--color, gold);
    border-radius: 3px;
    transition: width 0.3s ease;
    box-shadow: 0 0 5px var(--color, gold);
}

.bstat-val {
    width: 65px;
    text-align: right;
    font-size: 0.8rem;
    color: #f5e6a1;
    flex-shrink: 0;
}

.bstat-carga-label {
    font-size: 0.82rem;
    font-weight: bold;
    text-align: center;
    padding: 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: color 0.3s ease;
}

/* ─── BUFFS ───────────────────────────────────────────────────────── */
.buffs-lista {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 180px;
    overflow-y: auto;
}

.buffs-empty {
    color: rgba(255, 255, 255, 0.25);
    font-size: 0.75rem;
    text-align: center;
    font-style: italic;
    font-family: sans-serif;
    margin: 0;
}

.buff-item {
    background: rgba(255, 215, 0, 0.03);
    border: 1px solid rgba(255, 215, 0, 0.08);
    border-radius: 6px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.buff-nombre { color: #f5e6a1; font-size: 0.78rem; }
.buff-desc   { color: rgba(255,255,255,0.45); font-size: 0.7rem; line-height: 1.4; font-family: sans-serif; }

/* ─── AUTH ──────────────────────────────────────────────────────── */
#auth-card { display: flex; flex-direction: column; gap: 10px; }
#login-section { display: flex; justify-content: center; }

.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    min-height: 42px;
    background: rgba(20, 20, 20, 0.9);
    color: #f5e6a1;
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 999px;
    font-family: 'Cinzel', serif;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    margin-bottom: 0;
}

.auth-btn:hover {
    border-color: rgba(255, 215, 0, 0.6);
    color: #fff9cc;
    transform: translateY(-1px);
}

#user-section {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

#user-foto {
    border-radius: 50%;
    border: 2px solid rgba(255, 215, 0, 0.4);
    flex-shrink: 0;
}

#user-nombre {
    color: gold;
    font-size: 0.82rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#logout-btn {
    font-size: 0.7rem;
    padding: 6px 14px;
    min-height: 34px;
    margin-bottom: 0;
    border-color: rgba(255, 80, 80, 0.35);
    color: #ffaaaa;
    width: 100%;
}

#logout-btn:hover {
    border-color: rgba(255, 80, 80, 0.7);
    background: rgba(60, 10, 10, 0.8);
    color: #ffcccc;
}

/* ─── MODAL ──────────────────────────────────────────────────────── */
#modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(3px);
    z-index: 9998;
}

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: rgba(12, 12, 12, 0.98);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 12px;
    color: white;
    padding: 0;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    flex-direction: column;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(255, 215, 0, 0.08);
    overflow: hidden;
}

.modal.active { display: flex; }

.modal-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: rgba(255, 215, 0, 0.04);
    border-bottom: 1px solid rgba(255, 215, 0, 0.15);
    flex-shrink: 0;
}

.modal-header h2 { margin: 0; font-size: 1rem; }

.modal-search {
    padding: 12px 16px 8px;
    flex-shrink: 0;
}

.modal-search-input {
    width: 100%;
    padding: 9px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 999px;
    color: #f5e6a1;
    font-family: 'Cinzel', serif;
    font-size: 0.82rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.modal-search-input::placeholder { color: rgba(255, 215, 0, 0.3); }
.modal-search-input:focus { border-color: rgba(255, 215, 0, 0.6); }

.modal-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.close-btn {
    background: none;
    border: none;
    color: rgba(255, 215, 0, 0.7);
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    min-height: unset;
    margin: 0;
    line-height: 1;
    transition: color 0.2s;
}

.close-btn:hover { color: gold; transform: none; }

@media (max-width: 600px) {
    .modal {
        top: 0; left: 0;
        transform: none;
        width: 100%; height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
}

/* ─── ITEMS DEL MODAL ────────────────────────────────────────────── */
.option-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 8px;
    padding: 10px 12px;
    min-height: 48px;
    cursor: pointer;
    text-align: left;
    text-transform: none;
    letter-spacing: 0.02em;
    font-size: 0.82rem;
    margin-bottom: 0;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.option-item:hover {
    background: rgba(255, 215, 0, 0.05);
    border-color: rgba(255, 215, 0, 0.4);
    color: #fff9cc;
}

.option-item--clear {
    color: #ffaaaa;
    border-color: rgba(255, 80, 80, 0.25);
    justify-content: center;
}

.option-item--clear:hover {
    background: rgba(60, 10, 10, 0.5);
    border-color: rgba(255, 80, 80, 0.6);
}

.item-nombre { flex: 1; color: #ddd; font-size: 0.82rem; }
.item-peso   { font-size: 0.7rem; color: rgba(255,255,255,0.35); flex-shrink: 0; }

/* ─── MIS BUILDS ─────────────────────────────────────────────────── */
.build-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 215, 0, 0.12);
    border-radius: 8px;
    padding: 14px 16px;
    gap: 12px;
    transition: border-color 0.2s, background 0.2s;
}

.build-card:hover {
    border-color: rgba(255, 215, 0, 0.35);
    background: rgba(255, 255, 255, 0.05);
}

.build-card-info { display: flex; flex-direction: column; gap: 4px; }
.build-card-nombre { color: #f5e6a1; font-size: 0.9rem; }
.build-card-meta   { color: rgba(255, 215, 0, 0.55); font-size: 0.72rem; }
.build-card-actions { display: flex; gap: 8px; flex-shrink: 0; }

.btn-cargar  { font-size: 0.72rem; padding: 6px 12px; min-height: 32px; margin-bottom: 0; }
.btn-eliminar {
    font-size: 0.72rem; padding: 6px 12px; min-height: 32px; margin-bottom: 0;
    border-color: rgba(255, 80, 80, 0.35); color: #ffaaaa;
}
.btn-eliminar:hover { border-color: rgba(255,80,80,0.7); background: rgba(60,10,10,0.8); }

/* ─── RESPONSIVE ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .container { width: 95%; padding: 12px; }
    .main { flex-direction: column; }
    .left, .right { flex: none; width: 100%; }
    .right { order: -1; }

    h1 { font-size: 1.5rem; padding: 14px 0 8px; }
    h2 { font-size: 1rem; }

    .card { padding: 14px; }

    .equip-slots { gap: 8px; }
    .equip-slot  { height: 56px; font-size: 0.68rem; }

    .stat-row label { width: 85px; font-size: 0.78rem; }

    .bstat-label { width: 70px; font-size: 0.72rem; }
    .bstat-val   { width: 52px; font-size: 0.74rem; }

    .build-name-input { width: 88%; }

    .build-card { flex-direction: column; align-items: flex-start; }
    .build-card-actions { width: 100%; justify-content: flex-end; }

    button { font-size: 0.72rem; min-height: 40px; }

    #auth-card { flex-direction: row; flex-wrap: wrap; }
    #login-section { width: 100%; }
}