/* ============================================================
   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)
============================================================ */

/* The dark, blurry background overlay */
.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; 
}

/* The white pop-up box */
.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: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}
.smtp-tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.smtp-tab:hover {
    border-color: var(--border-focus);
    background: var(--bg-page);
}
.smtp-tab.active {
    /* JavaScript overrides this inline, but good to have a fallback */
    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 inside the Pop-up */
.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 for the Pop-up */
@media (max-width: 600px) {
    .smtp-providers { grid-template-columns: repeat(2, 1fr); }
    .smtp-grid-2 { grid-template-columns: 1fr; gap: 0; }
    .modal-box { padding: 24px; }
}