/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; }
body {
    background-color: #080a0e;
    color: #c5c6c7;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    padding: 40px 20px 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* ===== HEADER ===== */
.header {
    text-align: center;
    margin-bottom: 32px;
    max-width: 700px;
}
.header h1 {
    font-family: 'Rajdhani', sans-serif;
    color: #66fcf1;
    text-transform: uppercase;
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: 3px;
    margin: 0 0 8px;
    text-shadow: 0 0 20px rgba(102, 252, 241, 0.35), 0 0 60px rgba(102, 252, 241, 0.1);
}
.header .subtitle {
    font-size: 0.95rem;
    color: #7a8a99;
    font-weight: 300;
    line-height: 1.6;
}
.header .subtitle strong {
    color: #a0b0c0;
    font-weight: 500;
}

/* ===== MAIN CONTAINER ===== */
.container {
    width: 100%;
    max-width: 1100px;
    background: linear-gradient(145deg, #111820 0%, #0d1117 100%);
    padding: 32px;
    border-radius: 12px;
    border: 1px solid #1e2a36;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6), inset 0 1px 0 rgba(102,252,241,0.03);
}

/* ===== CONTROLS ===== */
.controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 28px;
}
.url-bar {
    display: flex;
    gap: 10px;
    align-items: center;
}
.url-bar input[type="text"] {
    flex: 1;
    background: #0b0e12;
    border: 1px solid #2a3540;
    color: #c5c6c7;
    padding: 14px 18px;
    border-radius: 6px;
    font-family: 'Inter', monospace;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}
.url-bar input[type="text"]:focus {
    outline: none;
    border-color: #45a29e;
    box-shadow: 0 0 0 2px rgba(69,162,158,0.15);
}
.url-bar input[type="text"]::placeholder {
    color: #4a5568;
}
button#fetchBtn {
    background: linear-gradient(135deg, #45a29e 0%, #3d8f8b 100%);
    color: #0b0c10;
    border: none;
    padding: 14px 28px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.25s;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    white-space: nowrap;
}
button#fetchBtn:hover {
    background: linear-gradient(135deg, #66fcf1 0%, #45a29e 100%);
    box-shadow: 0 0 20px rgba(102, 252, 241, 0.35);
    transform: translateY(-1px);
}
button#fetchBtn:active { transform: translateY(0); }
button#fetchBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ===== PRESET BUTTONS ===== */
.presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.preset-btn {
    background: #1a2030;
    color: #7a8a99;
    border: 1px solid #2a3540;
    padding: 6px 14px;
    border-radius: 20px;
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
}
.preset-btn:hover {
    background: #1e2a3a;
    color: #66fcf1;
    border-color: #45a29e;
}
.preset-latest {
    border-color: #45a29e;
    color: #66fcf1;
    font-weight: 600;
}
.preset-latest:hover {
    background: rgba(69, 162, 158, 0.15);
    box-shadow: 0 0 8px rgba(102, 252, 241, 0.2);
}
.preset-latest.checking {
    opacity: 0.6;
    pointer-events: none;
}

/* ===== STATS BAR ===== */
.stats-bar {
    display: none;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 28px;
    animation: fadeSlideUp 0.4s ease;
}
.stats-bar.visible { display: grid; }
.stat-card {
    background: #0b0e12;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    border: 1px solid #1e2a36;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}
.stat-card.buff::before { background: #22c55e; }
.stat-card.nerf::before { background: #ef4444; }
.stat-card.new::before { background: #f59e0b; }
.stat-card.total::before { background: linear-gradient(90deg, #22c55e, #ef4444, #f59e0b); }
.stat-number {
    font-family: 'Rajdhani', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}
.stat-card.buff .stat-number { color: #22c55e; }
.stat-card.nerf .stat-number { color: #ef4444; }
.stat-card.new .stat-number { color: #f59e0b; }
.stat-card.total .stat-number { color: #66fcf1; }
.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #6a7a8a;
    font-weight: 500;
}

/* ===== LEGEND ===== */
.legend {
    display: none;
    gap: 16px;
    margin-bottom: 24px;
    padding: 12px 16px;
    background: rgba(102,252,241,0.03);
    border-radius: 8px;
    border: 1px solid #1a2530;
    flex-wrap: wrap;
    animation: fadeSlideUp 0.4s ease 0.1s both;
}
.legend.visible { display: flex; }
.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: #7a8a99;
}
.legend-icon {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}
.legend-icon.buff { background: #22c55e; }
.legend-icon.nerf { background: #ef4444; }
.legend-icon.new { background: #f59e0b; }
.legend-icon.other { background: #64748b; }

/* ===== LOADING ===== */
#loading {
    display: none;
    text-align: center;
    padding: 40px 20px;
}
#loading.visible { display: block; }
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #1e2a36;
    border-top-color: #66fcf1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}
.loading-text {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.1rem;
    color: #66fcf1;
    letter-spacing: 1px;
}
.loading-sub {
    font-size: 0.8rem;
    color: #4a5568;
    margin-top: 4px;
}

/* ===== UPDATE BANNER ===== */
.update-banner {
    display: none;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 16px;
    color: #86efac;
    font-size: 0.85rem;
    line-height: 1.6;
    animation: fadeSlideUp 0.3s ease;
}
.update-banner.visible { display: block; }
.update-banner strong { color: #4ade80; }
.update-banner code {
    background: rgba(34, 197, 94, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.8rem;
    color: #6ee7b7;
}

/* ===== ERROR ===== */
.error-box {
    display: none;
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.25);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
    color: #f87171;
    font-size: 0.9rem;
}
.error-box.visible { display: block; }

/* ===== GRID ===== */
.grid-layout {
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    animation: fadeSlideUp 0.4s ease 0.2s both;
}
.grid-layout.visible { display: grid; }

/* ===== CATEGORY CARDS ===== */
.category {
    background: #0b0e12;
    border-radius: 10px;
    padding: 22px;
    border: 1px solid #1e2a36;
    position: relative;
}
.category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #1a2030;
}
.cat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.cat-buff .cat-icon { background: rgba(34,197,94,0.12); }
.cat-nerf .cat-icon { background: rgba(239,68,68,0.12); }
.cat-new .cat-icon { background: rgba(245,158,11,0.12); }
.cat-other .cat-icon { background: rgba(100,116,139,0.12); }
.cat-buff .cat-icon::after { content: '⬆'; color: #22c55e; }
.cat-nerf .cat-icon::after { content: '⬇'; color: #ef4444; }
.cat-new .cat-icon::after { content: '★'; color: #f59e0b; }
.cat-other .cat-icon::after { content: '•'; color: #64748b; }

.cat-titles h2 {
    font-family: 'Rajdhani', sans-serif;
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    line-height: 1.2;
}
.cat-buff .cat-titles h2 { color: #22c55e; }
.cat-nerf .cat-titles h2 { color: #ef4444; }
.cat-new .cat-titles h2 { color: #f59e0b; }
.cat-other .cat-titles h2 { color: #64748b; }
.cat-desc {
    font-size: 0.75rem;
    color: #5a6a7a;
    margin-top: 2px;
}

/* ===== DATA GROUPS ===== */
.data-group {
    background: #111820;
    border-radius: 6px;
    margin-bottom: 12px;
    padding: 14px;
    border-left: 3px solid #2a3540;
}
.cat-buff .data-group { border-left-color: rgba(34,197,94,0.4); }
.cat-nerf .data-group { border-left-color: rgba(239,68,68,0.4); }
.cat-new .data-group { border-left-color: rgba(245,158,11,0.4); }
.cat-other .data-group { border-left-color: rgba(100,116,139,0.4); }

.group-title {
    color: #5a7a8a;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.group-count {
    color: #3a5a6a;
    font-size: 0.75rem;
    font-weight: 400;
}

ul { list-style-type: none; padding: 0; margin: 0; }
li {
    background: rgba(8,10,14,0.5);
    margin-bottom: 6px;
    padding: 10px 14px;
    border-radius: 5px;
    line-height: 1.6;
    font-size: 0.88rem;
    color: #d0d8e0;
    border-left: 3px solid transparent;
    transition: background 0.15s;
}
li:hover { background: rgba(15,20,28,0.8); }
.cat-buff li { border-left-color: #22c55e; }
.cat-nerf li { border-left-color: #ef4444; }
.cat-new li { border-left-color: #f59e0b; }
.cat-other li { border-left-color: #64748b; }

.empty-state {
    text-align: center;
    color: #3a4a5a;
    font-size: 0.85rem;
    padding: 24px 10px;
    line-height: 1.6;
}
.empty-state .empty-icon {
    font-size: 1.6rem;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* ===== FILTER BAR ===== */
.filter-bar {
    display: none;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    animation: fadeSlideUp 0.4s ease 0.15s both;
}
.filter-bar.visible { display: flex; }
.filter-label {
    font-size: 0.75rem;
    color: #4a6a7a;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
    margin-right: 4px;
}
.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 20px;
    border: 1px solid #2a3540;
    background: #111820;
    color: #5a6a7a;
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}
.filter-btn:hover {
    border-color: #3a5a6a;
    background: #1a2530;
}
.filter-btn.active {
    border-color: #45a29e;
    background: rgba(69, 162, 158, 0.1);
    color: #c5c6c7;
}
.filter-btn.active[data-filter="buff"] { border-color: #22c55e; background: rgba(34,197,94,0.08); }
.filter-btn.active[data-filter="nerf"] { border-color: #ef4444; background: rgba(239,68,68,0.08); }
.filter-btn.active[data-filter="new"]   { border-color: #f59e0b; background: rgba(245,158,11,0.08); }
.filter-btn.active[data-filter="other"] { border-color: #64748b; background: rgba(100,116,139,0.08); }
.filter-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    opacity: 0.4;
    transition: opacity 0.2s;
}
.filter-btn.active .filter-dot { opacity: 1; }
.filter-dot.buff { background: #22c55e; }
.filter-dot.nerf { background: #ef4444; }
.filter-dot.new  { background: #f59e0b; }
.filter-dot.other { background: #64748b; }
.filter-count {
    font-size: 0.7rem;
    color: #4a5a6a;
    font-weight: 400;
    margin-left: 2px;
}
.filter-btn.active .filter-count { color: #6a8a9a; }
.filter-all {
    margin-left: 4px;
    border-style: dashed;
}
.filter-all:hover {
    border-color: #66fcf1;
    color: #66fcf1;
}

/* Category hidden by filter */
.category.filter-hidden {
    display: none;
}

/* ===== UPDATE TIMESTAMP ===== */
.update-timestamp {
    display: none;
    text-align: center;
    margin-bottom: 20px;
    font-size: 0.78rem;
    color: #5a7a8a;
    animation: fadeSlideUp 0.4s ease 0.05s both;
}
.update-timestamp.visible { display: block; }
.update-timestamp .ts-label {
    color: #4a6a7a;
}
.update-timestamp .ts-date {
    color: #66fcf1;
    font-weight: 500;
}
.update-timestamp .ts-time {
    color: #5a8a9a;
}

/* ===== FOOTER ===== */
.footer {
    margin-top: 40px;
    text-align: center;
    width: 100%;
    max-width: 600px;
}
.footer-inner {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    border-radius: 40px;
    background: rgba(102, 252, 241, 0.04);
    border: 1px solid rgba(102, 252, 241, 0.1);
    backdrop-filter: blur(4px);
    margin-bottom: 12px;
}
.footer-crown {
    font-size: 1.1rem;
    animation: crownBob 3s ease-in-out infinite;
}
.footer-crown:last-child { animation-delay: 1.5s; }
.footer-text {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    background: linear-gradient(90deg, #66fcf1, #45a29e, #66fcf1);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 4s linear infinite;
}
.footer-sub {
    font-size: 0.7rem;
    color: #3a4a5a;
    line-height: 1.6;
    margin-top: 6px;
}
.footer-sub a {
    color: #45a29e;
    text-decoration: none;
    transition: color 0.2s;
}
.footer-sub a:hover { color: #66fcf1; }

@keyframes crownBob {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50%      { transform: translateY(-3px) rotate(5deg); }
}
@keyframes shimmer {
    0%   { background-position: 0% center; }
    100% { background-position: 200% center; }
}

/* ===== ANIMATIONS ===== */
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    body { padding: 20px 12px 40px; }
    .header h1 { font-size: 2rem; }
    .container { padding: 20px; }
    .url-bar { flex-direction: column; }
    button#fetchBtn { width: 100%; }
    .stats-bar { grid-template-columns: repeat(2, 1fr); }
    .grid-layout { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .stats-bar { grid-template-columns: 1fr 1fr; }
    .legend { flex-direction: column; gap: 8px; }
}

/* ===== TRAKTEER FLOATING BUTTON ===== */
.kopi-float {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 54px;
    height: 54px;
    background: #be1e2d;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    text-decoration: none;
    cursor: pointer;
    animation: kopi-float 3.5s ease-in-out infinite;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.kopi-float:hover {
    transform: scale(1.12);
    animation: none;
}
.kopi-float:hover .kopi-ring {
    animation: none;
    opacity: 0;
}
.kopi-float img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    display: block;
    pointer-events: none;
    animation: kopi-wobble 4s ease-in-out infinite;
    transform-origin: center bottom;
}
.kopi-float:hover img {
    animation: none;
    transform: rotate(0deg);
}
.kopi-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1.5px solid rgba(190, 30, 45, 0.5);
    animation: kopi-ripple 2.4s ease-out infinite;
    transition: opacity 0.3s ease;
}
.kopi-r2 { animation-delay: 1.2s; }

@keyframes kopi-ripple {
    0%   { transform: scale(1);   opacity: 0.7; }
    100% { transform: scale(2.0); opacity: 0; }
}
@keyframes kopi-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-7px); }
}
@keyframes kopi-wobble {
    0%, 55%  { transform: rotate(0deg); }
    58%      { transform: rotate(-18deg); }
    61%      { transform: rotate(16deg); }
    64%      { transform: rotate(-12deg); }
    67%      { transform: rotate(10deg); }
    70%      { transform: rotate(-6deg); }
    73%      { transform: rotate(4deg); }
    76%, 100%{ transform: rotate(0deg); }
}

@media (max-width: 720px) {
    .kopi-float {
        bottom: 20px;
        right: 20px;
        width: 48px;
        height: 48px;
    }
    .kopi-float img { width: 24px; height: 24px; }
}
