/* ========================================= */
/* === UI COMPONENTS === */
/* === Phase 4 - Extracted from index.html === */
/* ========================================= */

/* === DIFFICULTY BUTTONS === */
.diff-btn {
    background: transparent;
    border: 1px solid #666;
    color: #666;
    padding: 8px 16px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.2s;
    opacity: 0.6;
}

.diff-btn:hover {
    transform: scale(1.05);
    opacity: 1;
}

.diff-btn.selected {
    background: rgba(255, 255, 255, 0.1);
    opacity: 1;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

/* Difficulty Buttons (Neon Pills) - Modern Style */
.diff-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #888;
    padding: 8px 16px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 20px;
    font-weight: bold;
    font-family: 'Nunito', sans-serif;
    transition: all 0.2s;
}

/* Specific Colors on Hover/Select */
.diff-btn:nth-child(1):hover,
.diff-btn:nth-child(1).selected {
    background: rgba(76, 175, 80, 0.2);
    border-color: #4CAF50;
    color: #4CAF50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

.diff-btn:nth-child(2):hover,
.diff-btn:nth-child(2).selected {
    background: rgba(255, 215, 0, 0.2);
    border-color: #FFD700;
    color: #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.diff-btn:nth-child(3):hover,
.diff-btn:nth-child(3).selected {
    background: rgba(255, 82, 82, 0.2);
    border-color: #FF5252;
    color: #FF5252;
    box-shadow: 0 0 10px rgba(255, 82, 82, 0.3);
}

.diff-btn.selected {
    transform: scale(1.1);
}

/* === TOAST NOTIFICATIONS === */
.toast {
    visibility: hidden;
    min-width: 250px;
    background-color: rgba(0, 0, 0, 0.9);
    color: #fff;
    text-align: center;
    border-radius: 50px;
    padding: 16px 24px;
    position: fixed;
    z-index: 20000;
    left: 50%;
    top: 80px;
    transform: translateX(-50%);
    font-size: 16px;
    font-family: 'Inter', 'Noto Sans', sans-serif;
    font-weight: bold;
    border: 1px solid #FFD700;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    opacity: 0;
    transition: opacity 0.5s, top 0.5s;
}

/* The 'show' class makes it appear */
.toast.show {
    visibility: visible;
    opacity: 1;
    top: 180px;
}

/* === LOG ENTRY === */
.log-entry {
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 5px;
    margin-top: 2px;
    border-radius: 4px;
    animation: fadeOut 8s forwards;
}

@keyframes fadeOut {
    0% {
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* === BUTTON FOCUS STATES === */
button:focus,
.menu-btn:focus {
    outline: 4px solid #F4D03F;
    outline-offset: 4px;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(244, 208, 63, 0.6);
    z-index: 10;
}

/* Remove standard ugly blue browser outline if replaced above */
button:focus:not(:focus-visible) {
    outline: none;
}

summary:focus {
    outline: 2px solid #FFD700;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 4px;
}

/* === 3D CHAT BUBBLES === */
.chat-bubble {
    position: absolute;
    background: #fff;
    color: #000;
    padding: 8px 12px;
    border-radius: 12px;
    font-family: 'Verdana', sans-serif;
    font-weight: bold;
    font-size: 13px;
    pointer-events: none;
    transform: translate(-50%, -100%);
    white-space: normal;
    z-index: 3000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    opacity: 0;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    border: 2px solid #000;
    max-width: 200px;
    text-align: center;
}

/* The little triangle tail at the bottom */
.chat-bubble::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #000;
}

/* Inner white triangle to mask the border */
.chat-bubble::before {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid #fff;
    z-index: 1;
}

@keyframes popIn {
    from {
        transform: translate(-50%, -80%) scale(0.5);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -120%) scale(1);
        opacity: 1;
    }
}

@keyframes floatAway {
    to {
        transform: translate(-50%, -200%);
        opacity: 0;
    }
}

/* === ACHIEVEMENT ITEMS === */
.achieve-item {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 10px 5px;
    text-align: center;
    opacity: 0.4;
    filter: grayscale(100%);
    transition: all 0.3s;
}

/* Unlocked State (Glowing) */
.achieve-item.unlocked {
    opacity: 1;
    filter: none;
    background: rgba(255, 215, 0, 0.05);
    border: 1px solid #FFD700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.achieve-icon {
    font-size: 24px;
    margin-bottom: 5px;
    display: block;
}

.achieve-title {
    font-size: 9px;
    color: #ccc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.achieve-item.unlocked .achieve-title {
    color: #FFD700;
    font-weight: bold;
}

/* === DANGER ACCORDION STYLES === */
.danger-accordion {
    width: 100%;
    margin-top: 20px;
    border: 1px solid rgba(255, 85, 85, 0.3);
    background: rgba(50, 10, 10, 0.3);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Hover Effect for the whole block */
.danger-accordion:hover {
    border-color: rgba(255, 85, 85, 0.8);
    box-shadow: 0 0 15px rgba(255, 85, 85, 0.15);
}

/* The Clickable Header */
.danger-accordion summary {
    list-style: none;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-weight: bold;
    font-size: 12px;
    color: #ff8a80;
    letter-spacing: 1px;
    text-transform: uppercase;
    outline: none;
    transition: background 0.2s;
}

/* Hide default marker in Webkit/Chrome */
.danger-accordion summary::-webkit-details-marker {
    display: none;
}

.danger-accordion summary:hover {
    background: rgba(255, 85, 85, 0.1);
    color: #fff;
}

/* The Animated Arrow Icon */
.accordion-icon {
    font-size: 10px;
    transition: transform 0.3s ease;
    opacity: 0.7;
}

/* Rotate arrow when open */
.danger-accordion[open] .accordion-icon {
    transform: rotate(180deg);
    color: #fff;
}

/* The Content Body */
.accordion-content {
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid rgba(255, 85, 85, 0.2);
    padding: 20px;
    text-align: center;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* The Action Button (Refined) */
.btn-danger-action {
    background: linear-gradient(135deg, #b71c1c 0%, #d32f2f 100%);
    border: 1px solid #ff5252;
    color: white;
    padding: 12px 15px;
    width: 100%;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    font-family: 'Nunito', sans-serif;
    transition: transform 0.1s, box-shadow 0.2s;
    text-transform: uppercase;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.btn-danger-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(255, 82, 82, 0.4);
    background: linear-gradient(135deg, #c62828 0%, #e53935 100%);
}

.btn-danger-action:active {
    transform: scale(0.98);
}

/* === RECONNECT BUTTON STYLE === */
.btn-reconnect {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 100px;
    width: 85%;
    max-width: 380px;
    height: auto;
    padding: 18px;
    font-family: 'Fredoka One', cursive;
    font-size: 18px;
    text-transform: uppercase;
    color: #00e5ff;
    background: rgba(0, 229, 255, 0.05);
    border: 2px solid #00e5ff;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.1);
    animation: pulseCyan 2s infinite;
}

.btn-reconnect:hover {
    transform: scale(1.02);
    background: rgba(0, 229, 255, 0.15);
    box-shadow: 0 0 25px rgba(0, 229, 255, 0.4);
}

@keyframes pulseCyan {
    0% {
        box-shadow: 0 0 5px rgba(0, 229, 255, 0.1);
    }
    50% {
        box-shadow: 0 0 20px rgba(0, 229, 255, 0.3);
        border-color: #80f2ff;
    }
    100% {
        box-shadow: 0 0 5px rgba(0, 229, 255, 0.1);
    }
}

/* === SCREEN READER ONLY (Accessibility) === */
.sr-only {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* === RANK PROGRESS SLIDER === */
.rank-track-container {
    grid-column: span 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    margin: 10px 0 15px 0;
    padding: 0 10px;
}

/* The Grey Background Line */
.rank-track-bg {
    position: absolute;
    top: 50%;
    left: 10px;
    right: 10px;
    height: 4px;
    background: #333;
    transform: translateY(-50%);
    z-index: 0;
    border-radius: 2px;
}

/* The Individual Rank Nodes */
.rank-node {
    width: 12px;
    height: 12px;
    background: #222;
    border: 2px solid #555;
    border-radius: 50%;
    z-index: 1;
    position: relative;
    transition: all 0.5s ease;
}

/* ACTIVE STATE (Lit Up) */
.rank-node.active {
    transform: scale(1.3);
    border-color: #fff;
    box-shadow: 0 0 10px currentColor;
    background: currentColor;
}

/* The Colored Line Progress */
.rank-track-fill {
    position: absolute;
    top: 50%;
    left: 10px;
    height: 4px;
    background: #fff;
    transform: translateY(-50%);
    z-index: 0;
    width: 0%;
    transition: width 1s ease;
    border-radius: 2px;
}

/* === RANK NODE TOOLTIPS (HOVER EFFECT) === */

/* The Tooltip Box */
.rank-node::after {
    content: attr(data-rank);
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 15, 0.95);
    border: 1px solid currentColor;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-family: 'Inter', 'Noto Sans', sans-serif;
    font-weight: bold;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
}

/* The Tiny Arrow pointing down */
.rank-node::before {
    content: '';
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid currentColor;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 10;
}

/* Hover State: Show Tooltip & Lift it slightly */
.rank-node:hover::after,
.rank-node:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-5px);
}

/* Scale up the node itself slightly on hover for feedback */
.rank-node:hover {
    transform: scale(1.5);
    cursor: pointer;
}

/* === DESKTOP ONLY: Pin Reset Button to Bottom === */
@media (min-width: 769px) {
    #reset-save-container {
        position: absolute;
        bottom: 30px;
        left: 50%;
        transform: translateX(-50%);
        margin: 0 !important;
        z-index: 200;
    }
}
