/* ============================================
   MailVault — Outlook-Inspired Premium Design
   ============================================ */

/* === Design Tokens === */
:root {
    --blue: #0f6cbd;
    --blue-hover: #115ea3;
    --blue-pressed: #0c5a9e;
    --blue-light: #e8f2fc;
    --blue-subtle: #d0e5f5;
    --blue-glow: rgba(15, 108, 189, 0.08);

    --bg-page: #f5f5f5;
    --bg-surface: #ffffff;
    --bg-surface-alt: #fafafa;
    --bg-input: #ffffff;
    --bg-header: #0f6cbd;

    --text-1: #242424;
    --text-2: #616161;
    --text-3: #919191;
    --text-on-brand: #ffffff;

    --green: #107c10;
    --red: #d13438;
    --orange: #ca5010;
    --yellow: #ffd335;

    --border: #e0e0e0;
    --border-strong: #d1d1d1;
    --border-subtle: #f0f0f0;

    --shadow-2: 0 1px 2px rgba(0, 0, 0, .07);
    --shadow-4: 0 2px 4px rgba(0, 0, 0, .07), 0 0 2px rgba(0, 0, 0, .04);
    --shadow-8: 0 4px 8px rgba(0, 0, 0, .08), 0 0 2px rgba(0, 0, 0, .04);
    --shadow-16: 0 8px 16px rgba(0, 0, 0, .1), 0 0 2px rgba(0, 0, 0, .05);
    --shadow-28: 0 14px 28px rgba(0, 0, 0, .12), 0 0 2px rgba(0, 0, 0, .05);

    --font: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono: 'JetBrains Mono', 'Cascadia Code', monospace;
    --radius: 8px;
    --radius-lg: 12px;
    --ease: cubic-bezier(0.33, 0, 0.67, 1);
    --ease-out: cubic-bezier(0.1, 0.9, 0.2, 1);
}

/* === Dark Theme === */
[data-theme="dark"] {
    --bg-page: #1b1b1b;
    --bg-surface: #292929;
    --bg-surface-alt: #242424;
    --bg-input: #333333;
    --text-1: #f5f5f5;
    --text-2: #b0b0b0;
    --text-3: #777;
    --border: #3d3d3d;
    --border-strong: #505050;
    --border-subtle: #333;
    --blue-light: rgba(90, 178, 255, .1);
    --blue-subtle: rgba(90, 178, 255, .15);
    --blue-glow: rgba(90, 178, 255, .06);
    --shadow-2: 0 1px 2px rgba(0, 0, 0, .2);
    --shadow-4: 0 2px 4px rgba(0, 0, 0, .2), 0 0 2px rgba(0, 0, 0, .15);
    --shadow-8: 0 4px 8px rgba(0, 0, 0, .25), 0 0 2px rgba(0, 0, 0, .15);
    --shadow-16: 0 8px 16px rgba(0, 0, 0, .3), 0 0 2px rgba(0, 0, 0, .15);
    --shadow-28: 0 14px 28px rgba(0, 0, 0, .35), 0 0 2px rgba(0, 0, 0, .15);
}

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

html {
    font-size: 14px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font);
    background: var(--bg-page);
    color: var(--text-1);
    min-height: 100vh;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    transition: background .3s, color .3s;
}

/* === Header === */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-header);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
}

.header-inner {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 20px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 9px;
}

.logo-icon {
    display: flex;
    align-items: center;
    opacity: .9;
}

.logo-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-on-brand);
    letter-spacing: -.2px;
}

.logo-accent {
    font-weight: 700;
    opacity: .88;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-toggle {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .12);
    border: none;
    border-radius: 6px;
    color: rgba(255, 255, 255, .85);
    cursor: pointer;
    transition: background .15s;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, .22);
    color: #fff;
}

.theme-icon {
    display: flex;
    align-items: center;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 100px;
    font-size: .75rem;
    font-weight: 500;
    color: rgba(255, 255, 255, .88);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6ccb5f;
}

/* === Input Section === */
.input-section {
    max-width: 520px;
    margin: 0 auto;
}

.hero-section {
    text-align: center;
    padding: 36px 0 20px;
}

.hero-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    background: var(--bg-surface);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-4);
}

[data-theme="dark"] .hero-icon svg rect {
    fill: rgba(90, 178, 255, .12);
    stroke: #5ab2ff;
}

[data-theme="dark"] .hero-icon svg path {
    stroke: #5ab2ff;
}

[data-theme="dark"] .hero-icon svg circle {
    fill: #5ab2ff;
}

.hero-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -.3px;
    margin-bottom: 4px;
}

.hero-subtitle {
    font-size: .92rem;
    color: var(--text-3);
}

/* Input Card */
.input-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-4);
}

.mode-selector {
    margin-bottom: 16px;
}

