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

:root {
    --bg-color: #0b0c10;
    --panel-bg: rgba(20, 22, 33, 0.7);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    
    /* Gacha Rarity Colors */
    --rarity-ex: #f97316; /* Fire Orange */
    --rarity-ssr: #eab308; /* Gold */
    --rarity-sr: #a855f7; /* Purple */
    --rarity-r: #6b7280; /* Gray/Silver */
    
    /* Glow filters */
    --glow-ex: 0 0 25px rgba(249, 115, 22, 0.6);
    --glow-ssr: 0 0 25px rgba(234, 179, 8, 0.6);
    --glow-sr: 0 0 25px rgba(168, 85, 247, 0.6);
    --glow-r: 0 0 15px rgba(107, 114, 128, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(168, 85, 247, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Main Layout */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: rgba(11, 12, 16, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--panel-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #eab308 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.25s ease;
}

.nav-btn.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--panel-border);
    color: var(--text-primary);
}

.nav-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

/* Containers */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease forwards;
}

/* Glassmorphism Panel */
.panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Typography Helpers */
.title-large {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: -1rem;
    margin-bottom: 1.5rem;
}

/* Dashboard Roster / Scoreboard Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.turn-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: 12px;
    padding: 1.25rem 2rem;
    margin-bottom: 2rem;
    animation: pulseBorder 3s infinite alternate;
}

.turn-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.turn-indicator-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--rarity-ssr);
    box-shadow: 0 0 10px var(--rarity-ssr);
    animation: blink 1.5s infinite;
}

.team-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.team-card {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.team-card.current-turn {
    border-color: rgba(234, 179, 8, 0.5);
    box-shadow: 0 0 20px rgba(234, 179, 8, 0.15);
}

.team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
}

.team-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
}

.team-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.team-stat-badge {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.team-roster {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.roster-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.95rem;
    border-left: 3px solid transparent;
}

.roster-item.ssr { border-left-color: var(--rarity-ssr); }
.roster-item.sr { border-left-color: var(--rarity-sr); }
.roster-item.r { border-left-color: var(--rarity-r); }

.roster-item .tier-badge {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.tier-badge.ssr { background: rgba(234, 179, 8, 0.15); color: var(--rarity-ssr); border: 1px solid rgba(234, 179, 8, 0.3); }
.tier-badge.sr { background: rgba(168, 85, 247, 0.15); color: var(--rarity-sr); border: 1px solid rgba(168, 85, 247, 0.3); }
.tier-badge.r { background: rgba(107, 114, 128, 0.15); color: var(--rarity-r); border: 1px solid rgba(107, 114, 128, 0.3); }

/* Captain Room Styles */
.captain-selector-container {
    max-width: 500px;
    margin: 4rem auto;
    text-align: center;
}

.select-input, .text-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--panel-border);
    color: #fff;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 1.25rem;
    outline: none;
    transition: border-color 0.2s;
}

.select-input:focus, .text-input:focus {
    border-color: var(--rarity-sr);
}

