/**
 * Bescape Game Remaster - Frontend Styles
 *
 * @package FoolsMate\BescapeRemaster
 */

/* =============================================================================
   CSS Variables
   ============================================================================= */

:root {
    --bgr-primary: #E97A0D;
    --bgr-primary-dark: #c96a0a;
    --bgr-secondary: #4D4D4D;
    --bgr-success: #28a745;
    --bgr-error: #dc3545;
    --bgr-warning: #ffc107;
    --bgr-light: #f5f5f5;
    --bgr-border: #ddd;
    --bgr-radius: 8px;
    --bgr-transition: 0.3s ease;
}

/* =============================================================================
   Team Manager
   ============================================================================= */

.bgr-team-manager {
    max-width: 500px;
    margin: 2rem auto;
    padding: 2rem;
    background: #fff;
    border-radius: var(--bgr-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.bgr-team-active {
    text-align: center;
}

.bgr-team-name-display {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--bgr-border);
}

.bgr-team-name-label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.bgr-team-active .bgr-team-name {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--bgr-primary);
}

.bgr-team-info {

    margin-bottom: 1.5rem;
}

.bgr-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.bgr-team-code {
    display: inline-block;
    font-size: 2rem;
    font-weight: bold;
    font-family: monospace;
    letter-spacing: 4px;
    padding: 0.5rem 1rem;
    background: var(--bgr-light);
    border-radius: var(--bgr-radius);
    margin-right: 0.5rem;
}

.bgr-copy-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    cursor: pointer;
    background: var(--bgr-primary);
    color: #fff;
    border: none;
    border-radius: var(--bgr-radius);
    transition: background var(--bgr-transition);
}

.bgr-copy-btn:hover {
    background: var(--bgr-primary-dark);
}

.bgr-leave-btn {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    background: var(--bgr-primary);
    color: #fff;
    border: none;
    border-radius: var(--bgr-radius);
    transition: background var(--bgr-transition);
    white-space: nowrap;
}

.bgr-leave-btn:hover {
    background: var(--bgr-primary-dark);
}

.bgr-team-forms h3 {
    margin: 0 0 1rem;
    font-size: 1.1rem;
    color: var(--bgr-secondary);
}

.bgr-form form {
    display: flex;
    gap: 0.5rem;
}

.bgr-form input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--bgr-border);
    border-radius: var(--bgr-radius);
    font-size: 1rem;
}

.bgr-form button {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    background: var(--bgr-primary);
    color: #fff;
    border: none;
    border-radius: var(--bgr-radius);
    transition: background var(--bgr-transition);
    white-space: nowrap;
}

.bgr-form button:hover {
    background: var(--bgr-primary-dark);
}

.bgr-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.bgr-divider {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
}

.bgr-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--bgr-border);
}

.bgr-divider span {
    position: relative;
    background: #fff;
    padding: 0 1rem;
    color: #999;
}

.bgr-feedback {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: var(--bgr-radius);
}

.bgr-feedback-success {
    color: var(--bgr-success);
}

.bgr-feedback-error {
    color: var(--bgr-error);
}

/* =============================================================================
   Score Display
   ============================================================================= */

.bgr-score-display {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: bold;
}

.bgr-score-label {
    color: #666;
    font-weight: normal;
}

.bgr-score-value {
    color: var(--bgr-primary);
    font-family: monospace;
    min-width: 80px;
    text-align: right;
}

.bgr-score-loading {
    animation: pulse 1s infinite;
}

.bgr-score-updated {
    animation: scoreUp 0.5s ease;
}

.bgr-score-unit {
    color: #666;
    font-weight: normal;
    font-size: 0.9em;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes scoreUp {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
        color: var(--bgr-success);
    }

    100% {
        transform: scale(1);
    }
}

/* =============================================================================
   Timer
   ============================================================================= */

/* =============================================================================
   Timer
   ============================================================================= */

.bgr-timer {
    display: flex;
    justify-content: center;
    width: 100%;
    margin: 1rem 0;
    font-family: monospace;
}

