/* Presale Modal Styles - Premium Responsive Glassmorphism */
:root {
    --modal-overlay: rgba(5, 5, 10, 0.85);
    --modal-bg: rgba(18, 18, 34, 0.85);
    /* Slightly more opaque for readability */
    --modal-border: rgba(155, 92, 255, 0.2);
    --modal-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    --purple: #9B5CFF;
    --purple-dark: #6F4CFF;
}

/* OVERLAY: Centered Flex Container */
.presale-overlay {
    position: fixed;
    inset: 0;
    background: var(--modal-overlay);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9999;
    display: flex;
    align-items: center;
    /* Center Vertically */
    justify-content: center;
    /* Center Horizontally */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 16px;
    /* Safe padding from screen edges */
}

.presale-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* MODAL: Responsive Box */
.presale-modal {
    background: var(--modal-bg);
    border: 1px solid var(--modal-border);
    box-shadow: var(--modal-shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);

    border-radius: 24px;
    padding: 40px;
    /* Increased padding */

    /* Layout */
    width: 100%;
    max-width: 600px;
    /* Increased width */
    max-height: 90vh;
    /* Prevent overflowing screen height */
    overflow-y: auto;
    /* Scroll info if height is small */

    /* Animation */
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    /* ensure proper stacking */
}

.presale-overlay.active .presale-modal {
    transform: scale(1);
}

/* HEADER */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 16px;
}

.modal-header h2 {
    font-family: "Space Grotesk", sans-serif;
    font-size: 20px;
    margin: 0;
    color: #fff;
    text-shadow: 0 0 20px rgba(155, 92, 255, 0.4);
}

.close-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--muted);
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* CONTENT: Stats */
.presale-stats {
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.progress-container {
    margin-bottom: 12px;
}

.progress-bar-bg {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 99px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6F4CFF, #9B5CFF);
    width: 0%;
    transition: width 1s ease;
    box-shadow: 0 0 15px rgba(155, 92, 255, 0.6);
}

.exchange-rate {
    text-align: center;
    font-size: 12px;
    color: var(--muted2);
    font-family: monospace;
    letter-spacing: 0.5px;
}

/* CONTENT: Inputs */
.input-group {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.2s;
}

.input-group:focus-within {
    border-color: rgba(155, 92, 255, 0.5);
    box-shadow: 0 0 15px rgba(155, 92, 255, 0.1);
}

.input-wrapper {
    flex: 1;
}

.input-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted2);
    margin-bottom: 6px;
    font-weight: 600;
}

.token-input {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 20px;
    /* Optimal size */
    font-family: "Space Grotesk", sans-serif;
    width: 100%;
    font-weight: 600;
    outline: none;
}

.token-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

/* Coin Selector */
.currency-toggle {
    display: flex;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: 99px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.token-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 99px;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.token-selector:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.token-selector.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.1);
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.token-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ccc;
}

.arrow-divider {
    text-align: center;
    color: var(--purple);
    margin: -6px 0 6px;
    font-size: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(3px);
    }
}

/* ACTION BUTTON */
.action-btn {
    width: 90%;
    /* Reduced width */
    display: block;
    margin: 12px auto 0;
    /* Center align */
    padding: 14px;
    /* Reduced padding */
    border-radius: 14px;
    background: linear-gradient(135deg, #9B5CFF, #6F4CFF);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-family: "Space Grotesk", sans-serif;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 10px 30px rgba(155, 92, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(155, 92, 255, 0.5);
    filter: brightness(1.1);
}

.action-btn:active {
    transform: translateY(1px);
}

.action-btn:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: var(--muted);
    border-color: transparent;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

/* WALLET SELECTION */
.wallet-status {
    margin-top: 14px;
    /* Reduced space */
    padding-top: 14px;
    /* Reduced space */
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.wallet-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.wallet-option {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.wallet-option:hover {
    background: rgba(155, 92, 255, 0.1);
    border-color: var(--purple);
    transform: scale(1.02);
}

.wallet-option .wallet-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
}

/* =========================================
   RESPONSIVE OVERRIDES
   ========================================= */

/* Tablets & Small Computers (Narrower modal) */
@media (max-width: 768px) {
    .presale-modal {
        max-width: 90%;
        /* Use available width with margins */
        padding: 24px;
    }
}

/* Mobile Devices (Stack Layout) */
@media (max-width: 480px) {
    .presale-modal {
        padding: 20px;
        border-radius: 20px;
    }

    /* Stack Inputs vertically on mobile */
    .input-group {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px;
    }

    .currency-toggle,
    .token-selector {
        width: 100%;
        justify-content: center;
    }

    /* Make token icons bigger/easier to see in vertical layout */
    .token-selector {
        padding: 8px;
    }

    .wallet-grid {
        grid-template-columns: 1fr;
        /* Stack wallet options */
    }
}