:root {
    --bg-main: #121216;
    --card-bg: #1c1c22;
    --input-bg: #26262d;
    --input-border: #3a3a44;

    --text-main: #e5e7eb;
    --text-soft: #9ca3af;

    --purple: #7c3aed;
    --purple-hover: #6d28d9;
    --purple-soft: rgba(124, 58, 237, 0.25);
}

/* =========================
   BASE / LOGIN
========================= */

body.login-body,
.app-body {
    background: linear-gradient(135deg, #0f0f12, #141418, #101014);
    color: var(--text-main);
}

/* Card */
.login-card {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.4);
}

/* Titles */
.login-title {
    font-weight: 700;
    color: var(--text-main);
}

.login-subtitle {
    color: var(--text-soft);
    font-size: 0.9rem;
}

/* Inputs */
.custom-input {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: #ffffff;
    border-radius: 10px;
    padding: 12px;
}

.custom-input::placeholder {
    color: #9ca3af;
}


.custom-input:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 0.2rem var(--purple-soft);
    background: #2b2b33;
}

/* Buttons */
.btn-login {
    background: #16a34a;
    border: none;
    font-weight: 600;
    border-radius: 10px;
    padding: 12px;
    color: white;
}

.btn-login:hover {
    background: #15803d;
}

.btn-register {
    background: var(--purple);
    border: none;
    font-weight: 600;
    border-radius: 10px;
    padding: 12px;
    color: white;
}

.btn-register:hover {
    background: var(--purple-hover);
}

/* Link */
.login-link {
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
}

.login-link:hover {
    color: #c4b5fd;
    text-decoration: underline;
}

/* =========================
   NAVBAR
========================= */

.app-navbar {
    background: rgba(28, 28, 34, 0.95);
    border-bottom: 1px solid rgba(124, 58, 237, 0.12);
    backdrop-filter: blur(10px);
    padding: 14px 0;
}

.app-brand {
    color: #ffffff;
    font-weight: 700;
}

.app-brand:hover {
    color: #c4b5fd;
}

.app-nav-links .nav-link {
    color: #d1d5db;
    margin: 0 10px;
}

.app-nav-links .nav-link.active {
    color: #ffffff;
}

