/* ============================================================
   SF Battle Games - Styles
   Dark theme: #181B21 background, #e91e63 accents (site pink)
   ============================================================ */

/* --- Base --- */
.sfbg-battle-list,
.sfbg-battle-play,
.sfbg-results-page,
.sfbg-create-form-wrap,
.sfbg-edit-game-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    color: #e0e0e0;
    font-family: inherit;
}

/* --- Buttons --- */
.sfbg-btn {
    display: inline-block;
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.sfbg-btn:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

.sfbg-btn:active {
    transform: translateY(0);
}

.sfbg-btn-primary {
    background: #e91e63;
    color: #fff;
}

.sfbg-btn-primary:hover {
    background: #f06292;
    color: #fff;
}

.sfbg-btn-play {
    background: #e91e63;
    color: #fff;
    width: 100%;
    padding: 8px 16px;
}

.sfbg-btn-play:hover {
    background: #f06292;
    color: #fff;
}

.sfbg-btn-vote {
    background: linear-gradient(135deg, #e91e63, #c2185b);
    color: #fff !important;
    padding: 14px 40px;
    font-size: 18px;
    font-weight: 700;
    border-radius: 10px;
    width: 100%;
    max-width: 220px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.3);
    position: relative;
    overflow: hidden;
}

.sfbg-btn-vote::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.4s ease;
}

.sfbg-btn-vote:hover {
    background: linear-gradient(135deg, #f06292, #e91e63);
    color: #fff !important;
    box-shadow: 0 6px 25px rgba(233, 30, 99, 0.5);
    transform: translateY(-2px);
}

.sfbg-btn-vote:hover::before {
    left: 100%;
}

.sfbg-btn-vote:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(233, 30, 99, 0.4);
}

.sfbg-btn-vote.sfbg-loading {
    opacity: 0.6;
    cursor: wait;
}

.sfbg-btn-submit {
    background: #28a745;
    color: #fff;
    padding: 12px 32px;
    font-size: 16px;
}

.sfbg-btn-submit:hover {
    background: #34c759;
    color: #fff;
}

.sfbg-btn-submit:disabled {
    background: #555;
    cursor: not-allowed;
    transform: none;
}

.sfbg-btn-remove {
    background: #dc3545;
    color: #fff;
    padding: 4px 12px;
    font-size: 13px;
    border-radius: 4px;
}

.sfbg-btn-remove:hover {
    background: #e04555;
    color: #fff;
}

/* --- Battle List --- */
.sfbg-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.sfbg-list-title {
    color: #fff;
    font-size: 28px;
    margin: 0;
}

.sfbg-games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.sfbg-game-card {
    background: #22262E;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #333;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sfbg-game-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.sfbg-card-thumbnail {
    height: 160px;
    overflow: hidden;
    background: #181B21;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sfbg-card-thumbnail > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sfbg-auto-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 0;
    position: relative;
}

.sfbg-auto-thumb img {
    width: 50%;
    height: 100%;
    object-fit: cover;
}

.sfbg-vs-mini {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: #e91e63;
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.sfbg-no-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #666;
    font-size: 14px;
}

.sfbg-card-body {
    padding: 14px 16px;
}

.sfbg-card-title {
    color: #fff;
    font-size: 16px;
    margin: 0 0 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sfbg-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #999;
    margin-bottom: 12px;
}

.sfbg-no-games {
    text-align: center;
    color: #999;
    font-size: 16px;
    padding: 40px 20px;
}

/* --- Pagination --- */
.sfbg-pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.sfbg-page-link,
.sfbg-page-current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.sfbg-page-link {
    background: #22262E;
    color: #ccc;
    border: 1px solid #333;
}

.sfbg-page-link:hover {
    background: #e91e63;
    color: #fff;
    border-color: #e91e63;
    text-decoration: none;
}

.sfbg-page-current {
    background: #e91e63;
    color: #fff;
}

/* --- Battle Play (Arena) --- */
.sfbg-play-header {
    text-align: center;
    margin-bottom: 24px;
}

.sfbg-play-title {
    color: #fff;
    font-size: 28px;
    margin: 0 0 8px;
}

.sfbg-play-description {
    color: #bbb;
    font-size: 15px;
    margin: 0 0 6px;
}

.sfbg-play-instructions {
    color: #e91e63;
    font-size: 14px;
    font-style: italic;
    margin: 0;
}

