/* 
 * CryptoNinjaSwap - Stylesheet
 * BEM Methodology, PancakeSwap Dark Theme Inspired
 */

:root {
    --color-bg: #08060b;
    --color-card-bg: #27262c;
    --color-panel-bg: #eeeaf4;
    --color-text: #f4eeff;
    --color-text-subtle: #b8add2;
    --color-primary: #1fc7d4;
    --color-primary-hover: #31d0aa;
    --color-danger: #ed4b9e;
    --color-border: #383241;
    --color-modal-overlay: rgba(0, 0, 0, 0.6);

    --radius-card: 24px;
    --radius-panel: 16px;
    --radius-btn: 16px;

    --shadow-card: 0px 2px 12px -8px rgba(25, 19, 38, 0.1), 0px 1px 1px rgba(25, 19, 38, 0.05);

    --font-family: 'Kanit', sans-serif;
}

/* Dark Theme overrides (default is dark for now) */
.theme-dark {
    --color-panel-bg: #3c3742;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-banner {
    background-color: #f3ba2f;
    color: #000;
    text-align: center;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 100;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Typography */
h1,
h2,
h3,
h4,
p {
    margin: 0;
}

.text-accent {
    color: var(--color-primary);
}

.text-secondary {
    color: var(--color-text-subtle);
}

.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 1rem;
}

/* Buttons */
.btn {
    appearance: none;
    border: 0;
    cursor: pointer;
    font-family: var(--font-family);
    font-weight: 600;
    border-radius: var(--radius-btn);
    padding: 0 16px;
    height: 48px;
    font-size: 16px;
    transition: background-color 0.2s, opacity 0.2s, transform 0.1s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    background-color: var(--color-panel-bg);
    color: var(--color-text-subtle);
    cursor: not-allowed;
    box-shadow: none;
}

.btn--primary {
    background-color: var(--color-primary);
    color: white;
    box-shadow: inset 0px -1px 0px rgba(14, 14, 44, 0.4);
}

.btn--primary:hover:not(:disabled) {
    opacity: 0.65;
}

.btn--network {
    background-color: var(--color-panel-bg);
    color: var(--color-text);
    margin-right: 8px;
}

.btn--block {
    width: 100%;
}

/* Header */
.header {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    background-color: var(--color-card-bg);
}

.header__left,
.header__right {
    display: flex;
    align-items: center;
}

.header__logo {
    display: flex;
    align-items: center;
    font-weight: 800;
    font-size: 20px;
    margin-right: 24px;
}

.logo__icon {
    font-size: 24px;
    margin-right: 8px;
}

.header__nav {
    display: none;
    /* Hidden on mobile */
}

@media (min-width: 768px) {
    .header__nav {
        display: flex;
        gap: 16px;
    }
}

.nav__link {
    color: var(--color-text-subtle);
    text-decoration: none;
    font-weight: 400;
    font-size: 16px;
    transition: color 0.2s;
}

.nav__link:hover,
.nav__link--active {
    color: var(--color-text);
    font-weight: 600;
}

/* Main & Card */
.main {
    position: relative;
    z-index: 10;
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 32px 16px;
}

.dex-container {
    width: 100%;
    max-width: 328px;
}

@media (min-width: 576px) {
    .dex-container {
        max-width: 436px;
    }
}

.dex-card {
    background-color: var(--color-card-bg);
    border-radius: var(--radius-card);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-card);
    padding: 1px;
}

.dex-tabs {
    display: flex;
    align-items: center;
    padding: 24px 24px 0 24px;
    border-bottom: 1px solid var(--color-border);
}

.tab__btn {
    background: transparent;
    border: none;
    color: var(--color-text-subtle);
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    padding: 8px 16px;
    cursor: pointer;
    border-bottom: 4px solid transparent;
    transition: color 0.2s;
}

.tab__btn:hover {
    color: var(--color-text);
}

.tab__btn--active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.dex-tabs__settings {
    margin-left: auto;
    cursor: pointer;
    font-size: 20px;
}

/* Views */
.dex-view {
    padding: 24px;
}

.dex-view__header {
    margin-bottom: 16px;
}

.view__title {
    font-size: 20px;
    font-weight: 600;
}

.view__subtitle {
    font-size: 14px;
    color: var(--color-text-subtle);
}

/* Token Panel */
.token-panel {
    background-color: var(--color-panel-bg);
    border-radius: var(--radius-panel);
    padding: 12px 16px;
    border: 1px solid var(--color-panel-bg);
    transition: border-color 0.2s;
}

.token-panel:focus-within {
    border-color: var(--color-primary);
}

.token-panel__header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--color-text-subtle);
    margin-bottom: 8px;
}

.token-panel__body {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.token-panel__input {
    background: transparent;
    border: none;
    color: var(--color-text);
    font-family: var(--font-family);
    font-size: 24px;
    font-weight: 600;
    width: 60%;
    outline: none;
}

.token-panel__input::placeholder {
    color: var(--color-text-subtle);
}

/* Removes arrows from number input */
.token-panel__input::-webkit-outer-spin-button,
.token-panel__input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.token-panel__selector {
    background-color: var(--color-card-bg);
    border: none;
    border-radius: 16px;
    padding: 4px 8px 4px 4px;
    display: flex;
    align-items: center;
    cursor: pointer;
    color: var(--color-text);
    font-family: inherit;
    font-weight: 600;
    font-size: 16px;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
}

.token-panel__selector:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.token-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 8px;
}

.token-chevron {
    font-size: 10px;
    margin-left: 4px;
}

/* Swap Direction Button */
.swap-direction {
    display: flex;
    justify-content: center;
    margin: 4px 0;
}

