/* ═══════════════════════════════════════════
   INBOX PAGE — Redesign
═══════════════════════════════════════════ */

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

body {
    font-family: var(--font-family);
    background: #f1f5f9;
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

/* ── Alert container ── */
.inbox-alert-container {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    width: 100%;
    max-width: 560px;
    padding: 0 16px;
    pointer-events: none;
}

.inbox-alert-container .alert {
    pointer-events: all;
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-md);
    animation: fadeUp 0.3s ease;
}

.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-error   { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.alert-info    { background: #e0f2fe; color: #0369a1; border: 1px solid #7dd3fc; }

/* ── Tab Bar ── */
.inbox-tab-bar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
}

.inbox-tab-bar-inner {
    max-width: 860px;
    margin: 0 auto;
    display: flex;
    gap: 4px;
    padding: 12px 0 0;
}

.inbox-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 18px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-muted);
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
    position: relative;
    bottom: -1px;
}

.inbox-tab:hover {
    color: var(--text-primary);
    background: #e8edf3;
}

.inbox-tab.active {
    background: #fff;
    color: var(--text-primary);
    font-weight: 600;
    border-color: var(--border);
    border-bottom-color: #fff;
    z-index: 1;
}

.inbox-tab .badge {
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 99px;
    line-height: 1.4;
}

/* ── Page Content ── */
.inbox-content {
    max-width: 860px;
    margin: 0 auto;
    padding: 24px 24px 40px;
    animation: fadeUp 0.35s ease;
}

/* ── Panel ── */
.inbox-panel {
    width: 100%;
}

/* ── Card ── */
.inbox-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px 32px;
    box-shadow: var(--shadow-sm);
}

.inbox-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
}

/* ── Field Group ── */
.inbox-field-group {
    margin-bottom: 18px;
}

.inbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.inbox-label-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3b82f6;
    flex-shrink: 0;
}

.inbox-textarea,
.inbox-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: #f9fafb;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    box-sizing: border-box;
}

.inbox-textarea {
    min-height: 96px;
    resize: vertical;
    line-height: 1.6;
}

.inbox-textarea:focus,
.inbox-input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.inbox-hint {
    display: block;
    margin-top: 7px;
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ── Indicator ── */
.inbox-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    font-size: 13.5px;
    color: #1d4ed8;
    margin-bottom: 16px;
}

/* ── Check Inbox Button ── */
.btn-inbox-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    background: #f59e0b;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.30);
}

.btn-inbox-check:hover:not(:disabled) {
    background: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.38);
}

.btn-inbox-check:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ── Refresh Button ── */
.btn-inbox-refresh {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 13.5px;
    font-weight: 600;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.btn-inbox-refresh:hover:not(:disabled) {
    background: #fecaca;
}

/* ── Email Count Bar ── */
.inbox-count-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    font-size: 13.5px;
    color: #166534;
    margin: 14px 0;
}

/* ── Email List (messages) ── */
.email-list {
    margin-top: 20px;
}

.email-item {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
    animation: fadeUp 0.4s ease forwards;
    opacity: 0;
}

.email-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--primary);
}