.bgr-timer-display {
    font-size: 2rem;
    font-weight: bold;
    padding: 0.5rem 1rem;
    background: var(--bgr-secondary);
    color: #fff;
    border-radius: var(--bgr-radius);
}

.bgr-timer-inactive .bgr-timer-display {
    background: #ccc;
}

.bgr-timer-warning .bgr-timer-display {
    background: var(--bgr-warning);
    color: var(--bgr-secondary);
}

.bgr-timer-critical .bgr-timer-display {
    background: var(--bgr-error);
    animation: blink 0.5s infinite;
}

.bgr-timer-expired .bgr-timer-display {
    background: var(--bgr-error);
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* =============================================================================
   Leaderboard
   ============================================================================= */

.bgr-leaderboard {
    max-width: 600px;
    margin: 2rem auto;
}

.bgr-leaderboard-title {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--bgr-secondary);
    display: none;
    /* Hide title if requested "Ohne Header" implies this too, but request said "Header and BG" likely table header */
}

.bgr-leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
    /* No BG */
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
    /* No shadow */
}

/* Hide Table Header */
.bgr-leaderboard-table thead {
    display: none;
}

.bgr-leaderboard-table th,
.bgr-leaderboard-table td {
    padding: 0.75rem 0;
    /* Horizontal padding reduced */
    text-align: left;
    border-bottom: 1px solid rgba(221, 221, 221, 0.5);
    /* Lighter border */
}

.bgr-leaderboard-table th {
    background: transparent;
    color: var(--bgr-secondary);
    font-weight: 600;
}

.bgr-leaderboard-table .bgr-rank {
    width: 40px;
    text-align: center;
    font-weight: bold;
    color: var(--bgr-secondary);
}