.btn-primary {
    background: linear-gradient(135deg, #a855f7 0%, #3b82f6 100%);
    border: none;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    padding: 0.8rem 2rem;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 14px 0 rgba(168, 85, 247, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(168, 85, 247, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    border: none;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    padding: 0.8rem 2rem;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(239, 68, 68, 0.4);
}

/* Card Gacha styles */
.cards-container {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin: 2.5rem 0;
}

/* Flip Card Container */
.card-flip-wrapper {
    background-color: transparent;
    width: 200px;
    height: 280px;
    perspective: 1000px;
    cursor: pointer;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
}

.card-flip-wrapper.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 14px;
    border: 2px solid var(--panel-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Card Front: Mystery Gacha Backside */
.card-front {
    background: radial-gradient(circle, #1a1d29 0%, #0d0f15 100%);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.6);
    color: var(--text-secondary);
    border-color: rgba(255, 255, 255, 0.05);
}

.card-front .card-logo {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    animation: float 3s ease-in-out infinite;
}

/* Card Back: Revealed Player Info */
.card-back {
    background: radial-gradient(circle, #252a3d 0%, #151824 100%);
    transform: rotateY(180deg);
    padding: 1rem;
    justify-content: space-between;
}

.card-back.ssr {
    border-color: var(--rarity-ssr);
    box-shadow: var(--glow-ssr), inset 0 0 20px rgba(234, 179, 8, 0.2);
}

.card-back.sr {
    border-color: var(--rarity-sr);
    box-shadow: var(--glow-sr), inset 0 0 20px rgba(168, 85, 247, 0.2);
}

.card-back.r {
    border-color: var(--rarity-r);
    box-shadow: var(--glow-r);
}

.card-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1rem;
}

.card-back.ssr .card-avatar { border-color: var(--rarity-ssr); background: rgba(234, 179, 8, 0.05); }
.card-back.sr .card-avatar { border-color: var(--rarity-sr); background: rgba(168, 85, 247, 0.05); }
.card-back.r .card-avatar { border-color: var(--rarity-r); }

.card-username {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.25rem;
    word-break: break-all;
    max-width: 100%;
}

.card-tier-text {
    font-size: 0.9rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card-back.ssr .card-tier-text { color: var(--rarity-ssr); }
.card-back.sr .card-tier-text { color: var(--rarity-sr); }
.card-back.r .card-tier-text { color: var(--rarity-r); }

.card-select-btn {
    width: 100%;
    padding: 0.5rem 0;
    border-radius: 6px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.card-back.ssr .card-select-btn { background: var(--rarity-ssr); color: #000; }
.card-back.sr .card-select-btn { background: var(--rarity-sr); color: #fff; }
.card-back.r .card-select-btn { background: rgba(255, 255, 255, 0.15); }

.card-select-btn:hover {
    filter: brightness(1.2);
}

/* Reroll Actions panel */
.draft-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-top: 2rem;
}

.rerolls-count {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Timer styles */
.timer-container {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    height: 6px;
    border-radius: 3px;
    margin-top: 1.5rem;
    overflow: hidden;
}

.timer-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--rarity-ssr) 0%, var(--rarity-sr) 100%);
    width: 100%;
    transition: width 1s linear;
}

/* Weapon Gacha Drawer Styles */
.weapons-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
}

@media (max-width: 768px) {
    .weapons-container {
        grid-template-columns: 1fr;
    }
}

.weapon-draw-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.2);
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

/* Chest / Gacha Animation */
.gacha-crate-wrapper {
    width: 160px;
    height: 160px;
    margin-bottom: 2rem;
    position: relative;
    cursor: pointer;
    perspective: 600px;
}

.gacha-crate {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #2a2e40 0%, #151824 100%);
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4.5rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    transition: all 0.3s;
}

.gacha-crate-wrapper:hover .gacha-crate {
    transform: scale(1.05) rotate(3deg);
    border-color: var(--rarity-sr);
    box-shadow: 0 15px 30px rgba(168, 85, 247, 0.3);
}

.gacha-crate-wrapper.shake .gacha-crate {
    animation: shakeCrate 0.8s cubic-bezier(.36,.07,.19,.97) both;
}

/* Weapon Card Reveal */
.weapon-card {
    background: radial-gradient(circle, #1f2330 0%, #0d0f15 100%);
    border: 2px solid var(--panel-border);
    border-radius: 16px;
    width: 280px;
    min-height: 380px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    animation: cardEntrance 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.weapon-card.rarity-ex { border-color: var(--rarity-ex); box-shadow: var(--glow-ex); }
.weapon-card.rarity-ssr { border-color: var(--rarity-ssr); box-shadow: var(--glow-ssr); }
.weapon-card.rarity-sr { border-color: var(--rarity-sr); box-shadow: var(--glow-sr); }
.weapon-card.rarity-r { border-color: var(--rarity-r); box-shadow: var(--glow-r); }

.weapon-image {
    width: 100%;
    height: 160px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    margin-bottom: 1.25rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.05);
}

.weapon-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.weapon-image .no-img {
    font-size: 3rem;
    opacity: 0.2;
}

.weapon-name {
    font-size: 1.35rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 0.25rem;
}

.weapon-rarity-badge {
    font-size: 0.8rem;
    font-weight: 900;
    padding: 0.15rem 0.6rem;
    border-radius: 4px;
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

.weapon-rarity-badge.ex { background: rgba(249, 115, 22, 0.15); color: var(--rarity-ex); border: 1px solid rgba(249, 115, 22, 0.3); }
.weapon-rarity-badge.ssr { background: rgba(234, 179, 8, 0.15); color: var(--rarity-ssr); border: 1px solid rgba(234, 179, 8, 0.3); }
.weapon-rarity-badge.sr { background: rgba(168, 85, 247, 0.15); color: var(--rarity-sr); border: 1px solid rgba(168, 85, 247, 0.3); }
.weapon-rarity-badge.r { background: rgba(107, 114, 128, 0.15); color: var(--rarity-r); border: 1px solid rgba(107, 114, 128, 0.3); }

.weapon-effect {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
    overflow-y: auto;
    max-height: 80px;
    width: 100%;
}

/* History logs list */
.weapon-history-list {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-right: 0.5rem;
}

.history-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--panel-border);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
}

.history-header {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

/* Admin Screen Styles */
.admin-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }
}

.admin-controls {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.admin-log-console {
    background: #000;
    color: #10b981;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    padding: 1.5rem;
    border-radius: 10px;
    height: 400px;
    overflow-y: auto;
    border: 1px solid #10b981;
    box-shadow: inset 0 0 20px rgba(16, 185, 129, 0.15);
}

.admin-log-line {
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(2deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

@keyframes blink {
    0% { opacity: 0.4; }
    50% { opacity: 1; }
    100% { opacity: 0.4; }
}

@keyframes pulseBorder {
    0% { border-color: rgba(234, 179, 8, 0.3); }
    100% { border-color: rgba(168, 85, 247, 0.5); }
}

@keyframes shakeCrate {
    10%, 90% { transform: translate3d(-1px, 0, 0) rotate(-1deg); }
    20%, 80% { transform: translate3d(2px, 0, 0) rotate(2deg); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0) rotate(-3deg); }
    40%, 60% { transform: translate3d(4px, 0, 0) rotate(3deg); }
}

@keyframes cardEntrance {
    0% { transform: scale(0.5) rotate(-10deg); opacity: 0; filter: blur(5px); }
    80% { transform: scale(1.05) rotate(2deg); opacity: 0.9; }
    100% { transform: scale(1) rotate(0); opacity: 1; filter: none; }
}

/* Toast System */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: rgba(18, 19, 26, 0.9);
    border-left: 4px solid var(--rarity-sr);
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateX(120%);
    animation: toastIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.toast.success { border-left-color: var(--rarity-ssr); }
.toast.error { border-left-color: #ef4444; }

@keyframes toastIn {
    to { transform: translateX(0); }
}

.hidden {
    display: none !important;
}
