:root {
    --bg-color: #0d0e12;
    --bg-surface: #1c1e26;
    --bg-surface-hover: #252833;
    --text-main: #ffffff;
    --text-muted: #9ca3af;
    --border: #373c4b;
    --border-hover: #4b5266;
    --accent: #e5e5e5;
    --success: #3fb950;
    --danger: #f85149;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* --- HEADER --- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border);
}

.logo {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.stats-panel {
    display: flex;
    gap: 40px;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.stat-box span:first-child {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-box .highlight {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-main);
}
.stat-box .highlight.money {
    color: var(--success);
}

/* --- NAVIGATION TABS --- */
.tabs {
    display: flex;
    justify-content: center;
    gap: 30px;
    padding: 25px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 30px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 4px;
    cursor: pointer;
    transition: color 0.2s ease;
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--text-main);
    border-bottom: 2px solid var(--text-main);
}

.tab-btn.admin-tab {
    color: var(--danger);
}
.tab-btn.admin-tab.active {
    border-bottom-color: var(--danger);
}

/* --- MAIN CONTENT --- */
main {
    padding: 0 40px 40px 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

h2 {
    font-weight: 500;
    margin-bottom: 24px;
    font-size: 20px;
    letter-spacing: -0.3px;
}

/* --- CONTROLS / FILTERS --- */
.controls {
    display: flex;
    gap: 16px;
    margin-bottom: 40px;
}

input, select {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 10px 16px;
    border-radius: 6px;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
}

input::placeholder {
    color: var(--text-muted);
}

input:focus, select:focus {
    border-color: var(--border-hover);
    background-color: var(--bg-surface-hover);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

/* FIFA FUT Style Researcher Cards */
.fut-card {
    width: 220px;
    min-height: 330px;
    border-radius: 20px 20px 40px 40px; /* Shield shape bottom */
    position: relative;
    padding: 3px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 20px rgba(0,0,0,0.6);
    color: #fff;
    text-transform: uppercase;
    font-family: 'Arial', sans-serif;
    transition: transform 0.3s, box-shadow 0.3s;
    overflow: hidden;
}

.fut-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0,0,0,0.8), 0 0 15px rgba(255, 255, 255, 0.2);
}

.fut-card-inner {
    background: rgba(0, 0, 0, 0.6);
    border-radius: 17px 17px 37px 37px;
    padding: 12px;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
}

/* Tiers */
.tier-gold {
    background: linear-gradient(135deg, #e6c27a, #996515, #f3e5ab, #8a5a19);
    background-size: 200% 200%;
    animation: shine 4s ease infinite;
}
.tier-silver {
    background: linear-gradient(135deg, #d3d3d3, #808080, #ffffff, #505050);
    background-size: 200% 200%;
    animation: shine 4s ease infinite;
}
.tier-bronze {
    background: linear-gradient(135deg, #cd7f32, #6b3e1b, #e8a365, #4a2511);
    background-size: 200% 200%;
    animation: shine 4s ease infinite;
}

@keyframes shine {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.fut-card-top {
    display: flex;
    height: 120px;
}

.fut-card-info {
    width: 35%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 5px;
    border-right: 1px solid rgba(255,255,255,0.2);
}

.fut-rating {
    font-size: 32px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.fut-role {
    font-size: 11px;
    font-weight: bold;
    margin-top: 5px;
    letter-spacing: 1px;
}

.fut-dept {
    font-size: 8px;
    margin-top: 5px;
    text-align: center;
    opacity: 0.8;
}

.fut-card-img-container {
    width: 65%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    position: relative;
}

.fut-researcher-img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.5);
    box-shadow: 0 5px 10px rgba(0,0,0,0.5);
    position: absolute;
    bottom: -10px;
}

.fut-card-bottom {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
}

.fut-name {
    font-size: 16px;
    font-weight: 800;
    text-align: center;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.fut-divider {
    width: 80%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    margin: 8px 0;
}

.fut-stats {
    display: flex;
    width: 100%;
    justify-content: space-around;
    margin-bottom: 5px;
}

.fut-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.fut-stat-val {
    font-size: 14px;
    font-weight: bold;
}

.fut-stat-label {
    font-size: 9px;
    opacity: 0.8;
}

.fut-card-actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.fut-captain-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    background: #ffd700;
    color: #000;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 12px;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    z-index: 10;
}
.fut-captain-badge.vc {
    background: #c0c0c0;
    box-shadow: 0 0 10px rgba(192, 192, 192, 0.8);
}

.buy-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #ffd700, #b8860b);
    color: #000;
    border: 1px solid #fff;
    border-radius: 6px;
    font-weight: 800;
    cursor: pointer;
    transition: 0.3s;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

.buy-btn:not([disabled]):hover {
    background: linear-gradient(135deg, #ffea00, #daa520);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
    transform: translateY(-2px);
}

.buy-btn[disabled] {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255,255,255,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    cursor: not-allowed;
    box-shadow: none;
}

/* --- PACK OPENING & TEAM --- */
.pack-container {
    display: flex;
    justify-content: center;
    margin-top: 60px;
}

.pack {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    width: 320px;
    transition: transform 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
}

.pack:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
}

.pack h3 {
    font-size: 18px;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-main);
}

.pack p {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 30px;
}

.team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.role-title {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 40px 0 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    font-weight: 500;
}

.empty-slot {
    background-color: rgba(255, 255, 255, 0.03);
    border: 2px dashed var(--border);
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 330px; /* Match card height roughly */
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

.captain-select {
    width: 100%;
    margin-top: 15px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 8px;
    border-radius: 6px;
}

#pack-reveal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(11, 12, 16, 0.95);
    backdrop-filter: blur(5px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

#pack-reveal-overlay.hidden {
    display: none;
}

.reveal-content {
    text-align: center;
    z-index: 102;
}

.reveal-title {
    margin-bottom: 40px;
    font-size: 24px;
    font-weight: 500;
    color: var(--text-main);
}

.mystery-box {
    width: 220px;
    height: 330px;
    margin: 0 auto 30px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.box-icon {
    font-size: 48px;
    opacity: 0.5;
}

.mystery-box.shaking {
    animation: gachaShake 0.1s cubic-bezier(.36,.07,.19,.97) both infinite;
}

.hidden {
    display: none !important;
}

#reveal-card-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 0 auto;
}

/* Ensure the revealed card stays perfectly centered */
#reveal-card-container .fut-card {
    margin: 0 auto;
    animation: revealFadeIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1) forwards;
}

.action-btn {
    padding: 10px 24px;
    background-color: var(--text-main);
    color: var(--bg-color);
    border: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.action-btn:hover {
    background-color: #d0d0d0;
}

.admin-action-btn {
    background-color: var(--bg-surface);
    color: var(--danger);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}
.admin-action-btn:hover {
    background-color: rgba(248, 81, 73, 0.1);
    border-color: var(--danger);
}

/* --- ANIMATIONS --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes gachaShake {
    0%, 100% { transform: translate3d(0, 0, 0) }
    25% { transform: translate3d(-4px, 2px, 0) }
    50% { transform: translate3d(4px, -2px, 0) }
    75% { transform: translate3d(-4px, -2px, 0) }
}

@keyframes revealFadeIn {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1.1); opacity: 1; }
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px;
    color: var(--text-muted);
    font-size: 18px;
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    /* Header & Stats */
    header {
        flex-direction: column;
        padding: 15px 20px;
        gap: 15px;
    }
    .stats-panel {
        gap: 15px;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }
    .stat-box {
        align-items: center;
    }

    /* Tabs */
    .tabs {
        flex-wrap: wrap;
        gap: 10px;
        padding: 15px 10px;
    }
    .tab-btn {
        font-size: 13px;
        padding: 6px 8px;
    }

    /* Main Content */
    main {
        padding: 0 15px 30px 15px;
    }

    /* Controls (Search & Sort) */
    .controls {
        flex-direction: column;
        gap: 10px;
    }
    .controls input, .controls select {
        width: 100%;
    }

    /* Grid alignment */
    .grid {
        justify-content: center;
        gap: 20px;
    }

    /* Admin Panel */
    #admin-panel > div {
        flex-direction: column;
    }
    .admin-card {
        min-width: 100% !important;
        padding: 20px;
    }
    
    /* Reveal Animation fixes */
    #reveal-card-container .fut-card {
        transform: scale(0.9);
    }
    @keyframes revealFadeIn {
        0% { transform: scale(0.7); opacity: 0; }
        100% { transform: scale(0.9); opacity: 1; }
    }
}
