/* ====================================================== Armoni Authenticator PWA */

:root {
    --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
    --font-mono: 'SF Mono', 'Menlo', 'Courier New', monospace;
    --bg-base: #f2f2f7;
    --bg-card: #ffffff;
    --bg-input: #f6f6f9;
    --border: #e5e5ea;
    --border-light: #efefef;
    --text: #1c1c1e;
    --text-secondary: #48484a;
    --text-muted: #8e8e93;
    --text-placeholder: #aeaeb2;
    --accent: #2DD4A0;
    --accent-dark: #1B6B5A;
    --accent-deep: #0F3D35;
    --accent-rgb: 45, 212, 160;
    --accent-glow: rgba(45, 212, 160, 0.18);
    --error: #ff3b30;
    --error-bg: rgba(255, 59, 48, 0.07);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }

body {
    font-family: var(--font);
    background: var(--bg-base);
    color: var(--text);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
}

/* ====================================================== Layout */

.app-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 0 24px;
    min-height: 0;
}

/* When home screen is active, expand full width */
body.mode-home {
    padding-top: 0;
}

body.mode-home .app-container {
    max-width: 100%;
    padding: 0;
    justify-content: flex-start;
    height: 100%;
}

body.mode-home .app-header {
    display: none;
}

body.mode-home .app-content {
    height: 100%;
}

/* ====================================================== Header */

.app-header {
    text-align: center;
    padding: 0 0 4px;
    flex-shrink: 0;
}

.app-header-logo {
    display: inline-block;
    cursor: default;
}

.app-header img {
    height: 44px;
    width: auto;
    -webkit-touch-callout: none;
    pointer-events: none;
}

.app-header p {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 6px;
    margin-bottom: 0;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* ====================================================== Content */

.app-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ====================================================== Cards */

.card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 0 0 0.5px rgba(0,0,0,0.04), 0 2px 8px rgba(0,0,0,0.04);
}

.card-body {
    padding: 24px 20px;
}

/* ====================================================== Login form */

.login-greeting {
    text-align: center;
    margin-bottom: 28px;
    margin-top: 8px;
}

.login-greeting h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

.login-greeting p {
    font-size: 15px;
    color: var(--text-muted);
    margin-top: 6px;
}

.login-fields {
    margin-bottom: 4px;
}

.field {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-card);
    padding: 0 16px;
}

.field + .field {
    border-top: 0.5px solid var(--border-light);
}

.field-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--text-muted);
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.field-icon svg {
    width: 20px;
    height: 20px;
}

.field input {
    flex: 1;
    padding: 16px 0;
    background: none;
    border: none;
    color: var(--text);
    font-size: 17px;
    font-family: var(--font);
    outline: none;
    -webkit-appearance: none;
    min-width: 0;
}

.field input::placeholder {
    color: var(--text-placeholder);
}

.field:first-child {
    border-radius: 16px 16px 0 0;
}

.field:last-child {
    border-radius: 0 0 16px 16px;
}

.pwd-toggle {
    background: none;
    border: none;
    padding: 8px;
    margin-right: -8px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
}

.pwd-toggle:active {
    color: var(--text-secondary);
}

.pwd-toggle svg {
    width: 22px;
    height: 22px;
}

/* ====================================================== Primary button */

.btn {
    width: 100%;
    padding: 16px;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    border: none;
    -webkit-appearance: none;
    transition: transform 0.12s, opacity 0.12s;
    position: relative;
    overflow: hidden;
}

.btn:active { transform: scale(0.975); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.btn-primary {
    background: var(--accent-deep);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(15, 61, 53, 0.2);
}

.btn-login {
    margin-top: 20px;
}

/* ====================================================== Alerts */

.alert-error {
    background: var(--error-bg);
    color: var(--error);
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
    display: none;
    text-align: center;
}

.alert-error.show { display: block; }

/* ====================================================== Screens */

.screen { display: none; flex: 1; flex-direction: column; }
.screen.active { display: flex; }

.screen-center {
    justify-content: center;
    align-items: stretch;
}

/* ====================================================== Screen iconography */

.screen-icon {
    text-align: center;
    margin-bottom: 16px;
}

.screen-icon-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--accent-glow);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.screen-icon-circle svg {
    width: 32px;
    height: 32px;
}

.screen-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    text-align: center;
    letter-spacing: -0.3px;
}

.screen-subtitle {
    font-size: 15px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 8px;
    margin-bottom: 28px;
    line-height: 1.45;
    padding: 0 8px;
}

/* ====================================================== OTP input */

.otp-card .field input {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 10px;
    font-family: var(--font-mono);
    padding: 20px 0;
}

/* ====================================================== Home Screen (tabbed) */

.home-screen.active {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-base);
    z-index: 100;
}

