/* =========================================================
   ZoroMail — 2FA / TOTP generator page
   Builds on the variables/theme defined in style.css
   ========================================================= */

.btn-sm { padding: 8px 14px; font-size: .86rem; }

.totp-main { padding: 48px 24px 40px; max-width: 760px; }

/* ---------- Hero ---------- */
.totp-hero { margin-bottom: 32px; }
.totp-hero h1 {
    font-size: clamp(2rem, 5vw, 2.7rem);
    font-weight: 800;
    letter-spacing: -.03em;
    color: var(--text);
    margin-top: 8px;
}
.totp-hero p {
    margin-top: 14px;
    color: var(--text-muted);
    font-size: 1.02rem;
    line-height: 1.7;
    max-width: 600px;
}
.totp-hero strong { color: var(--text); }

/* ---------- Add card ---------- */
.totp-add-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 32px;
}
.totp-card-title {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 18px;
}
.totp-card-title svg { color: var(--primary); }

.totp-add-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 14px;
    align-items: end;
}
.totp-add-form .field { display: flex; flex-direction: column; gap: 7px; }
.totp-add-form label {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
}
.totp-add-form input {
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 12px 13px;
    font-size: .95rem;
    outline: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.totp-add-form input:focus {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
#accSecret { font-family: var(--font-mono); }
.totp-add-btn { white-space: nowrap; height: 46px; }
.totp-add-hint { margin-top: 14px; font-size: .84rem; color: var(--text-dim); }

/* ---------- List ---------- */
.totp-list-head { margin-bottom: 16px; }
.totp-list-head h2 { font-size: 1.2rem; display: inline-flex; align-items: center; gap: 10px; }
.totp-count {
    display: inline-grid;
    place-items: center;
    min-width: 24px; height: 24px;
    padding: 0 8px;
    border-radius: var(--radius-pill);
    background: var(--primary);
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
}

.totp-list { display: flex; flex-direction: column; gap: 12px; }
.totp-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.totp-avatar {
    flex-shrink: 0;
    width: 46px; height: 46px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 1.2rem;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: var(--shadow-xs);
}

.totp-info { flex: 1; min-width: 0; }
.totp-name {
    font-weight: 700;
    font-size: .95rem;
    color: var(--text);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.totp-code {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    padding: 2px 0;
    cursor: pointer;
    color: var(--primary);
}
.totp-code-value {
    font-family: var(--font-mono);
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--primary);
}
.totp-code-value.is-invalid {
    color: var(--danger);
    font-size: 1.1rem;
    letter-spacing: 0;
}
.totp-copy-ic { color: var(--text-dim); opacity: 0; transition: opacity .15s, color .15s; }
.totp-code:hover .totp-copy-ic { opacity: 1; color: var(--primary); }

/* ---------- Timer ring ---------- */
.totp-timer {
    position: relative;
    flex-shrink: 0;
    width: 38px; height: 38px;
    display: grid;
    place-items: center;
}
.totp-ring { transform: rotate(-90deg); }
.totp-ring-bg {
    fill: none;
    stroke: var(--surface-3);
    stroke-width: 3;
}
.totp-ring-fg {
    fill: none;
    stroke: var(--primary);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset .5s linear, stroke .3s;
}
.totp-ring-fg.is-low { stroke: var(--danger); }
.totp-secs {
    position: absolute;
    font-family: var(--font-mono);
    font-size: .8rem;
    font-weight: 700;
    color: var(--text-muted);
}
.totp-secs.is-low { color: var(--danger); }

/* ---------- Item actions ---------- */
.totp-actions { display: flex; gap: 2px; flex-shrink: 0; }
.totp-edit:hover { color: var(--primary); background: var(--primary-soft); }
.totp-del:hover { color: var(--danger); background: rgba(239,68,68,.1); }

/* ---------- Empty state ---------- */
.totp-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.totp-empty-ic {
    width: 76px; height: 76px;
    margin: 0 auto 18px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    color: var(--primary);
    background: var(--primary-soft);
    border: 1px solid var(--border);
}
.totp-empty h3 { font-size: 1.12rem; color: var(--text); margin-bottom: 8px; }
.totp-empty p { font-size: .92rem; max-width: 360px; margin: 0 auto; }

/* ---------- Edit modal extras ---------- */
.modal-sm { max-width: 440px; }
.modal-sm .field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.modal-sm label {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
}
.modal-sm input {
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 12px 13px;
    font-size: .95rem;
    outline: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.modal-sm input:focus {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
#editSecret { font-family: var(--font-mono); }
.edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
    .totp-add-form { grid-template-columns: 1fr; }
    .totp-add-btn { width: 100%; }
    .totp-code-value { font-size: 1.45rem; }
    .totp-item { gap: 12px; padding: 14px; }
    .totp-avatar { width: 40px; height: 40px; font-size: 1rem; }
}
