/* ============================================
   MERLOW MINI APP -- clgate.network inspired
   Unbounded font, monochrome dark, subtle surfaces
   ============================================ */

/* ---------- FONTS ---------- */
@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@300;400;500;600;700;800;900&display=swap');

/* ---------- CSS VARIABLES ---------- */
:root {
    --black: #080808;
    --surface: #0f0f0f;
    --elevated: #161616;
    --border: rgba(255,255,255,.08);
    --border-hover: rgba(255,255,255,.18);
    --white: #ffffff;
    --white-80: rgba(255,255,255,.8);
    --white-50: rgba(255,255,255,.5);
    --white-25: rgba(255,255,255,.25);
    --white-10: rgba(255,255,255,.10);
    --white-06: rgba(255,255,255,.06);
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #f87171;
    --r-card: 16px;
    --r-btn: 12px;
    --r-badge: 8px;
    --transition: .2s ease;
    --font: 'Unbounded', sans-serif;
}

/* ---------- RESET ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    background: var(--black);
    color: var(--white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* ---------- APP SHELL ---------- */
#app {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--black);
    background-image:
        linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
    background-size: 60px 60px;
    position: relative;
    overflow: hidden;
}

/* ---------- HEADER ---------- */
.header {
    padding: 16px 20px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
}

.header__title {
    font-family: var(--font);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--white);
}

.header__subtitle {
    font-size: 11px;
    font-weight: 500;
    color: var(--white-25);
    margin-top: 2px;
    letter-spacing: .04em;
    text-transform: uppercase;
}

/* ---------- CONTENT AREA ---------- */
.content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 16px 16px;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.content::-webkit-scrollbar {
    width: 6px;
}

.content::-webkit-scrollbar-track {
    background: var(--black);
}

.content::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 3px;
}

/* ---------- SCREENS ---------- */
.screen {
    display: none;
    animation: screenIn 0.35s ease-out;
}

.screen.active {
    display: block;
}

@keyframes screenIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- CARD (clgate surface style) ---------- */
.glass {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    padding: 24px;
    position: relative;
    transition: border-color var(--transition);
}

.glass:hover {
    border-color: var(--border-hover);
}

.glass--bright {
    background: var(--elevated);
    border-color: var(--border-hover);
}

/* ---------- ACTIVATION SCREEN ---------- */
.activation-card {
    padding: 28px 24px;
    margin-bottom: 16px;
}

.activation-card__icon {
    width: 56px;
    height: 56px;
    border-radius: var(--r-card);
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    filter: drop-shadow(0 0 40px rgba(255,255,255,.06));
}

.activation-card__icon svg {
    width: 26px;
    height: 26px;
    opacity: 0.5;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-6px); }
}

.activation-card__title {
    font-family: var(--font);
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.activation-card__desc {
    text-align: center;
    font-size: 13px;
    font-weight: 400;
    color: var(--white-50);
    margin-bottom: 28px;
    line-height: 1.7;
}

/* ---------- INPUT ---------- */
.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-group__field {
    width: 100%;
    height: 52px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-btn);
    padding: 0 16px;
    font-family: var(--font);
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 2px;
    color: var(--white);
    text-align: center;
    text-transform: uppercase;
    transition: border-color var(--transition);
    outline: none;
}

.input-group__field::placeholder {
    color: var(--white-25);
    letter-spacing: 1px;
    font-weight: 400;
    text-transform: none;
}

.input-group__field:focus {
    border-color: var(--border-hover);
}

.input-group__hint {
    text-align: center;
    font-size: 11px;
    font-weight: 500;
    color: var(--white-25);
    margin-top: 10px;
    letter-spacing: .04em;
}

/* ---------- BUTTON ---------- */
.btn {
    width: 100%;
    height: 52px;
    border: none;
    border-radius: var(--r-btn);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .02em;
    cursor: pointer;
    transition: all .15s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn--primary {
    background: var(--white);
    color: var(--black);
    border: none;
}

.btn--primary:hover {
    background: var(--white-80);
}

.btn--primary:active {
    transform: scale(.97);
}

.btn--primary:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.btn--ghost {
    background: transparent;
    border: 1px solid var(--border-hover);
    color: var(--white);
}

.btn--ghost:hover {
    background: var(--white-06);
    border-color: var(--white);
}

.btn--ghost:active {
    transform: scale(.97);
}

.btn--small {
    height: 36px;
    font-size: 12px;
    padding: 9px 18px;
    border-radius: var(--r-badge);
}

/* ---------- SPINNER ---------- */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--white-10);
    border-top-color: var(--black);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- RESULT CARD ---------- */
.result-card {
    padding: 24px;
    margin-top: 16px;
    animation: resultIn 0.4s ease-out;
}

@keyframes resultIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.result-card__header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.result-card__status-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--r-btn);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.result-card__status-icon--success {
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.2);
}

.result-card__status-icon--error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.result-card__status-icon svg {
    width: 20px;
    height: 20px;
}

.result-card__status-icon--success svg {
    stroke: var(--success);
}

.result-card__status-icon--error svg {
    stroke: var(--danger);
}

.result-card__status-text {
    font-family: var(--font);
    font-size: 16px;
    font-weight: 600;
}