.email-header {
    padding: 18px 22px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

.email-subject {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 12px;
    line-height: 1.4;
}

.email-from-section {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.email-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.email-from-details { flex: 1; min-width: 0; }

.email-from-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.email-from-address {
    font-size: 12.5px;
    color: var(--text-muted);
    word-break: break-all;
}

.email-date {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    padding: 4px 10px;
    background: var(--border-soft);
    border-radius: 6px;
    font-weight: 600;
    margin-left: auto;
}

.email-body-wrapper {
    padding: 22px;
    background: #fff;
}

.email-content {
    font-size: 14.5px;
    line-height: 1.9;
    color: var(--text-primary);
    word-wrap: break-word;
}

.email-content a { color: #1a73e8; text-decoration: none; font-weight: 600; }
.email-content a:hover { text-decoration: underline; }

.email-content img {
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
    margin: 16px auto !important;
    border-radius: 8px;
}

/* ── Multi-inbox tabs (email sub-tabs) ── */
.multi-inbox-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.inbox-tab-inner {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
}

.inbox-tab-inner:hover { background: #e2e8f0; color: var(--text-primary); }
.inbox-tab-inner.active {
    background: #eef2ff;
    color: var(--primary-dark);
    border-color: var(--primary);
    font-weight: 600;
}

/* ── Purchase List ── */
.purchase-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.purchase-email-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.purchase-email-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.purchase-email-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.purchase-email-details { flex: 1; min-width: 180px; }

.purchase-email-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.purchase-email-price {
    color: var(--primary);
    font-weight: 700;
    font-size: 16px;
}

/* ── Pagination ── */
.inbox-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 24px;
}

.pagination-info {
    padding: 8px 16px;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--primary);
    font-weight: 600;
    font-size: 13.5px;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, transform 0.15s;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.pagination-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

/* ── Loading ── */
.inbox-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 30px 0;
    color: var(--text-muted);
    font-size: 14px;
}

.inbox-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.loading-container {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px 24px;
    margin: 16px 0;
}

.loading-steps { list-style: none; padding: 0; margin: 0; }

.loading-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13.5px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.loading-step:last-child { border-bottom: none; }
.loading-step.active { opacity: 1; color: var(--primary); font-weight: 600; }
.loading-step.completed { opacity: 1; color: #16a34a; }
.loading-step.error { opacity: 1; color: #dc2626; }

.loading-step-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    border-radius: 50%;
}

.loading-step.active .loading-step-icon { background: var(--primary); color: #fff; }
.loading-step.completed .loading-step-icon { background: #16a34a; color: #fff; }
.loading-step.error .loading-step-icon { background: #dc2626; color: #fff; }

.loading-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ── Empty ── */
.inbox-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
    font-style: italic;
}

/* ── Stats bar ── */
.stats-bar {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13.5px;
}

/* ── Footer ── */
.inbox-footer {
    background: #fff;
    border-top: 1px solid var(--border);
    padding: 20px 24px;
    text-align: center;
}

.inbox-footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-bottom: 10px;
}

.inbox-footer-links a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.inbox-footer-links a:hover { color: var(--text-primary); }

.inbox-footer-copy {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

/* ── Utility ── */
.hidden { display: none !important; }

/* ── OTP display ── */
.otp-value,
.otp-code,
.email-otp {
    font-family: 'Courier New', monospace;
    font-size: clamp(20px, 3.5vw, 28px);
    font-weight: 800;
    letter-spacing: 0.1em;
    color: var(--primary-dark);
}

/* ── Copy button ── */
.copy-btn,
.btn-copy {
    border-radius: 8px;
    transition: background 0.15s, color 0.15s, transform 0.15s;
}

.copy-btn:hover,
.btn-copy:hover {
    background: var(--primary) !important;
    color: #fff !important;
    transform: translateY(-1px);
}

/* ── Dropdown ── */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    z-index: 10000;
    overflow: hidden;
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 13.5px;
    transition: background 0.12s;
    border-bottom: 1px solid #f1f5f9;
}

.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: #f8fafc; }

.dropdown-info-item {
    padding: 12px 18px;
    color: var(--text-primary);
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
}

.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .inbox-content { padding: 16px 16px 32px; }
    .inbox-card { padding: 20px 18px; }
    .inbox-tab-bar { padding: 0 16px; }
    .inbox-tab { padding: 9px 13px; font-size: 13px; }
    .inbox-footer-links { gap: 14px; }

    .email-from-section { flex-wrap: wrap; }
    .email-date { margin-top: 4px; }
}

@media (max-width: 480px) {
    .inbox-tab span[data-i18n] { display: none; }
    .inbox-tab svg { width: 17px; height: 17px; }
    .inbox-tab { padding: 9px 14px; }
    .inbox-card { padding: 16px 14px; }
}
