/* Token page styles — standalone download */

/* Ensure [hidden] always wins over display rules */
[hidden] { display: none !important; }

.token-page {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1a1a2e;
    line-height: 1.6;
    max-width: 720px;
    margin: 0 auto;
}

/* Header: logo initial + title */
.tp-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.tp-logo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #6c5ce7;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    flex-shrink: 0;
}

.tp-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

/* Section */
.tp-section {
    margin-bottom: 1.5rem;
}

.tp-section-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
    color: #444;
}

/* Row: label + value */
.tp-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.tp-row:last-child {
    border-bottom: none;
}

.tp-label {
    font-size: 0.875rem;
    color: #666;
    flex-shrink: 0;
    margin-right: 1rem;
}

.tp-value {
    font-size: 0.875rem;
    font-weight: 500;
    text-align: right;
    word-break: break-all;
}

.tp-mono {
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.8125rem;
}

/* ---- Wallet connection ---- */

.tp-connect-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    background: #6c5ce7;
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.tp-connect-btn:hover {
    background: #5a4bd1;
}

/* Wallet wrapper: button + dropdown */
.tp-wallet-wrapper {
    margin-left: auto;
    position: relative;
    flex-shrink: 0;
}

/* Address display inside dropdown */
.tp-dropdown-addr {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #f0f0f0;
}

/* Address display (matches main app's addr-display) */
.addr-display {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.addr-link {
    color: #6c5ce7;
    text-decoration: none;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.8125rem;
}

.addr-link:hover {
    text-decoration: underline;
}

.addr-copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: #666;
    border-radius: 0.25rem;
    transition: color 0.15s, background 0.15s;
}

.addr-copy-btn:hover {
    color: #6c5ce7;
    background: #f0f0f0;
}

/* Dropdown menu */
.tp-wallet-dropdown {
    position: absolute;
    top: calc(100% + 0.375rem);
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 160px;
    z-index: 100;
    padding: 0.25rem 0;
}

.tp-dropdown-item {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    background: none;
    text-align: left;
    font-size: 0.8125rem;
    color: #1a1a2e;
    cursor: pointer;
}

.tp-dropdown-item:hover {
    background: #f8f8f8;
}

.tp-dropdown-danger {
    color: #c0392b;
}

.tp-dropdown-danger:hover {
    background: #fdf0ef;
}

/* Modal overlay + dialog (shared by wallet picker & deep link) */
.tp-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.tp-modal {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1.5rem;
    width: 90%;
    max-width: 360px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.tp-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.tp-modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.tp-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    line-height: 1;
    padding: 0;
}

.tp-wallet-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tp-wallet-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 0.5rem;
    background: #fff;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: #1a1a2e;
    text-align: left;
}

.tp-wallet-option:hover {
    background: #f8f8f8;
    border-color: #ccc;
}

.tp-wallet-option img {
    width: 28px;
    height: 28px;
    border-radius: 0.25rem;
}

/* ---- Token Sale ---- */

.tp-buy-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.tp-buy-form .tp-label {
    display: block;
    margin-bottom: 0.375rem;
}

.tp-buy-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.tp-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: #1a1a2e;
    background: #fff;
    outline: none;
    transition: border-color 0.15s;
}

.tp-input:focus {
    border-color: #6c5ce7;
}

.tp-input::placeholder {
    color: #aaa;
}

/* Hide number spinner */
.tp-input::-webkit-inner-spin-button,
.tp-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.tp-input[type=number] {
    -moz-appearance: textfield;
}

.tp-buy-max {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 0.375rem;
    background: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c5ce7;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}

.tp-buy-max:hover {
    background: #f8f8f8;
    border-color: #6c5ce7;
}

.tp-buy-btn {
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
}

.tp-buy-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tp-sale-warning {
    font-size: 0.8125rem;
    color: #c0392b;
    margin-top: 0.375rem;
}

.tp-sale-hint {
    font-size: 0.8125rem;
    color: #888;
    text-align: center;
    margin-top: 0.5rem;
}

.tp-tx-msg {
    font-size: 0.8125rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    margin-top: 0.75rem;
}

.tp-tx-success {
    background: #eafaf1;
    color: #27ae60;
    border: 1px solid #d5f5e3;
}

.tp-tx-error {
    background: #fdf0ef;
    color: #c0392b;
    border: 1px solid #fadbd8;
}