.mode-options {
    display: flex;
    gap: 0;
    background: var(--bg-page);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.mode-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-2);
    font-family: var(--font);
    font-size: .88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .12s;
}

.mode-btn:hover {
    background: var(--bg-surface);
    color: var(--text-1);
}

.mode-btn.active {
    background: var(--bg-surface);
    color: var(--blue);
    box-shadow: var(--shadow-2);
    font-weight: 600;
    position: relative;
    z-index: 1;
}

[data-theme="dark"] .mode-btn.active {
    color: #5ab2ff;
}

.input-group {
    margin-bottom: 16px;
}

.input-label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-1);
    margin-bottom: 6px;
}

.textarea-wrapper {
    position: relative;
}

.credential-textarea {
    width: 100%;
    min-height: 160px;
    padding: 14px 40px 14px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-1);
    font-family: var(--mono);
    font-size: .85rem;
    line-height: 1.7;
    resize: vertical;
    outline: none;
    transition: border .12s, box-shadow .12s;
}

.credential-textarea::placeholder {
    color: var(--text-3);
}

.credential-textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 1px var(--blue);
}

.textarea-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.icon-btn {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-3);
    cursor: pointer;
    transition: all .1s;
}

.icon-btn:hover {
    background: var(--blue-light);
    color: var(--blue);
}

[data-theme="dark"] .icon-btn:hover {
    background: rgba(90, 178, 255, .12);
    color: #5ab2ff;
}

.input-hint {
    margin-top: 6px;
    font-size: .78rem;
    color: var(--text-3);
}

.input-hint code {
    font-family: var(--mono);
    font-size: .74rem;
    background: var(--blue-light);
    padding: 1px 5px;
    border-radius: 3px;
    color: var(--blue);
}

[data-theme="dark"] .input-hint code {
    color: #5ab2ff;
}

/* Read Button */
.read-btn {
    width: 100%;
    padding: 11px 20px;
    background: var(--blue);
    border: none;
    border-radius: var(--radius);
    color: #fff;
    font-family: var(--font);
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-2);
    transition: background .12s, box-shadow .12s;
}

.read-btn:hover {
    background: var(--blue-hover);
    box-shadow: var(--shadow-4);
}

.read-btn:active {
    background: var(--blue-pressed);
}

.read-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.btn-content,
.btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

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

/* === Results Section === */
.results-section {
    max-width: 720px;
    margin: 0 auto;
    animation: fadeUp .3s var(--ease-out);
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Account Bar */
.account-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    margin: 16px 0 2px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: var(--shadow-2);
}

.account-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.account-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .82rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.account-details {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.account-email {
    font-size: .88rem;
    font-weight: 600;
    color: var(--text-1);
}

.account-stats {
    font-size: .75rem;
    color: var(--text-3);
}

.account-actions {
    display: flex;
    gap: 6px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    font-family: var(--font);
    font-size: .78rem;
    font-weight: 500;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-2);
    cursor: pointer;
    transition: all .12s;
}

.action-btn:hover {
    background: var(--blue-light);
    color: var(--blue);
    border-color: var(--blue-subtle);
}

.action-btn-danger:hover {
    background: rgba(209, 52, 56, .06);
    color: var(--red);
    border-color: rgba(209, 52, 56, .2);
}

.action-btn.spinning svg {
    animation: spin .6s linear infinite;
}

[data-theme="dark"] .action-btn:hover {
    background: rgba(90, 178, 255, .1);
    color: #5ab2ff;
}

/* === Email List === */
.email-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.email-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 18px;
    cursor: pointer;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    transition: background .1s, box-shadow .15s;
    animation: emailIn .2s ease both;
    position: relative;
}

@keyframes emailIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.email-card:hover {
    background: var(--blue-glow);
    box-shadow: var(--shadow-4);
}

.email-card.unread {
    background: var(--blue-light);
    border-color: var(--blue-subtle);
}

.email-card.unread:hover {
    background: var(--blue-subtle);
}

/* Avatar */
.email-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    margin-top: 2px;
    letter-spacing: .3px;
}

/* Content Rows */
.email-content {
    flex: 1;
    min-width: 0;
}

.email-row-1 {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 1px;
}