/* --- Native header bar --- */
.nav-header {
    flex-shrink: 0;
    padding: 12px 20px 10px;
    padding-top: max(12px, var(--safe-top));
}

.nav-title {
    font-size: 32px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
}

/* --- Tab panels --- */
.tab-panel {
    display: none;
    flex: 1;
    flex-direction: column;
}

.tab-panel.active {
    display: flex;
}

.tab-panel-scroll {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 20px 24px;
}

/* --- Tab bar (bottom) --- */
.tab-bar {
    flex-shrink: 0;
    display: flex;
    background: rgba(255,255,255,0.92);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-top: 0.5px solid var(--border);
    padding: 6px 0 calc(6px + var(--safe-bottom));
}

.tab-bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    padding: 4px 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    color: var(--text-muted);
    transition: color 0.15s;
}

.tab-bar-item.active {
    color: var(--accent-dark);
}

.tab-bar-item svg {
    width: 22px;
    height: 22px;
}

.tab-bar-item span {
    font-size: 10px;
    font-weight: 600;
    font-family: var(--font);
    letter-spacing: 0.1px;
}

/* --- Empty tab placeholder --- */
.tab-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.tab-empty-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 16px;
}

.tab-empty-icon svg {
    width: 56px;
    height: 56px;
}

.tab-empty-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.tab-empty-sub {
    font-size: 14px;
    color: var(--text-placeholder);
}

/* --- Center: hero area --- */
.h-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
}

/* --- Idle state --- */
.h-idle {
    text-align: center;
    width: 100%;
}

.h-trigger {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: none;
    background: var(--accent-deep);
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 28px;
    box-shadow:
        0 0 0 12px rgba(15, 61, 53, 0.06),
        0 0 0 24px rgba(15, 61, 53, 0.03),
        0 8px 32px rgba(15, 61, 53, 0.2);
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.h-trigger:active {
    transform: scale(0.92);
    box-shadow:
        0 0 0 8px rgba(15, 61, 53, 0.06),
        0 0 0 16px rgba(15, 61, 53, 0.03),
        0 4px 16px rgba(15, 61, 53, 0.15);
}

.h-trigger svg {
    opacity: 0.9;
}

.h-idle-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
    margin-bottom: 6px;
}

.h-idle-sub {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 400;
}

/* --- Active state (code visible) --- */
.h-active {
    text-align: center;
    width: 100%;
}

.h-code-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 16px;
}

.h-code {
    font-size: 48px;
    font-weight: 700;
    letter-spacing: 6px;
    color: var(--text);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    margin-bottom: 32px;
    line-height: 1;
}

.h-bar-wrap {
    width: 100%;
    max-width: 260px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 16px;
    overflow: hidden;
}

.h-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    width: 100%;
    transition: width 1s linear;
}

.h-bar.h-bar-warn {
    background: var(--error);
}

.h-timer {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* --- Bottom: actions --- */
.h-bottom {
    flex-shrink: 0;
    text-align: center;
    padding: 16px 0 8px;
}

.h-actions {
    margin-bottom: 0;
}

.h-btn-new {
    background: none;
    border: none;
    font-size: 15px;
    font-weight: 600;
    color: var(--accent-dark);
    font-family: var(--font);
    cursor: pointer;
    padding: 10px 24px;
    -webkit-tap-highlight-color: transparent;
}

.h-btn-new:active {
    opacity: 0.5;
}

/* ====================================================== Profile */

.profile-header {
    text-align: center;
    padding: 8px 0 28px;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    font-size: 26px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    letter-spacing: -0.5px;
}

.profile-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

.profile-email {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 2px;
}

.profile-group {
    margin-bottom: 24px;
}

.profile-group-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 16px 8px;
}

.profile-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 14px;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: var(--font);
    cursor: default;
}

.profile-row + .profile-row {
    border-top: 0.5px solid var(--border-light);
}

.profile-row-icon {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-row-icon svg {
    width: 16px;
    height: 16px;
}

.profile-row-text {
    flex: 1;
    font-size: 16px;
    color: var(--text);
}

.profile-row-detail {
    font-size: 14px;
    color: var(--text-muted);
}

.profile-chevron {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.profile-row-tap {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.profile-row-tap:active {
    background: var(--bg-input);
}

.profile-version {
    text-align: center;
    font-size: 12px;
    color: var(--text-placeholder);
    padding: 16px 0 0;
}

/* ====================================================== Install */

.install-steps { text-align: left; }

.install-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 0.5px solid var(--border-light);
}

.install-step:last-child { border-bottom: none; }

.install-step-num {
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 50%;
    background: var(--accent-glow);
    color: var(--accent-dark);
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.install-step-text {
    font-size: 15px;
    color: var(--text);
    line-height: 1.5;
    padding-top: 2px;
}
