/* ==========================================================================
   Modal Moderno de Medalha - Versão Compacta com Suporte Dark/Light
   (CSS COMPLETO ATUALIZADO)
   ========================================================================== */

/* -----------------------------
   TOKENS (LIGHT/DARK)
   Coloque estes tokens UMA vez.
   ----------------------------- */
:root {
    --medal-btn-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --medal-btn-text: #ffffff;
    --medal-btn-shadow: 0 6px 15px rgba(102, 126, 234, 0.25);
    --medal-btn-shadow-hover: 0 10px 25px rgba(102, 126, 234, 0.35);
    --medal-btn-gloss: rgba(255, 255, 255, 0.15);
}

[data-bs-theme="dark"] {
    --medal-btn-bg: linear-gradient(135deg, #7c5cff 0%, #a78bfa 100%);
    --medal-btn-text: #0b0b12;
    --medal-btn-shadow: 0 10px 25px rgba(167, 139, 250, 0.22);
    --medal-btn-shadow-hover: 0 14px 32px rgba(167, 139, 250, 0.30);
    --medal-btn-gloss: rgba(255, 255, 255, 0.18);
}

/* -----------------------------
   MODAL BASE
   ----------------------------- */
.medal-modal {
    border: none;
    border-radius: var(--bs-border-radius-lg);
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    transition: all 0.3s ease;
}

/* Header com gradiente e título */
.medal-modal-header {
    padding: 4rem 2rem 2rem;
    min-height: 180px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-content {
    padding-top: 1rem;
}

.header-gradient {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(
        135deg,
        #667eea 0%,
        #764ba2 25%,
        #f6d365 50%,
        #fda085 75%,
        #ff9a9e 100%
    );
    background-size: 300% 300%;
    animation: gradientShift 8s ease infinite;
    z-index: 0;
    opacity: 0.9;
}

[data-bs-theme="dark"] .header-gradient {
    opacity: 0.8;
}

.header-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(255, 255, 255, 0.2) 0%, transparent 50%);
    z-index: 1;
}

.header-sparkles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: 1;
}

.sparkle {
    position: absolute;
    background: linear-gradient(135deg, #ffffff 0%, rgba(255, 255, 255, 0.8) 100%);
    border-radius: 50%;
    animation: sparkleFloat 3s infinite ease-in-out;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.sparkle:nth-child(1) {
    width: 8px;
    height: 8px;
    top: 25%;
    left: 15%;
    animation-delay: 0s;
    animation-duration: 4s;
}

.sparkle:nth-child(2) {
    width: 6px;
    height: 6px;
    top: 20%;
    right: 20%;
    animation-delay: 0.7s;
    animation-duration: 3.5s;
}

.sparkle:nth-child(3) {
    width: 10px;
    height: 10px;
    bottom: 30%;
    left: 10%;
    animation-delay: 1.3s;
    animation-duration: 4.2s;
}

.sparkle:nth-child(4) {
    width: 7px;
    height: 7px;
    bottom: 25%;
    right: 15%;
    animation-delay: 2.1s;
    animation-duration: 3.8s;
}

.sparkle:nth-child(5) {
    width: 9px;
    height: 9px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 2.8s;
    animation-duration: 4.5s;
}

/* Título no header */
.medal-title {
    color: white;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.3px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 2;
}

.title-underline {
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 2px;
    animation: underlineWidth 3s ease-in-out infinite;
}

/* Medalha animada (menor) */
.medal-icon-container {
    margin-top: -40px;
    position: relative;
    z-index: 20;
}

.medal-wrapper {
    display: inline-block;
    position: relative;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.15));
}

.medal-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f6d365 0%, #fda085 50%, #ff9a9e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: medalFloat 4s ease-in-out infinite;
    box-shadow:
        0 10px 25px rgba(253, 160, 133, 0.3),
        inset 0 -6px 12px rgba(0, 0, 0, 0.12),
        inset 0 6px 12px rgba(255, 255, 255, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.3);
}

.medal-circle::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: linear-gradient(
        135deg,
        rgba(255, 215, 0, 0.3) 0%,
        rgba(255, 165, 0, 0.3) 50%,
        rgba(255, 69, 0, 0.3) 100%
    );
    border-radius: 50%;
    z-index: -1;
    animation: rotate 20s linear infinite;
}

