/* ============================================================
   2FA Styles for Order Admin Portal
   Prefix: .tfa-* to avoid conflicts with existing Bootstrap/SB Admin styles
   ============================================================ */

/* ── WebAuthn Device List ── */
.tfa-device-list {
    margin-bottom: 0;
}

.tfa-device-list .tfa-device-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
}

.tfa-device-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: #f5f5f5;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tfa-device-info {
    flex: 1;
    min-width: 0;
}

.tfa-device-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    word-break: break-word;
}

.tfa-device-meta {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

.tfa-device-actions {
    flex-shrink: 0;
    display: flex;
    gap: 6px;
}

.tfa-transport-pill {
    display: inline-block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 1px 6px;
    margin-right: 4px;
    background: #eee;
    color: #666;
    border-radius: 10px;
    font-weight: 600;
}


/* ── OTP Input Row ── */
.tfa-otp-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 20px 0;
}

.tfa-otp-input {
    width: 48px;
    height: 56px;
    text-align: center;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 8px;
    color: #333;
    font-size: 22px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
    outline: none;
    transition: all 0.2s ease;
}

.tfa-otp-input:focus {
    border-color: #337ab7;
    box-shadow: 0 0 0 3px rgba(51, 122, 183, 0.15);
    transform: scale(1.05);
}

.tfa-otp-input.tfa-filled {
    border-color: #337ab7;
    color: #337ab7;
}

.tfa-otp-input.tfa-error {
    border-color: #d9534f;
    animation: tfa-shake 0.4s ease;
}

.tfa-otp-input.tfa-success {
    border-color: #5cb85c;
    color: #5cb85c;
}

/* ── Shake Animation ── */
@keyframes tfa-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* ── Pop-in Animation ── */
@keyframes tfa-pop-in {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ── Card Fade-in ── */
@keyframes tfa-fade-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Method Tabs ── */
.tfa-method-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 20px;
}

.tfa-method-tab {
    flex: 1;
    padding: 10px 12px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: #999;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.tfa-method-tab:hover {
    color: #555;
    background: #eee;
}

.tfa-method-tab.active {
    background: #e8f0f7;
    color: #337ab7;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
    border: 2px solid #337ab7;
    font-weight: 600;
}

.tfa-method-tab-icon {
    font-size: 18px;
}

/* ── Timer / Countdown ── */
.tfa-timer {
    font-size: 13px;
    color: #999;
    text-align: center;
    margin-top: 12px;
}

.tfa-countdown {
    font-family: 'Courier New', Courier, monospace;
    color: #337ab7;
    font-weight: 600;
}

/* ── Resend Row ── */
.tfa-resend-row {
    text-align: center;
    margin-top: 16px;
}

/* ── Success Checkmark ── */
.tfa-success-check {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #dff0d8;
    border: 2px solid #5cb85c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    margin: 0 auto 16px;
    color: #5cb85c;
    animation: tfa-pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Lock Icon (Lockout State) ── */
.tfa-lock-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #f2dede;
    border: 2px solid rgba(217, 83, 79, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 16px;
    color: #d9534f;
}

/* ── QR Container ── */
.tfa-qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 12px;
    margin: 16px 0;
}

.tfa-qr-container img {
    max-width: 200px;
    height: auto;
    border-radius: 8px;
    margin-bottom: 12px;
}

/* ── Secret Key ── */
.tfa-secret-key {
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    color: #337ab7;
    background: #f0f4f8;
    border: 1px solid #d4dde6;
    padding: 10px 16px;
    border-radius: 6px;
    letter-spacing: 0.1em;
    user-select: all;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.tfa-secret-key:hover {
    background: #e8eef4;
    border-color: #337ab7;
}

/* ── Step Indicator ── */
.tfa-steps {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
    padding: 0 20px;
}

.tfa-step-item {
    display: flex;
    align-items: center;
    flex: 1;
}

.tfa-step-item:last-child {
    flex: 0;
}

.tfa-step-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    transition: all 0.3s;
}

.tfa-step-dot.done {
    background: #5cb85c;
    color: #fff;
}

.tfa-step-dot.active {
    background: #337ab7;
    color: #fff;
}

.tfa-step-dot.pending {
    background: #f5f5f5;
    color: #999;
    border: 2px solid #ddd;
}

.tfa-step-line {
    flex: 1;
    height: 2px;
    background: #ddd;
    margin: 0 8px;
}

.tfa-step-line.done {
    background: #5cb85c;
}

/* ── Method Card (Security Settings) ── */
.tfa-method-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    background: #fff;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.tfa-method-card:hover {
    border-color: #337ab7;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.tfa-method-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    color: #555;
}

.tfa-method-card-info {
    flex: 1;
}

.tfa-method-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.tfa-method-card-desc {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

.tfa-method-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ── Status Badges ── */
.tfa-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.tfa-badge-success {
    background: #dff0d8;
    color: #3c763d;
    border: 1px solid #d6e9c6;
}

.tfa-badge-danger {
    background: #f2dede;
    color: #a94442;
    border: 1px solid #ebccd1;
}

.tfa-badge-info {
    background: #d9edf7;
    color: #31708f;
    border: 1px solid #bce8f1;
}

/* ── 2FA Panel ── */
.tfa-panel {
    animation: tfa-fade-in 0.4s ease;
}

.tfa-panel .panel-heading {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tfa-panel .panel-heading .fa {
    font-size: 18px;
}

/* ── Verify Screen ── */
.tfa-verify-panel {
    max-width: 440px;
    margin: 0 auto;
}

.tfa-verify-panel .panel-heading h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 16px;
}

.tfa-verify-subtitle {
    text-align: center;
    font-size: 13px;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* ── Email OTP Section ── */
.tfa-email-section {
    text-align: center;
    padding: 12px 0;
}

.tfa-email-section .btn {
    margin-bottom: 8px;
}

/* ── Loading State ── */
.tfa-btn-loading {
    position: relative;
    pointer-events: none;
    color: transparent !important;
}

.tfa-btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: tfa-spin 0.6s linear infinite;
}

@keyframes tfa-spin {
    to { transform: rotate(360deg); }
}

/* ── Modal Enhancements ── */
.tfa-modal .modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
}

.tfa-modal .modal-header {
    border-bottom: 1px solid #eee;
    padding: 16px 20px;
}

.tfa-modal .modal-body {
    padding: 20px;
}

.tfa-modal .modal-footer {
    border-top: 1px solid #eee;
    padding: 16px 20px;
}

/* ── Security Settings Page ── */
.tfa-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.tfa-settings-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.tfa-settings-status-row {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tfa-settings-divider {
    border-top: 1px solid #eee;
    margin: 20px 0;
}

/* ── Back Link ── */
.tfa-back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 16px;
    font-size: 13px;
    color: #337ab7;
}

.tfa-back-link:hover {
    color: #23527c;
    text-decoration: underline;
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .tfa-otp-input {
        width: 40px;
        height: 48px;
        font-size: 18px;
    }

    .tfa-otp-row {
        gap: 6px;
    }

    .tfa-method-card {
        flex-direction: column;
        text-align: center;
    }

    .tfa-method-card-actions {
        width: 100%;
        justify-content: center;
    }
}