/* =========================
   DASHBOARD
========================= */

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.add-match-btn {
    background: linear-gradient(135deg, var(--purple), #5b21b6);
    border: none;
    color: white;
    border-radius: 12px;
    padding: 12px 18px;
}

.stats-card {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 24px;
}

.stats-label {
    color: var(--text-soft);
}

.stats-value {
    font-size: 2rem;
    font-weight: 700;
}

/* =========================
   MATCH CARDS
========================= */

.match-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.match-item-card {
    background: rgba(36, 36, 44, 0.95);
    border: 1px solid rgba(124, 58, 237, 0.10);
    border-radius: 18px;
    padding: 18px;
}

.match-top-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.match-main-row {
    display: grid;
    grid-template-columns: 1fr 120px 1fr;
    align-items: center;
}

/* ===== DECKS ===== */

.deck-side {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* IZQUIERDA (tu deck) */
.deck-side {
    justify-content: flex-start;
}

/* DERECHA (rival ESPEJO) */
.deck-side-right {
    justify-content: flex-end;
    text-align: right;
}

/* TEXTO DEL RIVAL ALINEADO */
.deck-text-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.deck-sprite {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.deck-label {
    font-size: 0.8rem;
    color: var(--text-soft);
}

.deck-name {
    font-weight: 700;
}

/* SCORE */
.match-score-block {
    text-align: center;
}

.score-text {
    font-size: 1.4rem;
    font-weight: 800;
}

/* META */
.match-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #2f2f38;
}

.match-meta-left {
    display: flex;
    gap: 15px;
}

/* RESULT BADGE */
.result-badge {
    padding: 5px 10px;
    border-radius: 999px;
}

.win-badge {
    background: rgba(22, 163, 74, 0.2);
    color: #4ade80;
}

.loss-badge {
    background: rgba(220, 38, 38, 0.2);
    color: #f87171;
}

/* DELETE BUTTON */
.delete-btn {
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
}

.delete-btn:hover {
    color: #ef4444;
}

/* =========================
   MODAL
========================= */

.app-modal {
    background: #1c1c22;
    color: white;
}

.modal-cancel-btn {
    border: 1px solid #4b5563;
    color: #d1d5db;
}

.modal-cancel-btn:hover {
    background: #2a2a31;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 768px) {
    .match-main-row {
        grid-template-columns: 1fr;
    }

    .deck-side-right {
        justify-content: flex-start;
        text-align: left;
    }

    .deck-text-right {
        align-items: flex-start;
    }
}

.winrate-vs {
    color: #a78bfa; /* morado suave */
    font-weight: 600;
}

.profile-section {
    min-width: fit-content;
}

.profile-username {
    color: #d1d5db;
    font-weight: 500;
    font-size: 0.95rem;
}

.profile-button {
    background: transparent;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar-placeholder {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #7c3aed);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1;
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.25);
    cursor: pointer;
    transition: 0.2s ease;
    overflow: hidden;
}

.profile-avatar-placeholder:hover {
    transform: scale(1.04);
}

input, textarea {
    color: #ffffff !important;
}

label {
    color: #e5e7eb; /* gris claro legible */
}

@media (max-width: 768px) {

    .match-main-row {
        grid-template-columns: 1fr 80px 1fr;
        gap: 10px;
        align-items: center;
    }

    .deck-side {
        gap: 8px;
    }

    .deck-side-right {
        justify-content: flex-end;
    }

    .deck-text-right {
        align-items: flex-end;
    }

    .deck-sprite {
        width: 40px; 
        height: 40px;
    }

    .deck-name {
        font-size: 0.9rem;
    }

    .deck-label {
        font-size: 0.7rem;
    }

    .score-text {
        font-size: 1.2rem;
    }

    .versus-text {
        font-size: 0.7rem;
    }

    .match-meta {
        font-size: 0.8rem;
        gap: 8px;
    }

    .match-meta-left {
        gap: 10px;
    }

    .delete-btn {
        font-size: 0.85rem;
    }
}


/* =========================
   WORKING PAGE
========================= */

.working-image {
    max-width: 320px;
    width: 100%;
    object-fit: contain;
}

.working-title {
    color: #ffffff;
    font-size: 2rem;
    font-weight: 700;
}

.working-text {
    color: #9ca3af;
    font-size: 1.1rem;
}

/* Mobile */
@media (max-width: 768px) {
    .working-image {
        max-width: 220px;
    }

    .working-title {
        font-size: 1.5rem;
    }

    .working-text {
        font-size: 1rem;
    }
}


/* =========================
   EVENTS
========================= */

.event-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.event-item-card {
    background: rgba(36, 36, 44, 0.95);
    border: 1px solid rgba(124, 58, 237, 0.10);
    border-radius: 18px;
    padding: 20px;
    transition: 0.2s ease;
}

.event-item-card:hover {
    border-color: rgba(124, 58, 237, 0.24);
    transform: translateY(-1px);
}

.event-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.event-date {
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
}

.event-time {
    color: #9ca3af;
    font-size: 0.95rem;
}

.event-price-chip {
    background: rgba(124, 58, 237, 0.16);
    color: #c4b5fd;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 8px 12px;
    border-radius: 999px;
}

.event-title {
    color: #ffffff;
    font-size: 1.45rem;
    font-weight: 700;
    margin-bottom: 18px;
}

.event-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.event-meta-block {
    background: rgba(28, 28, 34, 0.8);
    border: 1px solid rgba(124, 58, 237, 0.08);
    border-radius: 14px;
    padding: 14px;
}

.event-meta-label {
    display: block;
    color: #9ca3af;
    font-size: 0.82rem;
    margin-bottom: 6px;
}

.event-meta-text {
    color: #ffffff;
    font-size: 0.96rem;
    margin-bottom: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 768px) {
    .event-meta-grid {
        grid-template-columns: 1fr;
    }

    .event-title {
        font-size: 1.2rem;
    }
}


/* =========================
   PROFILE
========================= */

.profile-card {
    background: rgba(28, 28, 34, 0.92);
    border: 1px solid rgba(124, 58, 237, 0.10);
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.20);
}

.profile-image-box {
    background: rgba(36, 36, 44, 0.95);
    border: 1px solid rgba(124, 58, 237, 0.10);
    border-radius: 16px;
    padding: 18px;
    text-align: center;
}

.profile-page-image,
.profile-page-placeholder {
    width: 220px;
    height: 220px;
    border-radius: 20px;
    object-fit: cover;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-page-image {
    border: 1px solid rgba(124, 58, 237, 0.16);
}

.profile-page-placeholder {
    background: linear-gradient(135deg, #3b82f6, #7c3aed);
    color: white;
    font-size: 4rem;
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(124, 58, 237, 0.25);
}

.locked-input {
    background: #2b2b33 !important;
    border: 1px solid #444450 !important;
    color: #b6b6c2 !important;
    border-radius: 10px;
    padding: 12px;
}

.locked-input:disabled {
    opacity: 1;
    cursor: not-allowed;
}

.profile-check {
    background: rgba(36, 36, 44, 0.95);
    border: 1px solid rgba(124, 58, 237, 0.10);
    border-radius: 12px;
    padding: 14px 16px;
    width: 100%;
}

.profile-check .form-check-input {
    background-color: #26262d;
    border-color: #5b5b66;
}

.profile-check .form-check-input:checked {
    background-color: var(--purple);
    border-color: var(--purple);
}

.profile-check .form-check-label {
    color: #ffffff;
}

@media (max-width: 768px) {
    .profile-page-image,
    .profile-page-placeholder {
        width: 180px;
        height: 180px;
    }
}


.navbar-profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.profile-check {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-check .form-check-input {
    margin-left: 0 !important;
    margin-top: 0;
}

.profile-check .form-check-label {
    margin: 0;
}

.delete-history-btn {
    background: #dc2626;
    border: none;
    color: white;
    font-weight: 600;
    border-radius: 10px;
    padding: 12px 18px;
    transition: 0.2s ease;
}

.delete-history-btn:hover {
    background: #b91c1c;
}

/* =========================
   FRIENDS
========================= */

.friend-search-wrapper {
    position: relative;
}

.friend-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #1c1c22;
    border: 1px solid rgba(124, 58, 237, 0.12);
    border-radius: 14px;
    overflow: hidden;
    z-index: 100;
    display: none;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.25);
}

.friend-search-item {
    padding: 12px 14px;
    color: #ffffff;
    cursor: pointer;
    transition: 0.2s ease;
}

.friend-search-item:hover {
    background: rgba(124, 58, 237, 0.12);
}

.friend-search-item.muted {
    color: #9ca3af;
    cursor: default;
}

.friends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
}

.friend-card-link {
    text-decoration: none;
    color: inherit;
}

.friend-card {
    background: rgba(36, 36, 44, 0.95);
    border: 1px solid rgba(124, 58, 237, 0.10);
    border-radius: 18px;
    padding: 18px;
    text-align: center;
    transition: 0.2s ease;
    height: 100%;
}

.friend-card:hover {
    border-color: rgba(124, 58, 237, 0.24);
    transform: translateY(-1px);
}

.friend-avatar-large,
.friend-avatar {
    object-fit: cover;
    border-radius: 50%;
    overflow: hidden;
}

.friend-avatar-large {
    width: 82px;
    height: 82px;
    display: block;
    margin: 0 auto;
}

.friend-avatar {
    width: 48px;
    height: 48px;
}

.friend-avatar-placeholder {
    background: linear-gradient(135deg, #3b82f6, #7c3aed);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.friend-username {
    color: #ffffff;
    font-weight: 700;
}

.friend-winrate {
    color: #9ca3af;
    font-size: 0.92rem;
}

.request-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.request-card {
    background: rgba(36, 36, 44, 0.95);
    border: 1px solid rgba(124, 58, 237, 0.10);
    border-radius: 16px;
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.friend-mini-card {
    display: flex;
    align-items: center;
    gap: 12px;
}

.request-actions {
    display: flex;
    gap: 10px;
}

/* =========================
   OTHER USER PROFILE
========================= */

.user-profile-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

@media (max-width: 768px) {
    .user-profile-info-grid {
        grid-template-columns: 1fr;
    }
}

.user-profile-info-grid .event-meta-block {
    text-align: left;
}

.user-profile-info-grid .event-meta-text {
    text-align: left;
}

.form-select.custom-input {
    text-align: left !important;
    text-align-last: left !important;
}

.form-select.custom-input option {
    text-align: left;
}