.email-from {
    font-size: .88rem;
    font-weight: 400;
    color: var(--text-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unread .email-from {
    font-weight: 700;
}

.email-date {
    font-size: .75rem;
    color: var(--text-3);
    white-space: nowrap;
    flex-shrink: 0;
}

.unread .email-date {
    color: var(--blue);
    font-weight: 600;
}

[data-theme="dark"] .unread .email-date {
    color: #5ab2ff;
}

.email-row-2 {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.email-subject {
    font-size: .85rem;
    font-weight: 400;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unread .email-subject {
    font-weight: 600;
    color: var(--text-1);
}

.email-badges-inline {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.email-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.badge-attachment {
    color: var(--text-3);
}

.badge-important {
    font-size: .65rem;
    font-weight: 800;
    color: var(--red);
    background: rgba(209, 52, 56, .08);
    border-radius: 50%;
}

.email-row-3 {
    font-size: .82rem;
    color: var(--text-3);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, .35);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn .15s;
}

[data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, .55);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.email-modal {
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-28);
    animation: modalIn .25s var(--ease-out);
    overflow: hidden;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-top-bar {
    display: flex;
    justify-content: flex-end;
    padding: 10px 14px 0;
}

.modal-close-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-3);
    cursor: pointer;
    transition: all .1s;
}

.modal-close-btn:hover {
    background: rgba(209, 52, 56, .08);
    color: var(--red);
}

.modal-header {
    padding: 4px 20px 14px;
}

.modal-subject {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1.3;
}

.modal-meta {
    padding: 12px 20px;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

.modal-sender {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .82rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.modal-sender-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.modal-sender-name {
    font-size: .88rem;
    font-weight: 600;
    color: var(--text-1);
}

.modal-sender-date {
    font-size: .78rem;
    color: var(--text-3);
}

.modal-body {
    padding: 18px 20px;
    overflow-y: auto;
    flex: 1;
    font-size: .92rem;
    line-height: 1.65;
    color: var(--text-2);
}

.modal-body img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.modal-body a {
    color: var(--blue);
    text-decoration: none;
}

.modal-body a:hover {
    text-decoration: underline;
}

[data-theme="dark"] .modal-body a {
    color: #5ab2ff;
}

/* === Main Content === */
.main-content {
    flex: 1;
}

/* === Footer === */
.footer {
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
    margin-top: auto;
}

.footer-inner {
    max-width: 720px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: .75rem;
    color: var(--text-3);
}

.footer-links a {
    color: var(--text-2);
    text-decoration: none;
    font-size: .75rem;
}

.footer-links a:hover {
    color: var(--blue);
}

/* === Toast === */
.toast-container {
    position: fixed;
    top: 56px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    min-width: 240px;
    max-width: 380px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-16);
    font-size: .85rem;
    color: var(--text-1);
    animation: toastIn .25s var(--ease-out);
}

.toast.toast-exit {
    animation: toastOut .2s ease forwards;
}

.toast-error {
    border-left: 3px solid var(--red);
}

.toast-error .toast-icon {
    color: var(--red);
}

.toast-success {
    border-left: 3px solid var(--green);
}

.toast-success .toast-icon {
    color: var(--green);
}

.toast-icon {
    flex-shrink: 0;
    display: flex;
}

.toast-message {
    flex: 1;
    line-height: 1.35;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-3);
}

.empty-state-icon {
    margin-bottom: 12px;
    opacity: .4;
}

.empty-state-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 4px;
}

.empty-state-text {
    font-size: .88rem;
}

/* === Responsive === */
@media (max-width: 640px) {
    html {
        font-size: 13px;
    }

    .header-inner {
        padding: 0 14px;
    }

    .input-section,
    .results-section {
        margin: 0 8px;
    }

    .input-card {
        padding: 16px;
    }

    .account-bar {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .account-actions {
        justify-content: flex-end;
    }

    .email-card {
        padding: 10px 14px;
        gap: 10px;
    }

    .email-avatar {
        width: 32px;
        height: 32px;
        font-size: .7rem;
    }

    .modal-overlay {
        padding: 8px;
    }

    .email-modal {
        max-height: 95vh;
    }

    .toast-container {
        right: 8px;
        left: 8px;
    }

    .toast {
        min-width: auto;
    }

    .footer-inner {
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }

/* শুধু টেক্সটের ওপর চমৎকার গ্রেডিয়েন্ট ইফেক্ট */
.logo-text, 
.hero-title, 
.btn-content,
.custom-guide-title,
.custom-guide-steps strong {
    background: linear-gradient(135deg, #ff007f 0%, #ff5e00 25%, #ffcc00 50%, #00ff66 75%, #0099ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
    font-weight: 800 !important;
    display: inline-block;
}

/* ইমোজিগুলোকে আসল কালারে ফিরিয়ে আনার ম্যাজিক */
.logo-text span, 
.hero-title span, 
.btn-content span {
    background: none !important;
    -webkit-text-fill-color: initial !important;
    text-fill-color: initial !important;
    display: inline-block;
}

/* বাটন স্টাইল */
.read-btn {
    background: #111214 !important;
    border: 2px solid #ff007f !important;
    transition: all 0.3s ease;
}

.read-btn:hover {
    border-color: #0099ff !important;
    box-shadow: 0 0 15px rgba(0, 153, 255, 0.4);
}