.sfbg-round-info {
    text-align: center;
    margin-bottom: 20px;
}

.sfbg-rounds-remaining {
    display: inline-block;
    background: #22262E;
    color: #aaa;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    border: 1px solid #333;
}

/* Arena layout */
.sfbg-arena {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 0;
    margin-bottom: 20px;
    position: relative;
}

.sfbg-contestant {
    flex: 1;
    max-width: 400px;
    background: #22262E;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    border: 2px solid #3a3f4a;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.sfbg-contestant:hover {
    border-color: #e91e63;
    box-shadow: 0 0 20px rgba(233, 30, 99, 0.3), 0 8px 25px rgba(0, 0, 0, 0.4);
    transform: scale(1.02);
}

.sfbg-contestant-image {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
    flex: 1;
}

.sfbg-contestant-image img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.sfbg-contestant:hover .sfbg-contestant-image img {
    transform: scale(1.03);
}

.sfbg-contestant-caption {
    color: #ccc;
    font-size: 14px;
    margin: 0 0 12px;
}

/* Vote confirmation overlay */
.sfbg-vote-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(76, 175, 80, 0.25);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.sfbg-vote-overlay.sfbg-show {
    opacity: 1;
}

.sfbg-vote-overlay .sfbg-checkmark {
    width: 80px;
    height: 80px;
    background: rgba(76, 175, 80, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(76, 175, 80, 0.5);
    animation: sfbgCheckPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sfbg-vote-overlay .sfbg-checkmark svg {
    width: 44px;
    height: 44px;
    fill: none;
    stroke: #fff;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@keyframes sfbgCheckPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    60% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Chosen card green glow */
.sfbg-contestant.sfbg-chosen {
    border-color: #4CAF50 !important;
    box-shadow: 0 0 30px rgba(76, 175, 80, 0.5), 0 0 60px rgba(76, 175, 80, 0.2) !important;
}

/* Non-chosen card dim */
.sfbg-contestant.sfbg-not-chosen {
    opacity: 0.4;
    transform: scale(0.97);
}

/* VS Badge - more prominent */
.sfbg-vs-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    min-width: 72px;
    font-size: 26px;
    font-weight: 900;
    color: #fff;
    background: linear-gradient(135deg, #e91e63, #c2185b);
    border-radius: 50%;
    height: 72px;
    align-self: center;
    margin: 0 -14px;
    z-index: 2;
    box-shadow: 0 4px 20px rgba(233, 30, 99, 0.4), 0 0 0 4px rgba(233, 30, 99, 0.15);
    position: relative;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 1px;
    animation: sfbgVsPulse 2s ease-in-out infinite;
}

@keyframes sfbgVsPulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(233, 30, 99, 0.4), 0 0 0 4px rgba(233, 30, 99, 0.15);
    }
    50% {
        box-shadow: 0 4px 25px rgba(233, 30, 99, 0.6), 0 0 0 8px rgba(233, 30, 99, 0.1);
    }
}

.sfbg-skip-wrap {
    text-align: center;
    margin-bottom: 20px;
}

.sfbg-skip-link {
    color: #888;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.sfbg-skip-link:hover {
    color: #ccc;
    text-decoration: underline;
}

/* Fade in animation */
.sfbg-fade-in {
    animation: sfbgFadeIn 0.4s ease;
}

@keyframes sfbgFadeIn {
    0% {
        opacity: 0.3;
        transform: scale(0.97);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* --- Results --- */
.sfbg-results-title,
.sfbg-results-heading {
    color: #fff;
    font-size: 24px;
    margin: 0 0 20px;
    text-align: center;
}

.sfbg-results-table {
    max-width: 800px;
    margin: 0 auto;
}

.sfbg-result-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #22262E;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid #333;
}

.sfbg-result-row.sfbg-bar-gold {
    border-color: #FFD700;
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.1), #22262E);
}

.sfbg-result-row.sfbg-bar-silver {
    border-color: #C0C0C0;
    background: linear-gradient(90deg, rgba(192, 192, 192, 0.08), #22262E);
}

.sfbg-result-row.sfbg-bar-bronze {
    border-color: #CD7F32;
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.08), #22262E);
}

.sfbg-result-rank {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    min-width: 40px;
    text-align: center;
}

.sfbg-bar-gold .sfbg-result-rank {
    color: #FFD700;
}

.sfbg-bar-silver .sfbg-result-rank {
    color: #C0C0C0;
}

.sfbg-bar-bronze .sfbg-result-rank {
    color: #CD7F32;
}

.sfbg-result-thumb {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.sfbg-result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sfbg-result-info {
    min-width: 100px;
    flex-shrink: 0;
}

.sfbg-result-caption {
    color: #e0e0e0;
    font-size: 14px;
    font-weight: 600;
}

.sfbg-result-stats {
    color: #888;
    font-size: 12px;
}

.sfbg-result-bar-wrap {
    flex: 1;
    height: 24px;
    background: #181B21;
    border-radius: 12px;
    overflow: hidden;
    min-width: 100px;
}

.sfbg-result-bar {
    height: 100%;
    border-radius: 12px;
    transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background: linear-gradient(90deg, #FFD700, #FF8C00);
}

.sfbg-bar-silver .sfbg-result-bar {
    background: linear-gradient(90deg, #C0C0C0, #888);
}

.sfbg-bar-bronze .sfbg-result-bar {
    background: linear-gradient(90deg, #CD7F32, #8B5E3C);
}

.sfbg-result-row:not(.sfbg-bar-gold):not(.sfbg-bar-silver):not(.sfbg-bar-bronze) .sfbg-result-bar {
    background: linear-gradient(90deg, #555, #444);
}

.sfbg-result-pct {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    min-width: 55px;
    text-align: right;
}

.sfbg-no-results {
    text-align: center;
    color: #999;
}

/* --- Create / Edit Game --- */
.sfbg-create-title,
.sfbg-edit-title {
    color: #fff;
    font-size: 24px;
    margin: 0 0 8px;
}

.sfbg-edit-desc {
    color: #999;
    margin: 0 0 20px;
    font-size: 14px;
}

.sfbg-create-form,
.sfbg-add-image-form {
    max-width: 600px;
}

.sfbg-form-group {
    margin-bottom: 16px;
}

.sfbg-form-group label {
    display: block;
    color: #ccc;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}

.sfbg-required {
    color: #e74c3c;
}

.sfbg-form-group input[type="text"],
.sfbg-form-group input[type="url"],
.sfbg-form-group textarea,
.sfbg-input {
    width: 100%;
    padding: 10px 14px;
    background: #181B21;
    border: 1px solid #444;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.sfbg-form-group input[type="text"]:focus,
.sfbg-form-group input[type="url"]:focus,
.sfbg-form-group textarea:focus,
.sfbg-input:focus {
    border-color: #e91e63;
    outline: none;
}

.sfbg-form-row {
    display: flex;
    gap: 16px;
}

.sfbg-form-half {
    flex: 1;
}

/* Image list in edit mode */
.sfbg-image-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin: 20px 0;
}

.sfbg-image-item {
    background: #22262E;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #333;
    text-align: center;
    padding-bottom: 8px;
}

.sfbg-image-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.sfbg-image-caption {
    display: block;
    padding: 6px 8px;
    color: #ccc;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sfbg-submit-wrap {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #333;
}

.sfbg-image-count {
    color: #999;
    font-size: 14px;
    margin-bottom: 12px;
}

.sfbg-warning {
    color: #e74c3c;
}

.sfbg-error {
    color: #e74c3c;
    text-align: center;
    padding: 20px;
}

.sfbg-error a {
    color: #e91e63;
}

.sfbg-completed-message {
    text-align: center;
    color: #999;
    padding: 20px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .sfbg-arena {
        flex-direction: column;
        align-items: center;
        gap: 0;
    }

    .sfbg-contestant {
        max-width: 100%;
        width: 100%;
    }

    .sfbg-vs-badge {
        margin: -14px 0;
        width: 56px;
        height: 56px;
        min-width: 56px;
        font-size: 22px;
    }

    .sfbg-contestant-image img {
        height: 200px;
    }

    .sfbg-result-row {
        flex-wrap: wrap;
    }

    .sfbg-result-bar-wrap {
        min-width: 100%;
        order: 10;
    }

    .sfbg-form-row {
        flex-direction: column;
        gap: 0;
    }

    .sfbg-games-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .sfbg-list-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .sfbg-btn-vote {
        padding: 12px 30px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .sfbg-games-grid {
        grid-template-columns: 1fr;
    }

    .sfbg-image-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}
