/* ================================================================= */
/* User Profile Modal Plugin Stylesheet                              */
/* Matches the glassmorphic dark-theme design of ARRLSTX             */
/* ================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@600;700&family=Inter:wght@400;500;600;700;800&display=swap');

/* Modal Overlay covering full screen */
.upm-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 15, 30, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 999999;
    display: none; /* Controlled by JS class activation */
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.upm-modal-overlay.active {
    display: flex;
}

/* Modal Content Card: Large layout container */
.upm-modal-content {
    background: linear-gradient(145deg, #16153a 0%, #0d1220 50%, #070b14 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    width: 1100px;
    max-width: 95vw;
    height: 650px;
    max-height: 90vh;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 50px rgba(28, 217, 252, 0.2);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: upm-zoom-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    transform: scale(0.85);
    box-sizing: border-box;
}

@keyframes upm-zoom-in {
    0% { transform: scale(0.7); opacity: 0; }
    100% { transform: scale(0.85); opacity: 1; }
}

/* Close button style matching leaderboard modal */
.upm-modal-close {
    position: absolute;
    top: 20px; right: 20px;
    width: 36px; height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: #94a3b8;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 100;
    line-height: 1;
}

.upm-modal-close:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
    transform: rotate(90deg);
}

/* Split Layout Columns */
.upm-modal-split-layout {
    display: flex;
    height: 100%;
    width: 100%;
}

/* Left side columns: Profile card */
.upm-modal-left {
    width: 40%;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding: 40px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-sizing: border-box;
}

/* Right side columns: Merit breakdown chart */
.upm-modal-right {
    width: 60%;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    box-sizing: border-box;
}

/* Left-column specifics */
.upm-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 25px;
}

.upm-avatar-container {
    position: relative;
    margin-bottom: 15px;
}

.upm-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid #1CD9FC;
    box-shadow: 0 0 25px rgba(28, 217, 252, 0.4);
    object-fit: cover;
}

.upm-username {
    font-family: 'Oswald', sans-serif !important;
    font-size: 2.4rem !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 5px 0 2px 0 !important;
    text-shadow: 0 0 10px rgba(28, 217, 252, 0.6);
}

.upm-points-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(56, 189, 248, 0.1));
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 99px;
    padding: 6px 16px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #10b981;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 5px;
}

.upm-views-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(99, 102, 241, 0.1));
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 99px;
    padding: 6px 16px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #38bdf8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 5px;
}

.upm-bio {
    font-size: 0.95rem;
    color: #cbd5e1;
    line-height: 1.6;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 25px;
    width: 100%;
    box-sizing: border-box;
}

/* Badges section */
.upm-badges-container {
    width: 100%;
}

.upm-badges-title {
    font-family: 'Oswald', sans-serif !important;
    font-size: 1.2rem;
    color: #1CD9FC;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(28, 217, 252, 0.2);
    padding-bottom: 6px;
}

.upm-badges-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.upm-badge-pill {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.upm-badge-pill:hover {
    background: rgba(28, 217, 252, 0.1);
    border-color: rgba(28, 217, 252, 0.3);
    transform: translateY(-1px);
}

.upm-badge-icon {
    font-size: 1.25rem;
}

.upm-badge-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: #e2e8f0;
}

.upm-no-badges {
    font-size: 0.85rem;
    color: #64748b;
    font-style: italic;
}

/* Right-column specifics: D3 Chart */
.upm-chart-header {
    text-align: center;
    margin-bottom: 20px;
    width: 100%;
}

.upm-chart-title {
    font-family: 'Oswald', sans-serif !important;
    font-size: 2.2rem;
    font-weight: 700;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 0 0 4px 0;
    text-shadow: 0 0 10px rgba(255,255,255,0.2);
}

.upm-chart-header p {
    font-size: 0.9rem;
    color: #94a3b8;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.upm-chart-wrapper {
    position: relative;
    width: 100%;
    height: 380px;
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* D3 Chart Tooltips and Lines */
.pieChart {
    overflow: visible;
}

.slices path {
    transition: fill 0.2s ease;
    cursor: pointer;
}

.slices path:hover {
    filter: brightness(1.2);
}

.lines polyline {
    fill: none;
    stroke: rgba(255, 255, 255, 0.3);
    stroke-width: 1px;
}

.labels text {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    fill: #cbd5e1;
}

/* Replay button styling matching leaderboard widget styling */
.upm-replay-btn {
    background: linear-gradient(135deg, #38bdf8, #2563eb) !important;
    color: white !important;
    border: none !important;
    padding: 10px 24px !important;
    border-radius: 99px !important;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(37,99,235,0.4) !important;
    margin-top: 15px;
}

.upm-replay-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37,99,235,0.6) !important;
}