.result-card__status-text--success {
    color: var(--success);
}

.result-card__status-text--error {
    color: var(--danger);
}

.result-card__name {
    font-size: 14px;
    font-weight: 400;
    color: var(--white-50);
    margin-bottom: 16px;
}

/* ---------- DATA ROWS ---------- */
.data-rows {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.data-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: var(--r-badge);
    background: var(--white-06);
    transition: background var(--transition);
}

.data-row:hover {
    background: var(--white-10);
}

.data-row__label {
    font-size: 11px;
    font-weight: 500;
    color: var(--white-25);
    letter-spacing: .04em;
    text-transform: uppercase;
    flex-shrink: 0;
    min-width: 70px;
}

.data-row__value {
    font-family: var(--font);
    font-size: 13px;
    font-weight: 400;
    color: var(--white);
    text-align: right;
    word-break: break-all;
    margin-right: 8px;
    flex: 1;
}

.data-row__copy {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--white-06);
    border-radius: var(--r-badge);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
    flex-shrink: 0;
}

.data-row__copy:hover {
    background: var(--white-10);
}

.data-row__copy:active {
    transform: scale(.9);
}

.data-row__copy svg {
    width: 14px;
    height: 14px;
    opacity: 0.5;
}

.data-row__copy.copied {
    background: var(--white-10);
}

.data-row__copy.copied svg {
    opacity: 0.9;
}

.data-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

/* ---------- COPY ALL BUTTON ---------- */
.copy-all {
    margin-top: 16px;
}

/* ---------- PROFILE SCREEN ---------- */
.profile-header {
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    overflow: hidden;
}

.profile-avatar svg {
    width: 32px;
    height: 32px;
    opacity: 0.5;
}

.profile-name {
    font-family: var(--font);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.profile-id {
    font-size: 11px;
    font-weight: 500;
    color: var(--white-25);
    letter-spacing: .04em;
    margin-bottom: 16px;
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.profile-stat {
    text-align: center;
}

.profile-stat__value {
    font-family: var(--font);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.profile-stat__label {
    font-size: 11px;
    font-weight: 500;
    color: var(--white-25);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: 2px;
}

/* ---------- ACCOUNTS LIST ---------- */
.accounts-section {
    margin-bottom: 16px;
}

.accounts-section__title {
    font-family: var(--font);
    font-size: 11px;
    font-weight: 500;
    color: var(--white-25);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 12px;
    padding: 0 4px;
}

.account-card {
    padding: 18px 20px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color var(--transition);
}

.account-card:hover {
    border-color: var(--border-hover);
}

.account-card:active {
    transform: scale(.99);
}

.account-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.account-card__name {
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.account-card__date {
    font-size: 11px;
    font-weight: 400;
    color: var(--white-25);
}

.account-card__chevron {
    margin-left: 8px;
    transition: transform 0.3s ease;
    opacity: 0.3;
}

.account-card.expanded .account-card__chevron {
    transform: rotate(180deg);
}

.account-card__details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.account-card.expanded .account-card__details {
    max-height: 500px;
    opacity: 1;
}

.account-card__data {
    padding-top: 14px;
    margin-top: 14px;
    border-top: 1px solid var(--border);
}

/* ---------- EMPTY STATE ---------- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-state__icon {
    width: 64px;
    height: 64px;
    border-radius: var(--r-card);
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.empty-state__icon svg {
    width: 28px;
    height: 28px;
    opacity: 0.25;
}

.empty-state__title {
    font-family: var(--font);
    font-size: 16px;
    font-weight: 500;
    color: var(--white-50);
    margin-bottom: 6px;
}

.empty-state__desc {
    font-size: 13px;
    font-weight: 400;
    color: var(--white-25);
    line-height: 1.7;
}

/* ---------- BOTTOM NAV ---------- */
.nav {
    padding: 8px 16px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    display: flex;
    gap: 8px;
    background: rgba(8,8,8,.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    position: relative;
    z-index: 10;
}

.nav__item {
    flex: 1;
    height: 48px;
    border: 1px solid transparent;
    border-radius: var(--r-btn);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    color: var(--white-25);
    cursor: pointer;
    transition: all var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.nav__item:hover {
    color: var(--white-50);
    background: var(--white-06);
}

.nav__item:active {
    transform: scale(.97);
}

.nav__item.active {
    color: var(--white);
    background: var(--white-10);
    border-color: var(--border-hover);
}

.nav__item svg {
    width: 18px;
    height: 18px;
}

/* ---------- TOAST ---------- */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--elevated);
    border: 1px solid var(--border-hover);
    border-radius: var(--r-btn);
    padding: 10px 20px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    color: var(--white);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---------- LOADING OVERLAY ---------- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--white-10);
    border-top-color: var(--white-80);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ---------- PENDING BADGE (clgate eyebrow style) ---------- */
.pending-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 5px 14px;
    font-size: 10px;
    font-weight: 700;
    color: var(--white-50);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: 8px;
}

.pending-badge__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--warning);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* ---------- RESPONSIVE ---------- */
@media (min-width: 480px) {
    .content {
        padding: 0 24px 24px;
    }
}
