/* ============================================================
   MailAI.in — Mail Setup · Clean Timeline Flow
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary:      #6366f1; /* Soft purple/blue from your screenshot */
    --primary-hover:#4f46e5;
    --text-main:    #0f172a;
    --text-muted:   #64748b;
    --bg-page:      #f8fafc;
    --bg-card:      #ffffff;
    --border:       #e2e8f0;
    --border-focus: #cbd5e1;
    --radius:       12px;
    --font:         'Inter', sans-serif;
    --shadow-sm:    0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md:    0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

body {
    font-family: var(--font);
    background: var(--bg-page);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── Container & Header ── */
.setup-container {
    max-width: 720px;
    margin: 40px auto;
    padding: 0 20px;
}
.setup-header {
    text-align: center;
    margin-bottom: 40px;
}
.setup-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 8px;
}
.setup-header p {
    color: var(--text-muted);
    font-size: 1rem;
}

/* ── Timeline UI ── */
.timeline-wrap {
    position: relative;
    padding-left: 24px;
}
.timeline-wrap::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 38px;
    width: 2px;
    background: var(--border);
    z-index: 0;
}

.timeline-step {
    position: relative;
    display: flex;
    gap: 24px;
    margin-bottom: 40px;
    z-index: 1;
    opacity: 0.5; /* Dimmed by default */
    pointer-events: none; /* Disable interaction until active */
    transition: opacity 0.3s ease;
}
.timeline-step.active {
    opacity: 1;
    pointer-events: auto;
}

.step-indicator {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
    box-shadow: 0 0 0 8px var(--bg-page); /* creates gap effect over the line */
}
.timeline-step.active .step-indicator {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.step-content {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}
.step-content h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.step-content p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 24px;
}

/* ── Input Flow (Matching your screenshot) ── */
.ms-add-block {
    margin-top: 10px;
}
.ms-add-row {
    display: flex;
    gap: 12px;
    align-items: center;
}
.ms-add-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 12px;
    height: 48px;
    transition: border-color 0.2s;
}
.ms-add-input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.ms-add-input {
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    padding: 0 10px;
    font-size: 1rem;
    color: var(--text-main);
    font-family: var(--font);
}
.ms-add-input::placeholder {
    color: #94a3b8;
}
.ms-btn-add {
    height: 48px;
    padding: 0 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}
.ms-btn-add:hover {
    background: var(--primary-hover);
}
.ms-add-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 12px;
}

/* ── Secret Email Block ── */
.secret-box {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}
.secret-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}
.secret-value-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.secret-email-text {
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    word-break: break-all;
}

/* ── Buttons ── */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 600;
    cursor: pointer;
}
.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 10px 20px;
    font-weight: 500;
    cursor: pointer;
}
.btn-ghost:hover { color: var(--text-main); }
.btn-copy {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
}

/* ── Modals ── */
.ms-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000; align-items: center; justify-content: center;
    padding: 20px;
}
.ms-overlay.open { display: flex; }
.ms-modal {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 32px;
    width: 100%; max-width: 400px;
    box-shadow: var(--shadow-md);
    text-align: center;
}
.ms-modal h2 { font-size: 1.5rem; margin-bottom: 8px; }
.confirm-email-box {
    background: #f1f5f9;
    padding: 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1rem;
    margin: 24px 0;
}
.otp-input {
    width: 100%;
    padding: 16px;
    font-size: 2rem;
    letter-spacing: 0.5em;
    text-align: center;
    border: 2px solid var(--border);
    border-radius: 8px;
    margin: 24px 0 12px;
    outline: none;
}
.otp-input:focus { border-color: var(--primary); }
.otp-actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
    font-size: 0.875rem;
}
.btn-text {
    background: none; border: none; color: var(--primary);
    font-weight: 600; cursor: pointer;
}
.modal-footer {
    display: flex; gap: 12px; justify-content: center;
}
.w-100 { width: 100%; }

