/* =====================================================================
   ESAForum — Cases / Lootbox CSS
   Created by ESAGAMES HOSTING SHIELD SRL
   Uses CSS custom properties from theme.css: --primary, --bg, --card,
   --border, --text, --text-mute, --radius, etc.
   ===================================================================== */

/* ---- Page wrapper ---- */
.cases-wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 16px 60px;
}

/* ---- Hero header ---- */
.cases-hero {
    text-align: center;
    padding: 48px 16px 32px;
}
.cases-hero-title {
    font-size: clamp(28px, 5vw, 44px);
    font-weight: 800;
    margin: 0 0 8px;
    background: linear-gradient(135deg, var(--primary) 0%, #a78bfa 60%, #f5b301 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.cases-hero-sub {
    color: var(--text-mute);
    margin: 0 0 16px;
    font-size: 15px;
}
.cases-balance {
    display: inline-block;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 20px;
    font-weight: 700;
    font-size: 15px;
    color: #f5b301;
}
.cases-guest {
    margin-bottom: 24px;
}

/* ---- Case grid ---- */
.cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
}

/* ---- Case card ---- */
.case-card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius, 12px) + 4px);
    padding: 32px 24px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.case-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}

/* Glow overlays */
.case-glow {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    height: 220px;
    border-radius: 50%;
    opacity: 0.14;
    pointer-events: none;
    filter: blur(55px);
}
.case-glow--daily   { background: var(--primary); }
.case-glow--premium { background: #f5b301; }

/* Premium card accent border */
.case-card--premium {
    border-color: rgba(245, 179, 1, 0.35);
    background: linear-gradient(160deg, var(--card) 80%, rgba(245,179,1,0.06));
}

/* ---- Case icon ---- */
.case-icon-wrap {
    margin-bottom: 20px;
}
.case-icon {
    width: 90px;
    height: 90px;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
    position: relative;
    transition: box-shadow 0.3s;
}
.case-icon--daily {
    background: linear-gradient(135deg, rgba(124,92,255,0.22), rgba(124,92,255,0.05));
    box-shadow: 0 0 0 2px rgba(124,92,255,0.3);
}
.case-icon--premium {
    background: linear-gradient(135deg, rgba(245,179,1,0.25), rgba(245,179,1,0.06));
    box-shadow: 0 0 0 2px rgba(245,179,1,0.35);
}
.case-icon-inner {
    display: block;
    line-height: 1;
}

/* Spin animation */
@keyframes case-spin-anim {
    0%   { transform: scale(1) rotate(0deg); }
    20%  { transform: scale(1.18) rotate(-8deg); }
    40%  { transform: scale(1.22) rotate(10deg); }
    60%  { transform: scale(1.18) rotate(-6deg); }
    80%  { transform: scale(1.08) rotate(4deg); }
    100% { transform: scale(1) rotate(0deg); }
}
.case-spin {
    animation: case-spin-anim 0.65s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards;
}

/* ---- Case info text ---- */
.case-info {
    flex: 1;
    margin-bottom: 20px;
}
.case-name {
    font-size: 20px;
    font-weight: 800;
    margin: 0 0 8px;
    color: var(--text);
}
.case-desc {
    font-size: 14px;
    color: var(--text-mute);
    margin: 0 0 14px;
    line-height: 1.5;
}

/* Odds pills */
.case-odds {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}
.odds-pill {
    font-size: 11px;
    font-weight: 700;
    border-radius: 999px;
    padding: 3px 10px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.odds-pts  { background: rgba(74,158,255,0.15); color: #4a9eff; border: 1px solid rgba(74,158,255,0.3); }
.odds-item { background: rgba(245,179,1,0.15); color: #f5b301; border: 1px solid rgba(245,179,1,0.3); }

/* ---- Open button ---- */
.case-open-btn {
    width: 100%;
    font-size: 15px;
    font-weight: 700;
    padding: 12px 0;
    border-radius: var(--radius, 10px);
    cursor: pointer;
    transition: opacity 0.2s, transform 0.12s;
}
.case-open-btn:active:not(:disabled) { transform: scale(0.97); }
.case-open-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Premium button special gradient */
.btn-premium {
    background: linear-gradient(135deg, #e6a800, #f5b301 50%, #ffd454);
    color: #1a1200;
    border: none;
    font-weight: 800;
    box-shadow: 0 4px 18px rgba(245,179,1,0.35);
}
.btn-premium:hover:not(:disabled) { opacity: 0.92; box-shadow: 0 6px 24px rgba(245,179,1,0.5); }

/* ---- Cooldown block ---- */
.case-cooldown {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    font-size: 14px;
    color: var(--text-mute);
    margin-bottom: 12px;
}
.cooldown-icon { font-size: 18px; }

/* =====================================================================
   RESULT MODAL
   ===================================================================== */
.case-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
    padding: 16px;
}
.case-modal-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

.case-modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    width: min(420px, 100%);
    padding: 36px 28px 28px;
    position: relative;
    text-align: center;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6);
    transform: scale(0.92) translateY(16px);
    transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.case-modal-backdrop.active .case-modal {
    transform: scale(1) translateY(0);
}
.case-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-mute);
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.case-modal-close:hover { color: var(--text); background: var(--border); }

/* ---- Modal animation area ---- */
.case-modal-anim {
    position: relative;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}
.modal-burst {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.modal-reward-icon {
    font-size: 64px;
    z-index: 1;
    animation: modal-pop 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes modal-pop {
    0%   { transform: scale(0) rotate(-20deg); opacity: 0; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Burst particles */
.burst-particle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: burst-fly 0.65s ease-out both;
}
@keyframes burst-fly {
    0%   { transform: translate(-50%,-50%) rotate(var(--angle)) translateX(0) scale(1); opacity: 1; }
    100% { transform: translate(-50%,-50%) rotate(var(--angle)) translateX(var(--dist)) scale(0); opacity: 0; }
}

/* ---- Modal text ---- */
.case-modal-body { margin-bottom: 20px; }
.modal-label {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary);
    margin-bottom: 6px;
}
.modal-reward-name {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
    word-break: break-word;
}
.modal-balance {
    font-size: 14px;
    color: var(--text-mute);
}

/* =====================================================================
   RECENT WINS FEED
   ===================================================================== */
.cases-section-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 16px;
    color: var(--text);
}
.cases-feed {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius, 12px);
    overflow: hidden;
}
.feed-row {
    display: grid;
    grid-template-columns: 1fr 70px 1fr 90px;
    align-items: center;
    gap: 8px;
    padding: 11px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    transition: background 0.25s;
}
.feed-row:last-child { border-bottom: none; }
.feed-row--item { background: rgba(245,179,1,0.04); }
.feed-row--new {
    animation: feed-slide-in 0.35s ease both;
}
@keyframes feed-slide-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.feed-user  { font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-case  { text-align: center; font-size: 11px; text-transform: uppercase; font-weight: 700; letter-spacing: 0.04em; color: var(--text-mute); }
.feed-reward { text-align: right; font-weight: 700; }
.feed-reward--pts  { color: #4a9eff; }
.feed-reward--item { color: #f5b301; }
.feed-time  { text-align: right; color: var(--text-mute); font-size: 11px; white-space: nowrap; }

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 540px) {
    .cases-hero { padding: 32px 8px 20px; }
    .cases-grid { grid-template-columns: 1fr; }
    .feed-row   { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; }
    .feed-time  { display: none; }
    .case-card  { padding: 24px 16px 20px; }
}
