/* Global Reset & Font */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

:root {
    --bg-gradient: radial-gradient(circle at top right, #1e293b, #0f172a);
    --text-color: #e2e8f0;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.05);
    --navbar-bg: rgba(15, 23, 42, 0.8);
    --primary-gradient: linear-gradient(135deg, #3b82f6, #2563eb);
    --accent-gradient: linear-gradient(135deg, #a855f7, #7c3aed);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.light-mode {
    --bg-gradient: radial-gradient(circle at top right, #f8fafc, #e2e8f0);
    --text-color: #1e293b;
    --card-bg: rgba(255, 255, 255, 0.8);
    --card-border: rgba(0, 0, 0, 0.05);
    --navbar-bg: rgba(255, 255, 255, 0.9);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
}

a:hover {
    color: #60a5fa;
}

/* Navbar */
.navbar {
    background: var(--navbar-bg);
    backdrop-filter: blur(12px);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--card-border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.navbar-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.navbar-links a {
    font-weight: 600;
    color: var(--text-color);
    opacity: 0.8;
}

.navbar-links a:hover {
    opacity: 1;
    transform: translateY(-2px);
}

/* Container & Grid */
.container {
    padding: 40px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

/* Cards */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    overflow: hidden;
    position: relative;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 12px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.6);
}

.btn:disabled {
    background: #64748b;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Paper Doll System */
.char-preview-container {
    position: relative;
    width: 300px;
    height: 400px;
    margin: 0 auto;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, rgba(0, 0, 0, 0) 70%);
    border-radius: 20px;
}

.char-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center bottom;
    transition: all 0.3s;
}

.layer-base {
    z-index: 1;
}

.layer-armor {
    z-index: 2;
}

.layer-shoes {
    z-index: 3;
}

.layer-helm {
    z-index: 4;
}

.layer-weapon {
    z-index: 5;
}

/* Elements */
.element-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    display: inline-block;
}

.elem-API_MERAH {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid #ef4444;
}

.elem-AIR {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border: 1px solid #3b82f6;
}

.elem-ANGIN {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
    border: 1px solid #22c55e;
}

.elem-BATU {
    background: rgba(234, 179, 8, 0.2);
    color: #fde047;
    border: 1px solid #eab308;
}

.elem-ICE {
    background: rgba(6, 182, 212, 0.2);
    color: #67e8f9;
    border: 1px solid #06b6d4;
}

.elem-KEGELAPAN {
    background: rgba(168, 85, 247, 0.2);
    color: #d8b4fe;
    border: 1px solid #a855f7;
}

/* Resource Icons */
.icon-gold {
    display: inline-block;
    width: 16px;
    height: 16px;
    background: radial-gradient(circle, #fcd34d 30%, #d97706 90%);
    border-radius: 50%;
    border: 2px solid #f59e0b;
    box-shadow: 0 0 5px #fcd34d;
    vertical-align: middle;
    margin-right: 5px;
    position: relative;
}

.icon-gem {
    display: inline-block;
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, #67e8f9, #06b6d4);
    transform: rotate(45deg);
    box-shadow: 0 0 5px #67e8f9;
    vertical-align: middle;
    margin-right: 5px;
    margin-left: 2px;
    /* Adjust for rotation */
    border: 1px solid #cffafe;
}

/* Blue Fire Effect */
.hue-rotate-blue {
    filter: hue-rotate(200deg) brightness(1.2);
}

/* Responsive Design */
@media (max-width: 768px) {
    .top-nav {
        display: none !important;
        /* Hide top nav on mobile */
    }

    .bottom-nav {
        display: flex !important;
        /* Show bottom nav on mobile */
    }

    .container {
        padding-bottom: 100px;
        /* Space for bottom nav */
    }

    .navbar {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .navbar-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .grid {
        grid-template-columns: 1fr !important;
        /* Force single column on mobile */
    }

    .profile-grid {
        grid-template-columns: 1fr !important;
    }

    .card {
        padding: 15px;
    }

    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .battle-arena {
        flex-direction: column;
        gap: 20px;
    }

    .battle-entity {
        width: 100%;
    }

    .battle-actions {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Admin Dashboard Responsive */
    .admin-tabs {
        justify-content: flex-start;
        padding-bottom: 10px;
    }

    .form-group input,
    .form-group select {
        font-size: 16px;
        /* Prevent zoom on iOS */
    }
}

/* Profile Specific */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 40px;
}

/* Battle System UI */
.battle-arena {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 40px 0;
    margin-bottom: 30px;
}

.battle-entity {
    text-align: center;
    width: 40%;
}

.hp-bar-container {
    width: 100%;
    height: 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.hp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ef4444, #dc2626);
    transition: width 0.5s ease-out;
}

.battle-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.action-btn {
    padding: 15px;
    border: none;
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    text-transform: uppercase;
    color: white;
}

.btn-attack {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    box-shadow: 0 4px 0 #991b1b;
}

.btn-attack:active {
    transform: translateY(4px);
    box-shadow: none;
}

.btn-skill {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    box-shadow: 0 4px 0 #1e40af;
}

.btn-skill:active {
    transform: translateY(4px);
    box-shadow: none;
}

.btn-heal {
    background: linear-gradient(135deg, #22c55e, #15803d);
    box-shadow: 0 4px 0 #166534;
}

.btn-heal:active {
    transform: translateY(4px);
    box-shadow: none;
}

.battle-log-container {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    padding: 20px;
    height: 200px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-family: monospace;
    font-size: 0.9rem;
}

.log-entry {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.damage-text {
    color: #ef4444;
    font-weight: bold;
}

.heal-text {
    color: #22c55e;
    font-weight: bold;
}

/* Animations */
@keyframes shake {
    0% {
        transform: translate(1px, 1px) rotate(0deg);
    }

    10% {
        transform: translate(-1px, -2px) rotate(-1deg);
    }

    20% {
        transform: translate(-3px, 0px) rotate(1deg);
    }

    30% {
        transform: translate(3px, 2px) rotate(0deg);
    }

    40% {
        transform: translate(1px, -1px) rotate(1deg);
    }

    50% {
        transform: translate(-1px, 2px) rotate(-1deg);
    }

    60% {
        transform: translate(-3px, 1px) rotate(0deg);
    }

    70% {
        transform: translate(3px, 1px) rotate(-1deg);
    }

    80% {
        transform: translate(-1px, -1px) rotate(1deg);
    }

    90% {
        transform: translate(1px, 2px) rotate(0deg);
    }

    100% {
        transform: translate(1px, -2px) rotate(-1deg);
    }
}

.shake {
    animation: shake 0.5s;
    animation-iteration-count: 1;
}

@keyframes attack-anim {
    0% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(50px);
    }

    100% {
        transform: translateX(0);
    }
}

.attack-anim {
    animation: attack-anim 0.3s ease-in-out;
}

@keyframes flash {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

.flash {
    animation: flash 0.5s;
}

/* Energy Bar */
.energy-bar-container {
    width: 100%;
    height: 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    overflow: hidden;
    margin-top: 5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.energy-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #eab308, #facc15);
    transition: width 0.5s ease-out;
}

/* Ultimate Button */
.btn-ultimate {
    background: linear-gradient(135deg, #a855f7, #7e22ce);
    box-shadow: 0 4px 0 #6b21a8;
    position: relative;
    overflow: hidden;
}

.btn-ultimate:disabled {
    background: #581c87;
    box-shadow: none;
    color: #9ca3af;
}

.btn-ultimate.ready {
    animation: pulse 1.5s infinite;
    box-shadow: 0 0 15px #a855f7;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(168, 85, 247, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(168, 85, 247, 0);
    }
}

/* Cooldown Overlay */
/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #1e293b;
    width: 90%;
    max-width: 800px;
    border-radius: 20px;
    padding: 30px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-close:hover {
    background: #ef4444;
    transform: rotate(90deg);
}

.char-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 30px;
}

@media (max-width: 768px) {
    .char-detail-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: 20px;
    }
}

.skill-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 4px solid #3b82f6;
}

.skill-box.ultimate {
    border-left-color: #a855f7;
    background: linear-gradient(90deg, rgba(168, 85, 247, 0.1), transparent);
}

.skill-box.passive {
    border-left-color: #eab308;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Toast Notification */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 41, 59, 0.95);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast-container.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast-icon {
    font-size: 1.2rem;
}

.toast-message {
    font-size: 0.95rem;
}

.toast-success {
    border-left: 4px solid #22c55e;
}

.toast-error {
    border-left: 4px solid #ef4444;
}

/* Gacha Animation & Results */
.gacha-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0f172a;
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.summon-meteor {
    width: 10px;
    height: 10px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 20px 5px #a855f7, 0 0 50px 20px #3b82f6;
    animation: meteorFall 2s ease-in forwards;
    position: absolute;
    top: -10%;
}

@keyframes meteorFall {
    0% {
        top: -10%;
        transform: scale(1);
        opacity: 1;
    }

    80% {
        top: 50%;
        transform: scale(3);
        opacity: 1;
    }

    100% {
        top: 50%;
        transform: scale(50);
        opacity: 0;
    }
}

.flash-bang {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    opacity: 0;
    animation: flash 0.5s 1.8s forwards;
    pointer-events: none;
}

@keyframes flash {
    0% {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

.gacha-results-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    z-index: 3001;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    width: 100%;
    max-width: 900px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

.result-card {
    background: rgba(30, 41, 59, 0.8);
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: cardPop 0.5s backwards;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.result-card.rarity-5 {
    border: 2px solid #fbbf24;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.1), rgba(0, 0, 0, 0));
}

.result-card.rarity-4 {
    border: 2px solid #a855f7;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.3);
}

.result-card img {
    width: 100%;
    max-width: 120px;
    height: 120px;
    object-fit: contain;
    margin: 0 auto 10px;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.5));
}

@media (max-width: 768px) {
    .result-card img {
        max-width: 100px;
        height: 100px;
    }
}

@keyframes cardPop {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Fix Gacha Results Modal */
.gacha-results-modal {
    overflow-y: auto !important;
    justify-content: flex-start !important;
    padding-top: 40px !important;
}

.gacha-results-modal h2 {
    margin-top: 0;
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    background: rgba(15, 23, 42, 0.95);
    padding: 20px 0;
    z-index: 10;
}


/* Improved Responsive Gacha Results */
.gacha-results-modal {
    padding: 20px 10px !important;
    max-height: 100vh;
}

.gacha-results-modal h2 {
    font-size: 1.5rem;
    margin: 10px 0 20px 0 !important;
}

.results-grid {
    max-width: 95% !important;
    width: 100% !important;
    margin: 0 auto 20px auto !important;
    padding: 0 !important;
}

.result-card {
    min-height: 200px !important;
    max-height: 280px;
}

.result-card img {
    max-width: 100px !important;
    height: 100px !important;
}

/* Desktop - 4 columns */
@media (min-width: 1024px) {
    .results-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 20px !important;
        max-width: 1000px !important;
    }

    .result-card {
        min-height: 220px !important;
    }

    .result-card img {
        max-width: 120px !important;
        height: 120px !important;
    }
}

/* Tablet - 3 columns */
@media (min-width: 768px) and (max-width: 1023px) {
    .results-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 15px !important;
    }
}

/* Mobile - 2 columns */
@media (max-width: 767px) {
    .results-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .gacha-results-modal h2 {
        font-size: 1.2rem !important;
    }

    .result-card {
        min-height: 180px !important;
        padding: 10px !important;
    }

    .result-card img {
        max-width: 80px !important;
        height: 80px !important;
    }
}

/* Very small mobile */
@media (max-width: 480px) {
    .gacha-results-modal {
        padding: 10px 5px !important;
    }

    .results-grid {
        gap: 8px !important;
    }

    .result-card {
        min-height: 160px !important;
        padding: 8px !important;
        font-size: 0.85rem;
    }

    .result-card img {
        max-width: 70px !important;
        height: 70px !important;
    }
}

/* Bottom Navigation */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 10px 20px;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #94a3b8;
    font-size: 0.8rem;
    transition: 0.3s;
}

.nav-item .nav-icon {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.nav-item:hover,
.nav-item.active {
    color: #38bdf8;
    transform: translateY(-2px);
}

/* Light Mode Adjustments */
.light-mode .bottom-nav {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.light-mode .nav-item {
    color: #64748b;
}

.light-mode .nav-item:hover,
.light-mode .nav-item.active {
    color: #2563eb;
}
.elem-ELECTRO {
    background: rgba(168, 85, 247, 0.2);
    color: #d8b4fe;
    border: 1px solid #a855f7;
}

.elem-CAHAYA {
    background: rgba(250, 204, 21, 0.2);
    color: #fde047;
    border: 1px solid #facc15;
}

.elem-DENDRO { background: rgba(34, 197, 94, 0.2); color: #86efac; border: 1px solid #22c55e; }