.bgr-leaderboard-table .bgr-score {
    text-align: right;
    font-family: monospace;
    font-weight: bold;
    color: var(--bgr-leaderboard-color, #e20074);
    /* Configurable Color */
}

.bgr-leaderboard-table .bgr-time {
    text-align: right;
    font-family: monospace;
    color: #666;
    font-size: 0.9em;
    padding-left: 1rem;
}

.bgr-leaderboard-row:last-child td {
    border-bottom: none;
}

/* Rank Highlights using variables */
.bgr-top-1 .bgr-rank {
    color: #FFD700;
}

.bgr-top-2 .bgr-rank {
    color: #C0C0C0;
}

.bgr-top-3 .bgr-rank {
    color: #CD7F32;
}

.bgr-team-name {
    font-weight: 600;
}

.bgr-team-code {
    font-size: 0.85rem;
    color: #999;
    margin-left: 0.5rem;
}

.bgr-leaderboard-empty {
    text-align: center;
    color: #666;
    padding: 2rem;
}

/* =============================================================================
   Hint Visualizer
   ============================================================================= */

/* SVG Badge Styles (applied via inline SVG) */
.bgr-badge {
    fill: #CCCCCC;
    transition: fill 0.5s ease-in-out;
}

.bgr-badge.is-active {
    fill: #E97A0D;
}

.bgr-hint-badges {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.bgr-badge-indicator {
    width: 60px;
    /* Wider badges as per previous design logic perhaps? Or circles? */
    height: 12px;
    border-radius: 6px;
    background: #ccc;
    transition: background 0.3s ease;
}

.bgr-badge-indicator.is-active {
    background: var(--bgr-primary);
    box-shadow: 0 0 10px var(--bgr-primary);
}

/* Solution Badge (4th element) */
.bgr-badge-indicator[data-badge="4"] {
    background: #ccc;
}

.bgr-badge-indicator[data-badge="4"].is-active {
    background: var(--bgr-solution-color, #28a745);
    /* Configurable Green */
    box-shadow: 0 0 10px var(--bgr-solution-color, #28a745);
}

/* =============================================================================
   Notifications
   ============================================================================= */

.bgr-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    padding: 2rem;
    background: #fff;
    color: #333;
    border-radius: var(--bgr-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    text-align: center;
    max-width: 90%;
    width: 400px;
}

.bgr-notification-visible {
    opacity: 1;
    pointer-events: all;
    transform: translate(-50%, -50%) scale(1);
}

.bgr-notification-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.bgr-notification-visible+.bgr-notification-backdrop,
.bgr-notification-backdrop.is-visible {
    opacity: 1;
    pointer-events: all;
}

.bgr-notification h3 {
    margin-top: 0;
    color: var(--bgr-success);
}

.bgr-solution-code {
    display: block;
    font-family: monospace;
    font-size: 2rem;
    background: #f5f5f5;
    padding: 1rem;
    margin: 1rem 0;
    border: 2px dashed #ccc;
    border-radius: var(--bgr-radius);
    cursor: pointer;
    transition: background 0.2s;
}

.bgr-solution-code:hover {
    background: #e9ecef;
}

.bgr-solution-note {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1.5rem;
}

/* =============================================================================
   Hint Visualizer - Progressive Segment Fill
   ============================================================================= */

.bgr-hint-visualizer {
    position: fixed;
    bottom: var(--bgr-hint-offset, 20px);
    left: var(--bgr-hint-offset, 20px);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.bgr-hint-logo {
    width: var(--bgr-hint-height, 120px);
    height: var(--bgr-hint-height, 120px);
    position: relative;
}

.bgr-hint-logo svg {
    width: 100%;
    height: 100%;
}

/* Segment Progress Wrappers - CSS Mask Layer */
.bgr-segment-progress {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

/* Progress Bar Base */
.bgr-progress-bar {
    position: absolute;
    background: var(--bgr-primary);
}

/* Segment 1: Horizontal fill (left → right) */
.bgr-progress-bar-horizontal {
    top: 0;
    left: 0;
    width: 0%;
    height: 100%;
    background: linear-gradient(to right, var(--bgr-primary) 90%, rgba(233, 122, 13, 0.5) 100%);
}

/* Segment 2: Vertical fill with skew for uniform look */
.bgr-progress-bar-vertical-2 {
    top: 0;
    left: 0;
    width: 150%;
    height: 0%;
    transform: skewY(-10deg);
    transform-origin: top left;
    background: linear-gradient(to bottom, var(--bgr-primary) 90%, rgba(233, 122, 13, 0.5) 100%);
}

/* Segment 3: Vertical fill with opposite skew */
.bgr-progress-bar-vertical-3 {
    top: 0;
    left: 0;
    width: 150%;
    height: 0%;
    transform: skewY(10deg);
    transform-origin: top left;
    background: linear-gradient(to bottom, var(--bgr-primary) 90%, rgba(233, 122, 13, 0.5) 100%);
}

/* Badge Indicators (dots below logo) */
.bgr-hint-badges {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.bgr-badge-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #CCCCCC;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.bgr-badge-indicator.is-active {
    background: var(--bgr-primary);
    box-shadow: 0 0 10px var(--bgr-primary);
}

/* =============================================================================
   Responsive
   ============================================================================= */

@media (max-width: 600px) {
    .bgr-team-manager {
        margin: 1rem;
        padding: 1.5rem;
    }

    .bgr-form form {
        flex-direction: column;
    }

    .bgr-team-code {
        font-size: 1.5rem;
        display: block;
        margin-bottom: 0.5rem;
    }

    .bgr-leaderboard-table th,
    .bgr-leaderboard-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
    }

    .bgr-hint-logo {
        width: 150px;
        height: 150px;
    }
}

/* =============================================================================
   Segment 4: Solution (Bottom) - Fills top-to-bottom
   ============================================================================= */
.bgr-progress-bar-solution {
    top: 0;
    left: 0;
    width: 0%;
    height: 100%;
    background: linear-gradient(to right, var(--bgr-solution-color, #28a745) 90%, rgba(40, 167, 69, 0.5) 100%);
    transition: width 0.3s linear, height 0.3s linear;
}