.btn-swap-direction {
    background-color: var(--color-panel-bg);
    border: none;
    color: var(--color-primary);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-swap-direction:hover {
    background-color: var(--color-primary);
    color: white;
}

/* Trade Info */
.trade-info {
    margin-top: 16px;
    padding: 0 8px;
    font-size: 14px;
    color: var(--color-text-subtle);
}

.trade-info__row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

/* Liquidity Panel */
.liquidity-panel {
    background-color: var(--color-panel-bg);
    border-radius: var(--radius-panel);
    padding: 24px;
    margin-bottom: 16px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-modal-overlay);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal {
    background-color: var(--color-card-bg);
    width: 100%;
    max-width: 420px;
    border-radius: var(--radius-card);
    border: 1px solid var(--color-border);
    box-shadow: 0px 20px 36px -8px rgba(14, 14, 44, 0.1), 0px 1px 1px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

.modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--color-border);
}

.modal__title {
    font-size: 20px;
}

.modal__close {
    background: transparent;
    border: none;
    color: var(--color-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
}

.modal__body {
    padding: 24px;
    overflow-y: auto;
}

.modal__search {
    width: 100%;
    background-color: var(--color-panel-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    border-radius: 16px;
    padding: 16px;
    font-size: 16px;
    font-family: inherit;
    outline: none;
    margin-bottom: 16px;
}

.modal__search:focus {
    border-color: var(--color-primary);
}

.token-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.token-list-item {
    display: flex;
    align-items: center;
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.token-list-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.token-list-item .token-icon {
    width: 32px;
    height: 32px;
}

.token-item-info {
    display: flex;
    flex-direction: column;
}

.token-item-symbol {
    font-weight: 600;
}

.token-item-name {
    font-size: 12px;
    color: var(--color-text-subtle);
}

/* Footer */
.footer {
    position: relative;
    z-index: 10;
    background-color: var(--color-bg);
    border-top: 1px solid var(--color-border);
    padding: 48px 24px 24px;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.footer__main {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 48px;
}

.footer__columns {
    display: flex;
    flex-wrap: wrap;
    gap: 48px;
    flex: 1;
}

.footer__column {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 120px;
}

.footer__column-title {
    color: var(--color-primary);
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.footer__link {
    color: var(--color-text);
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    transition: color 0.2s;
}

.footer__link:hover {
    color: var(--color-primary);
}

.footer__branding {
    display: flex;
    align-items: flex-start;
    font-weight: 800;
    font-size: 20px;
}

.footer__middle {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--color-border);
}

.footer__socials {
    display: flex;
    gap: 24px;
    font-size: 20px;
    color: var(--color-text-subtle);
}

.social-icon {
    cursor: pointer;
    transition: color 0.2s;
}

.social-icon:hover {
    color: var(--color-text);
}

.footer__bottom {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.footer__theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--color-card-bg);
    padding: 6px 16px;
    border-radius: 24px;
    color: var(--color-text-subtle);
    cursor: pointer;
    font-size: 18px;
    border: 1px solid var(--color-border);
}

.footer__bottom-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.footer__token-price {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--color-text-subtle);
}

.btn--buy {
    background-color: var(--color-primary);
    color: #fff;
    border-radius: var(--radius-btn);
    box-shadow: inset 0px -1px 0px rgba(14, 14, 44, 0.4);
}

.btn--buy:hover {
    opacity: 0.65;
}

.font-bold {
    font-weight: 800;
    color: var(--color-text);
}

/* Mobile Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--color-card-bg);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 90;
    box-shadow: 0px -2px 10px rgba(0, 0, 0, 0.2);
}

.bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--color-text-subtle);
    text-decoration: none;
    font-size: 11px;
    gap: 4px;
    font-weight: 600;
}

.bottom-nav__item--active {
    color: var(--color-primary);
}

.bottom-nav__icon {
    font-size: 20px;
}

/* Responsive Overrides */
@media (max-width: 767px) {

    /* Make space for bottom nav */
    html,
    body {
        padding-bottom: 60px;
    }

    /* Dex layout */
    .dex-container {
        max-width: 100%;
    }

    /* Simplify Header for mobile space */
    .header__logo .logo__text {
        display: none;
        /* Hide text, keep only icon */
    }

    .hide-mobile {
        display: none !important;
    }
}

/* Hide bottom nav on larger screens */
@media (min-width: 768px) {
    .bottom-nav {
        display: none;
    }
}

/* Lightning Easter Egg FX */
.fx-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    /* Let clicks pass through */
    z-index: 0;
    opacity: 0;
}

.fx-flash {
    position: absolute;
    inset: 0;
    background-color: #fff;
    /* Lightning flash */
    opacity: 0;
}

.fx-ninja {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150px;
    height: 150px;
    border-radius: 50%;
    /* Make it circular */
    object-fit: cover;
    mix-blend-mode: multiply;
    /* Removes white background */

    /* Edge blurring */
    -webkit-mask-image: radial-gradient(circle, black 30%, transparent 70%);
    mask-image: radial-gradient(circle, black 30%, transparent 70%);

    opacity: 0;
    filter: blur(1px) grayscale(30%);
    pointer-events: none;
}

/* Active Animation Classes */
.fx-overlay.is-active {
    opacity: 1;
}

.fx-overlay.is-active .fx-flash {
    animation: lightning 0.2s ease-out;
}

.fx-overlay.is-active .fx-ninja {
    animation: ghostNinja 1s ease-in-out 0.1s;
}

@keyframes lightning {

    0%,
    100% {
        opacity: 0;
    }

    50% {
        opacity: 0.9;
    }
}

@keyframes ghostNinja {
    0% {
        opacity: 0;
    }

    20% {
        opacity: 0.8;
    }

    80% {
        opacity: 0.8;
    }

    100% {
        opacity: 0;
    }
}