.tp-direct-send {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.tp-direct-addr {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: #f8f8f8;
    border-radius: 0.375rem;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.75rem;
    word-break: break-all;
}

/* ---- Staking ---- */

.tp-staking-warning {
    font-size: 0.8125rem;
    color: #c0392b;
    background: #fdf0ef;
    border: 1px solid #fadbd8;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    margin-bottom: 0.75rem;
}

.tp-term-explain {
    font-size: 0.8125rem;
    color: #888;
    margin: -0.25rem 0 0.25rem 0;
    padding-bottom: 0.25rem;
}

.tp-user-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f8f8f8;
    border-radius: 0.375rem;
    margin-bottom: 0.75rem;
    font-size: 0.8125rem;
}

.tp-user-summary .tp-summary-item {
    text-align: center;
}

.tp-user-summary .tp-summary-label {
    color: #888;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tp-user-summary .tp-summary-value {
    font-weight: 600;
    color: #1a1a2e;
}

.tp-penalty-breakdown {
    background: #f8f8f8;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    margin-top: 0.375rem;
    font-size: 0.8125rem;
}

.tp-penalty-breakdown .tp-row {
    padding: 0.25rem 0;
    border-bottom: none;
}

.tp-penalty-line-penalty {
    color: #c0392b;
}

.tp-penalty-line-net {
    font-weight: 600;
    border-top: 1px solid #e0e0e0;
    padding-top: 0.375rem;
    margin-top: 0.25rem;
}

.tp-stake-countdown {
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.75rem;
    color: #6c5ce7;
}

.tp-unstake-btn-early {
    background: #c0392b;
}

.tp-unstake-btn-early:hover {
    background: #a93226;
}

.tp-stake-withdrawn {
    font-size: 0.8125rem;
    color: #888;
    text-align: center;
    margin-top: 0.375rem;
}

.tp-subsection-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 1rem 0 0.5rem 0;
    color: #444;
}

.tp-staking-plans {
    margin-bottom: 0.5rem;
}

.tp-plans-table {
    border: 1px solid #f0f0f0;
    border-radius: 0.375rem;
    overflow: hidden;
}

.tp-plans-header {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: #f8f8f8;
    font-size: 0.75rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tp-plans-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border-top: 1px solid #f0f0f0;
}

.tp-stake-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.tp-stake-form .form-group {
    margin-bottom: 0.75rem;
}

.tp-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: #1a1a2e;
    background: #fff;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s;
}

.tp-select:focus {
    border-color: #6c5ce7;
}

.tp-stakes-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tp-stake-card {
    border: 1px solid #e0e0e0;
    border-radius: 0.5rem;
    padding: 0.75rem;
}

.tp-stake-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.tp-stake-id {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #444;
}

.tp-stake-status {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.tp-status-unstaked {
    background: #f0f0f0;
    color: #888;
}

.tp-status-ready {
    background: #eafaf1;
    color: #27ae60;
}

.tp-status-early {
    background: #fef9e7;
    color: #f39c12;
}

.tp-status-locked {
    background: #fdf0ef;
    color: #c0392b;
}

.tp-stake-card .tp-row:last-of-type {
    border-bottom: none;
}

.tp-unstake-btn {
    margin-top: 0.5rem;
}

/* ---- Lock cards ---- */
.tp-lock-card {
    border: 1px solid #f0f0f0;
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.tp-lock-card:last-child {
    margin-bottom: 0;
}

.tp-lock-desc {
    font-size: 0.8125rem;
    color: #555;
    margin-bottom: 0.5rem;
    font-style: italic;
}

.tp-lock-status {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.tp-lock-status-locked {
    background: #eef4f9;
    color: #3a7caa;
}

.tp-lock-status-vesting {
    background: #fef9e7;
    color: #b8860b;
}

.tp-lock-status-unlocked {
    background: #f0f0f0;
    color: #888;
}

.tp-lock-link {
    margin-top: 0.5rem;
    text-align: right;
}

.tp-lock-link a {
    font-size: 0.8125rem;
    color: #3a7caa;
    text-decoration: none;
}

.tp-lock-link a:hover {
    text-decoration: underline;
}

.tp-lock-warning {
    margin-top: 0.375rem;
    padding: 0.375rem 0.625rem;
    background: #fef3e7;
    border: 1px solid #f5c67a;
    border-radius: 0.25rem;
    font-size: 0.8125rem;
    color: #b8860b;
}

/* ---- Mobile ---- */
@media (max-width: 480px) {
    .token-page {
        padding: 0 0.5rem;
    }

    .tp-header {
        gap: 0.5rem;
    }

    .tp-logo {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .tp-title {
        font-size: 1.25rem;
    }

    .tp-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.125rem;
    }

    .tp-value {
        text-align: left;
    }

    .tp-connect-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
    }

    .addr-link {
        font-size: 0.75rem;
    }
}