/* Responsive */
@media (max-width: 600px) {
    .ms-add-row { flex-direction: column; }
    .ms-btn-add { width: 100%; }
    .timeline-wrap::before { left: 15px; }
    .step-indicator { width: 30px; height: 30px; font-size: 0.8rem; box-shadow: 0 0 0 4px var(--bg-page); }
    .timeline-wrap { padding-left: 0; }
    .timeline-step { gap: 12px; }
    .step-content { padding: 16px; }
    .secret-value-row { flex-direction: column; align-items: flex-start; }
}
/* ── Bottom Linked Emails Section ── */
.bottom-linked-block {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 2px dashed var(--border);
}
.bottom-linked-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}
.bottom-linked-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}
.linked-email-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s, border-color 0.2s;
}
.linked-email-card:hover {
    border-color: var(--border-focus);
    box-shadow: var(--shadow-md);
}
.le-address {
    font-weight: 600;
    font-family: monospace;
    font-size: 1.05rem;
    color: var(--text-main);
}
.le-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #dcfce7;
    color: #15803d;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-top: 6px;
}
@media (max-width: 600px) {
    .linked-email-card { flex-direction: column; align-items: flex-start; gap: 16px; }
    .linked-email-card .btn-outline { width: 100%; text-align: center; }
}
/* ============================================================
   SMTP MODAL (Pop-up Styling)
============================================================ */
.setup-container { margin: 24px auto !important; max-width: 760px; }
.setup-header { margin-bottom: 24px !important; }
.setup-header h1 { font-size: 1.4rem !important; margin-bottom: 4px !important; }

.timeline-step { margin-bottom: 20px !important; gap: 16px !important; }
.step-content { padding: 16px !important; }
.step-content h2 { font-size: 1.1rem !important; margin-bottom: 2px !important; }
.step-content p { margin-bottom: 12px !important; font-size: 0.85rem !important; line-height: 1.4 !important; }

.linked-email-card { padding: 12px 16px !important; margin-bottom: 8px !important; }
.le-address { font-size: 0.95rem !important; }
.le-badge { font-size: 0.7rem !important; padding: 2px 8px !important; margin-top: 4px !important;}

.ms-add-input-wrap { height: 42px !important; }
.ms-btn-add { height: 42px !important; padding: 0 16px !important; font-size: 0.9rem !important; }

/* Beautiful Empty State Message */
#linkedList:empty::after {
    content: "No emails connected yet. Complete Step 1 below to add your first email!";
    display: block; padding: 24px 16px; text-align: center;
    background: #f8fafc; border: 2px dashed #cbd5e1; border-radius: 12px;
    color: #64748b; font-weight: 500; font-size: 0.9rem;
}

/* FAQ Styling */
.faq-section { margin-top: 32px; padding-top: 24px; border-top: 2px dashed var(--border); }
.faq-item { margin-bottom: 8px; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 16px; }
.faq-q { font-weight: 700; color: #0f172a; margin-bottom: 4px; font-size: 0.95rem; }
.faq-a { color: #475569; font-size: 0.85rem; line-height: 1.4; }

/* Redeem Referral Credit */
#redeemToggleBtn {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.82rem; font-weight: 700; color: #0369a1;
    background: #f0f9ff; border: 1px solid #bae6fd;
    padding: 5px 13px; border-radius: 99px; cursor: pointer;
    text-decoration: none; margin-top: 8px; transition: background 0.18s, border-color 0.18s; outline: none;
}
#redeemToggleBtn:hover { background: #e0f2fe; border-color: #7dd3fc; }
#redeemBox {
    display: none; margin-top: 12px; background: #f0fdf4; border: 1.5px solid #86efac;
    border-radius: 12px; padding: 16px 18px; animation: redeemSlide 0.22s ease;
}
#redeemBox.open { display: block; }
@keyframes redeemSlide {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.redeem-label { font-size: 0.82rem; font-weight: 700; color: #15803d; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.redeem-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#redeemInput {
    flex: 1; min-width: 140px; max-width: 220px;
    padding: 9px 14px; border-radius: 8px; border: 1.5px solid #86efac;
    font-size: 0.95rem; font-weight: 700; letter-spacing: 2px;
    text-transform: uppercase; background: #fff; color: #0f172a;
    outline: none; transition: border-color 0.18s;
}
#redeemInput:focus { border-color: #22c55e; }
#redeemInput::placeholder { letter-spacing: 0; font-weight: 400; color: #94a3b8; text-transform: none; }
#redeemSubmitBtn {
    padding: 9px 20px; background: #16a34a; color: #fff; border: none; border-radius: 8px; font-weight: 700;
    font-size: 0.88rem; cursor: pointer; transition: background 0.18s; white-space: nowrap;
}
#redeemSubmitBtn:hover:not(:disabled) { background: #15803d; }
#redeemSubmitBtn:disabled { opacity: 0.6; cursor: default; }
#redeemMsg { margin-top: 10px; font-size: 0.83rem; font-weight: 600; padding: 8px 12px; border-radius: 7px; display: none; }
#redeemMsg.ok  { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
#redeemMsg.err { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }

/* ============================================================
   SMTP MODAL (Pop-up Styling)
============================================================ */
.modal-bg {
    display: none; position: fixed; inset: 0; z-index: 1050;
    background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px);
    align-items: center; justify-content: center; padding: 20px;
}
.modal-bg.open { display: flex; }
.modal-box {
    background: var(--bg-card); width: 100%; border-radius: 16px;
    box-shadow: var(--shadow-md); padding: 32px; text-align: left;
}
.modal-scrollable { max-height: 90vh; overflow-y: auto; }
.modal-box h2 { font-size: 1.5rem; margin-bottom: 4px; }
.modal-sub { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 24px; }

/* Provider Selection Buttons (Grid) */
.smtp-providers { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.smtp-tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 16px 12px;
    cursor: pointer; transition: all 0.2s; text-align: center;
}
.smtp-tab:hover { border-color: var(--border-focus); background: var(--bg-page); }
.smtp-tab.active { border-color: var(--primary); background: #eef2ff; }
.smtp-tab-icon { font-size: 1.5rem; margin-bottom: 4px; }
.smtp-tab-name { font-weight: 600; font-size: 0.85rem; color: var(--text-main); }
.smtp-tab-sub { font-size: 0.7rem; color: var(--text-muted); }

/* Help Instructions Box */
.smtp-help {
    display: none; background: var(--bg-page); border: 1px dashed var(--border-focus);
    border-radius: 8px; padding: 16px; font-size: 0.85rem; color: var(--text-main); margin-bottom: 24px;
}
.smtp-help.active { display: block; }
.smtp-help ol { margin-left: 20px; margin-top: 8px; }
.smtp-help li { margin-bottom: 6px; }
.smtp-help a { color: var(--primary); text-decoration: underline; }

/* Form Fields */
.smtp-field-panel { display: none; }
.smtp-field-panel.active { display: block; margin-bottom: 16px;}
.ms-field { margin-bottom: 16px; text-align: left; }
.ms-label { display: block; font-weight: 600; font-size: 0.875rem; margin-bottom: 6px; color: var(--text-main); }
.ms-label-note { font-weight: 400; color: var(--text-muted); font-size: 0.75rem; }
.req { color: #dc2626; }
.ms-input {
    width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 1rem; font-family: var(--font); color: var(--text-main);
    outline: none; transition: border-color 0.2s;
}
.ms-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15); }
.ms-input[readonly] { background: var(--bg-page); color: var(--text-muted); }
.ms-input-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; }
.smtp-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Mobile Adjustments */
@media (max-width: 600px) {
    .smtp-providers { grid-template-columns: 1fr; gap: 12px; }
    .smtp-grid-2 { grid-template-columns: 1fr; gap: 0; }
    .modal-box { padding: 20px; }
    .smtp-tab { padding: 12px; flex-direction: row; gap: 12px; text-align: left; justify-content: flex-start; }
    .smtp-tab-icon { margin-bottom: 0; font-size: 1.8rem; }
}