/* Clickable triggers */
.upm-clickable-user {
    cursor: pointer !important;
    transition: color 0.15s ease;
}

.upm-clickable-user:hover {
    color: #1CD9FC !important;
    text-decoration: underline !important;
}

/* Styling when rendered inside an iframe (Scale down by 40%) */
body.upm-in-iframe .upm-modal-overlay {
    align-items: flex-start !important;
    padding-top: 50px !important;
}

body.upm-in-iframe .upm-modal-content {
    transform: scale(0.6) !important;
    transform-origin: center center !important;
    margin-top: -150px !important;
    animation: upm-zoom-in-iframe 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

@keyframes upm-zoom-in-iframe {
    0% { transform: scale(0.51); opacity: 0; }
    100% { transform: scale(0.6); opacity: 1; }
}

/* Texas Modal Custom Styles */
.texas-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: flex-end; /* Align to the right side */
    align-items: flex-start; /* Align to the top */
    opacity: 0;
    pointer-events: none;
    z-index: 99999;
    transition: opacity 900ms ease;
}

.texas-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.texas-border-wrapper {
    position: relative;
    margin-top: 30px;
    margin-right: 30px;
    filter: drop-shadow(4px 0 0 #FFBF00) drop-shadow(-4px 0 0 #FFBF00) drop-shadow(0 4px 0 #FFBF00) drop-shadow(0 -4px 0 #FFBF00) drop-shadow(0 10px 15px rgba(0,0,0,0.5));
    transition: transform 900ms cubic-bezier(0.25, 1, 0.5, 1), opacity 900ms ease;
    opacity: 0;
    transform: translateX(100vw);
}

.texas-modal-overlay.active .texas-border-wrapper {
    opacity: 1;
    transform: translateX(0) scale(0.7);
    transform-origin: top right;
}

.texas-modal-overlay.hiding .texas-border-wrapper {
    transition: transform 1700ms cubic-bezier(0.25, 1, 0.5, 1), opacity 1700ms ease;
    transform: scale(0.07) translate(-100vw, 100vh);
    transform-origin: top right;
    opacity: 0;
}

.texas-modal {
    width: 560px;
    height: 500px;
    background-color: #0A2540;
    position: relative;
    clip-path: url(#texas-clip);
    display: flex;
    justify-content: center;
    align-items: center;
}

.texas-modal-content {
    width: 250px;
    height: 270px;
    margin-top: 35px; /* offset panhandle */
    margin-left: 55px; /* offset mass */
    color: #FFFFFF;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.texas-badge-img {
    width: 110px;
    height: 110px;
    object-fit: contain;
    margin-bottom: 10px;
}

.texas-title {
    font-size: 31px !important;
    font-weight: 800 !important;
    color: #FFFFFF !important;
    margin: 0 !important;
    line-height: 1.1 !important;
    font-family: inherit !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    text-align: center;
}

.texas-title-row1, .texas-title-row2 {
    display: block;
    white-space: nowrap;
}

.texas-title-row1 {
    margin-bottom: 3px;
}

.texas-text {
    font-size: 18px !important;
    color: #FFFFFF !important;
    margin: 0 !important;
    line-height: 1.3 !important;
    font-family: inherit !important;
}

.texas-btn {
    background-color: #f97316;
    color: #FFFFFF;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    white-space: nowrap;
}

.texas-btn:hover {
    background-color: #ea580c;
    transform: scale(1.05);
}

.texas-close-icon {
    position: absolute;
    top: 125px;
    right: 40px;
    background: transparent;
    border: none;
    color: #FFFFFF;
    font-size: 2.1em;
    cursor: pointer;
    z-index: 10;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.9);
    line-height: 1;
}

.texas-close-icon:hover {
    color: #FFBF00;
}

/* Mobile device overrides for Texas Modal enter/exit animations */
@media (max-width: 768px) {
    .texas-border-wrapper {
        margin-top: 15px;
        margin-right: auto;
        margin-left: auto;
        /* Enter from left instead of right */
        transform: translateX(-100vw);
    }
    
    .texas-modal-overlay {
        justify-content: center; /* Center on mobile */
    }

    .texas-modal-overlay.active .texas-border-wrapper {
        transform: translateX(0) scale(0.6); /* Slightly smaller scale for mobile */
        transform-origin: center center;
    }

    .texas-modal-overlay.hiding .texas-border-wrapper {
        /* Exit to the opposite direction: top-right/bottom-right instead of down-left */
        transform: scale(0.07) translate(100vw, -100vh);
        transform-origin: center center;
    }
}