.medal-inner {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ffffff 0%, #f0f0f0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 5px solid rgba(255, 255, 255, 0.9);
    box-shadow:
        inset 0 0 10px rgba(0, 0, 0, 0.1),
        0 4px 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

[data-bs-theme="dark"] .medal-inner {
    background: linear-gradient(145deg, #2d3748 0%, #4a5568 100%);
    border: 5px solid rgba(255, 255, 255, 0.8);
}

.medal-img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
    animation: medalPulse 3s ease-in-out infinite;
    transition: transform 0.3s ease;
}

/* Nome e descrição */
.medal-name {
    color: var(--bs-heading-color);
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.8rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.medal-description {
    color: var(--bs-secondary-color);
    font-size: 1.1rem;
    line-height: 1.5;
    max-width: 500px;
    margin: 0 auto 1.5rem;
    font-weight: 400;
    opacity: 0.9;
}

[data-bs-theme="dark"] .medal-description {
    opacity: 0.8;
}

/* -----------------------------
   BOTÃO (ATUALIZADO E DINÂMICO)
   ----------------------------- */
.medal-modal .btn-continue {
    background: var(--medal-btn-bg) !important;
    color: var(--medal-btn-text) !important;
    border: none !important;
    border-radius: 12px;

    padding: 0.9rem 1.8rem;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.3px;

    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: var(--medal-btn-shadow);

    max-width: 280px;
    margin: 0 auto;
}

.medal-modal .btn-continue:hover {
    transform: translateY(-3px);
    box-shadow: var(--medal-btn-shadow-hover);
    color: var(--medal-btn-text) !important;
}

.medal-modal .btn-continue:active {
    transform: translateY(-1px);
}

.medal-modal .btn-continue::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--medal-btn-gloss), transparent);
    transition: left 0.6s ease;
}

.medal-modal .btn-continue:hover::before {
    left: 100%;
}

.medal-modal .btn-continue i {
    font-size: 1em;
    vertical-align: middle;
}

/* -----------------------------
   ANIMAÇÕES
   ----------------------------- */
@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes medalFloat {
    0%, 100% { transform: translateY(0) rotate(0deg) scale(1); }
    25% { transform: translateY(-12px) rotate(2deg) scale(1.02); }
    50% { transform: translateY(-4px) rotate(-1deg) scale(1.01); }
    75% { transform: translateY(-8px) rotate(1deg) scale(1.015); }
}

@keyframes medalPulse {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.06) rotate(2deg); }
}

@keyframes ringPulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.06); }
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.25; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.12); }
}

@keyframes sparkleFloat {
    0% { opacity: 0; transform: translateY(0) rotate(0deg) scale(0.5); }
    50% { opacity: 1; transform: translateY(-25px) rotate(180deg) scale(1); }
    100% { opacity: 0; transform: translateY(-50px) rotate(360deg) scale(0.5); }
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes underlineWidth {
    0%, 100% { width: 80px; }
    50% { width: 100px; }
}

/* -----------------------------
   RESPONSIVIDADE
   ----------------------------- */
@media (max-width: 768px) {
    .medal-modal {
        margin: 0.5rem;
        border-radius: 18px;
    }

    .medal-modal-header {
        padding: 3rem 1.5rem 1.5rem;
        min-height: 150px;
    }

    .header-gradient {
        height: 160px;
    }

    .medal-title {
        font-size: 1.5rem;
        margin-bottom: 0.4rem;
    }

    .title-underline {
        width: 60px;
        height: 3px;
    }

    .medal-circle {
        width: 120px;
        height: 120px;
    }

    .medal-inner {
        width: 95px;
        height: 95px;
        border-width: 4px;
    }

    .medal-img {
        width: 60px;
        height: 60px;
    }

    .medal-name {
        font-size: 1.4rem;
    }

    .medal-description {
        font-size: 1rem;
        padding: 0 1rem;
        margin-bottom: 1.2rem;
    }

    .medal-modal .btn-continue {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
        max-width: 240px;
    }
}

@media (max-width: 480px) {
    .medal-modal-header {
        padding: 2.5rem 1rem 1rem;
        min-height: 130px;
    }

    .medal-title {
        font-size: 1.3rem;
    }

    .medal-circle {
        width: 100px;
        height: 100px;
    }

    .medal-inner {
        width: 80px;
        height: 80px;
    }

    .medal-img {
        width: 50px;
        height: 50px;
    }

    .medal-name {
        font-size: 1.2rem;
    }

    .title-underline {
        width: 50px;
    }

    .medal-modal .btn-continue {
        padding: 0.7rem 1.2rem;
        font-size: 0.95rem;
        max-width: 200px;
    }
}