/**
 * Stack Engine — Frontend Styles
 *
 * Uses CSS custom property --stk-accent (set via JS from settings).
 * Falls back to #7C5CFC if not set.
 */

:root {
    --stk-accent: #7C5CFC;
    --stk-accent-light: color-mix(in srgb, var(--stk-accent) 15%, white);
    --stk-accent-hover: color-mix(in srgb, var(--stk-accent) 85%, black);
}

/* ---- Token balance widget ---- */
.stk-balance-widget {
    background: #fff;
    border: 1px solid #e0dce8;
    border-radius: 12px;
    padding: 16px 20px;
    max-width: 280px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    box-shadow: 0 2px 8px rgba(124, 92, 252, 0.08);
}

.stk-balance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.stk-balance-label {
    font-size: 13px;
    font-weight: 600;
    color: #64618a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stk-balance-number {
    font-size: 28px;
    font-weight: 800;
    color: var(--stk-accent);
    line-height: 1;
}

.stk-balance-bar-track {
    height: 6px;
    background: #eee8ff;
    border-radius: 3px;
    overflow: hidden;
}

.stk-balance-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--stk-accent), color-mix(in srgb, var(--stk-accent) 60%, white));
    border-radius: 3px;
    transition: width 0.4s ease;
}

.stk-balance-footer {
    margin-top: 10px;
    text-align: right;
}

.stk-buy-link {
    font-size: 12px;
    color: var(--stk-accent);
    text-decoration: none;
    font-weight: 600;
}

.stk-buy-link:hover {
    text-decoration: underline;
}

/* Low balance warning */
.stk-balance-low {
    border-color: #f0ad4e;
}

.stk-balance-low .stk-balance-number {
    color: #e67e22;
}

.stk-balance-warning {
    font-size: 12px;
    color: #e67e22;
    font-weight: 600;
}

/* ---- Buttons ---- */
.stk-btn {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    border: none;
    line-height: 1.4;
}

.stk-btn:active {
    transform: scale(0.97);
}

.stk-btn-primary {
    background: var(--stk-accent);
    color: #fff;
}

.stk-btn-primary:hover {
    background: var(--stk-accent-hover);
    color: #fff;
}

.stk-btn-secondary {
    background: transparent;
    color: var(--stk-accent);
    border: 1px solid var(--stk-accent);
}

.stk-btn-secondary:hover {
    background: var(--stk-accent-light);
    color: var(--stk-accent-hover);
}

/* ---- Login gate / out-of-tokens ---- */
.stk-login-gate,
.stk-out-of-tokens {
    text-align: center;
    padding: 32px 24px;
    background: #faf8ff;
    border: 1px solid #e0dce8;
    border-radius: 12px;
    max-width: 480px;
    margin: 24px auto;
}

.stk-login-gate p,
.stk-out-of-tokens p {
    font-size: 15px;
    color: #4b4566;
    margin-bottom: 20px;
    line-height: 1.6;
}

.stk-login-gate .stk-btn {
    margin: 0 6px;
}

/* ---- Signup modal (used by tool plugins) ---- */
.stk-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.stk-modal-overlay.stk-visible {
    opacity: 1;
}

.stk-modal {
    background: #fff;
    border-radius: 16px;
    padding: 40px 36px;
    max-width: 440px;
    width: 90%;
    text-align: center;
    position: relative;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: transform 0.25s ease;
}

.stk-modal-overlay.stk-visible .stk-modal {
    transform: translateY(0);
}

.stk-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 22px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.stk-modal-close:hover {
    color: #333;
}

.stk-modal-joke {
    background: var(--stk-accent-light);
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 20px;
    font-size: 15px;
    line-height: 1.6;
    color: #333;
    font-style: italic;
}

.stk-modal h2 {
    font-size: 22px;
    font-weight: 800;
    color: #1a1a2e;
    margin-bottom: 8px;
}

.stk-modal p {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
}

.stk-modal-perks {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.stk-modal-perks li {
    font-size: 13px;
    color: var(--stk-accent);
    font-weight: 600;
}

.stk-modal-perks li::before {
    content: "\2713\00a0";
}

.stk-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.stk-modal-actions .stk-btn {
    width: 100%;
    max-width: 280px;
}

/* ---- My Account — Token Balance tab ---- */
.stk-account-tokens {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

.stk-account-tokens h3 {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 32px 0 12px;
}

/* Balance card */
.stk-account-balance-card {
    background: linear-gradient(135deg, #f8f5ff 0%, #fff 100%);
    border: 1px solid #e0dce8;
    border-radius: 16px;
    padding: 28px 24px;
    max-width: 480px;
}

.stk-account-balance-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.stk-account-balance-label {
    font-size: 14px;
    font-weight: 600;
    color: #64618a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stk-account-balance-number {
    font-size: 40px;
    font-weight: 800;
    color: var(--stk-accent);
    line-height: 1;
}

.stk-account-balance-bar-track {
    height: 8px;
    background: #eee8ff;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.stk-account-balance-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--stk-accent), color-mix(in srgb, var(--stk-accent) 60%, white));
    border-radius: 4px;
    transition: width 0.4s ease;
}

.stk-account-balance-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #8b85a8;
    margin-bottom: 20px;
}

.stk-account-balance-actions {
    text-align: center;
}

/* Tools grid */
.stk-account-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 8px;
}

.stk-account-tool-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    background: #fff;
    border: 1px solid #e0dce8;
    border-radius: 10px;
    text-decoration: none;
    color: #1a1a2e;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.stk-account-tool-card:hover {
    border-color: #7C5CFC;
    box-shadow: 0 2px 8px rgba(124, 92, 252, 0.12);
    color: #1a1a2e;
}

.stk-account-tool-card strong {
    font-size: 14px;
}

.stk-account-tool-cost {
    font-size: 12px;
    color: var(--stk-accent);
    font-weight: 600;
}

/* Transactions table */
.stk-account-transactions {
    width: 100%;
    font-size: 13px;
}

.stk-account-transactions th {
    text-align: left;
    font-weight: 600;
    color: #64618a;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stk-tx-credit {
    color: #00a32a;
    font-weight: 700;
}

.stk-tx-debit {
    color: #d63638;
    font-weight: 700;
}

/* Dashboard widget (shown on My Account main page) */
.stk-dashboard-widget {
    background: linear-gradient(135deg, #f8f5ff 0%, #fff 100%);
    border: 1px solid #e0dce8;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 24px;
    max-width: 480px;
}

.stk-dashboard-widget-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.stk-dashboard-widget-label {
    font-size: 13px;
    font-weight: 600;
    color: #64618a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stk-dashboard-widget-number {
    font-size: 32px;
    font-weight: 800;
    color: var(--stk-accent);
    line-height: 1;
}

.stk-dashboard-widget-actions {
    display: flex;
    gap: 16px;
}

.stk-dashboard-widget-actions a {
    font-size: 13px;
    font-weight: 600;
    color: var(--stk-accent);
    text-decoration: none;
}

.stk-dashboard-widget-actions a:hover {
    text-decoration: underline;
}
