/* === Temp Email — Design System === */
:root {
    --brand:        #14588F;
    --brand-dark:   #0d4a73;
    --brand-light:  #e8f2fb;
    --success:      #059669;
    --success-bg:   #d1fae5;
    --danger:       #dc2626;
    --danger-bg:    #fee2e2;
    --bg:           #f1f5f9;
    --surface:      #ffffff;
    --border:       #e2e8f0;
    --border-md:    #cbd5e1;
    --text:         #1e293b;
    --text-muted:   #64748b;
    --text-faint:   #94a3b8;
    --radius:       14px;
    --radius-sm:    8px;
    --shadow:       0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
    --shadow-md:    0 4px 16px rgba(0,0,0,.09), 0 2px 4px rgba(0,0,0,.05);
    --shadow-lg:    0 10px 40px rgba(0,0,0,.14), 0 4px 12px rgba(0,0,0,.08);
}

/* ===== Page wrapper ===== */
.te-page {
    background: var(--bg);
    min-height: calc(100vh - 5.5rem);
    padding: 1.5rem 0 4rem;
}

/* ===== Cards ===== */
.te-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

/* ===== Page hero ===== */
.te-hero {
    text-align: center;
    padding: .5rem 0 1.5rem;
}
.te-hero h1 {
    color: var(--brand);
    font-size: 2.88rem;
    font-weight: 700;
    margin-bottom: .4rem;
}
.te-hero p {
    color: var(--text-muted);
    font-size: 1.26rem;
    margin: 0;
}

/* ===== Console card header ===== */
.te-console-head {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .9rem 1.25rem;
    background: var(--brand);
    color: #fff;
}
.te-console-head h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}
.te-status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #4ade80;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(74,222,128,.3);
    animation: te-pulse 2.2s ease-in-out infinite;
}
@keyframes te-pulse {
    0%,100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.3); opacity: .7; }
}

/* ===== Console card body ===== */
.te-console-body {
    padding: 1.25rem 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .85rem;
}

/* Address field */
.te-address-label {
    font-size: .96rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-bottom: .35rem;
}
.te-address-row {
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border-md);
    border-radius: var(--radius-sm);
    padding: .3rem .3rem .3rem .75rem;
    gap: .4rem;
    flex-wrap: wrap;
}
.te-address-row:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(20,88,143,.12);
}
#current-email {
    flex: 1 1 200px;
    border: 0;
    background: transparent;
    font-size: 1.26rem;
    font-weight: 700;
    color: var(--text);
    outline: none;
    min-width: 0;
    padding: .4rem 0;
    cursor: default;
    user-select: all;
}
.te-address-btns {
    display: flex;
    gap: .35rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* Meta bar */
.te-meta-bar {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    font-size: 1.06rem;
    color: var(--text-muted);
    min-height: 1.5rem;
}
.te-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .2rem .55rem;
    border-radius: 99px;
    font-size: .98rem;
    font-weight: 600;
}
.te-badge-active {
    background: var(--success-bg);
    color: var(--success);
}
.te-meta-sep { opacity: .5; }
.te-meta-item { color: var(--text-muted); }

/* Alerts */
.te-alerts { display: flex; flex-direction: column; gap: .4rem; }
.te-alert {
    display: inline-block;
    padding: .5rem .8rem;
    border-radius: var(--radius-sm);
    font-size: 1.08rem;
    font-weight: 600;
}
.te-alert-success { background: var(--success-bg); color: var(--success); }
.te-alert-danger  { background: var(--danger-bg);  color: var(--danger);  }

/* Customizer */
.te-customizer {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fafbfc;
}
.te-customizer > summary {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .65rem .9rem;
    cursor: pointer;
    list-style: none;
    font-size: 1.08rem;
    font-weight: 600;
    color: var(--brand);
    user-select: none;
}
.te-customizer > summary::-webkit-details-marker { display: none; }
.te-chev {
    display: inline-block;
    transition: transform .18s ease;
    font-size: .96rem;
}
.te-customizer[open] .te-chev { transform: rotate(90deg); }
.te-customizer-body {
    padding: 1rem .9rem .9rem;
    border-top: 1px solid var(--border);
}
.te-custom-fields {
    display: flex;
    align-items: flex-end;
    gap: .6rem;
    flex-wrap: wrap;
}
.te-custom-fields .te-field {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}
.te-custom-fields label {
    font-size: .98rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0;
}
.te-custom-fields input,
.te-custom-fields select {
    height: 2.8rem;
    padding: 0 .75rem;
    border: 1px solid var(--border-md);
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    background: var(--surface);
    color: var(--text);
    margin: 0;
    width: auto;
}
.te-custom-fields input:focus,
.te-custom-fields select:focus {
    border-color: var(--brand);
    outline: none;
    box-shadow: 0 0 0 2px rgba(20,88,143,.12);
}
.te-at-sep {
    font-size: 1.44rem;
    font-weight: 700;
    color: var(--text-muted);
    padding-bottom: .15rem;
    align-self: flex-end;
}
.te-field-name   { flex: 1 1 130px; }
.te-field-domain { flex: 1 1 170px; }

/* Loading */
.te-loading {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: var(--text-muted);
    font-size: 1.08rem;
}

/* ===== Buttons ===== */
.te-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: .55rem .95rem;
    font-size: 1.08rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: background .14s ease, border-color .14s ease, transform .06s ease, opacity .14s ease;
    line-height: 1;
    height: 2.6rem;
}
.te-btn:active  { transform: translateY(1px); }
.te-btn:disabled{ opacity: .55; cursor: not-allowed; transform: none; }

.te-btn-ghost {
    background: var(--surface);
    border-color: var(--border-md);
    color: var(--text);
}
.te-btn-ghost:hover:not(:disabled) { background: var(--bg); }

.te-btn-primary {
    background: var(--brand);
    color: #fff;
}
.te-btn-primary:hover:not(:disabled) { background: var(--brand-dark); }

.te-btn-sm {
    padding: .4rem .8rem;
    font-size: .98rem;
    height: 2.2rem;
}

/* Spinner */
.te-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-md);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: te-spin 1s linear infinite;
    display: none;
    flex-shrink: 0;
}
.te-spinner-lg {
    width: 18px;
    height: 18px;
    border: 3px solid var(--border-md);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: te-spin 1s linear infinite;
    display: inline-block;
}
@keyframes te-spin { to { transform: rotate(360deg); } }

/* ===== Inbox card ===== */
.te-inbox-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.te-inbox-title {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.te-inbox-title h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: .45rem;
}
.te-count-pill {
    background: var(--brand);
    color: #fff;
    font-size: .9rem;
    font-weight: 700;
    border-radius: 99px;
    padding: .1rem .45rem;
    min-width: 1.4rem;
    text-align: center;
    line-height: 1.5;
}
.te-inbox-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* Timer */
.te-timer {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: 1.02rem;
    color: var(--text-muted);
}
.te-timer-dot {
    width: 7px;
    height: 7px;
    background: var(--brand);
    border-radius: 50%;
    animation: te-pulse 1.6s ease-in-out infinite;
}

/* Empty state */
.te-empty {
    padding: 3.5rem 2rem;
    text-align: center;
    color: var(--text-muted);
}
.te-empty-icon  { font-size: 3.6rem; margin-bottom: .75rem; line-height: 1; }
.te-empty-title { font-size: 1.26rem; font-weight: 600; margin: 0 0 .4rem; color: var(--text); }
.te-empty-sub   { font-size: 1.08rem; margin: 0; }

/* ===== Messages table ===== */
.te-messages-table {
    width: 100%;
    border-collapse: collapse;
}
.te-messages-table thead th {
    background: #f8fafc;
    color: var(--text-muted);
    font-size: .96rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: .65rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.te-messages-table tbody tr {
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background .12s ease;
}
.te-messages-table tbody tr:last-child { border-bottom: 0; }
.te-messages-table tbody tr:hover { background: var(--brand-light); }
.te-messages-table td {
    padding: .9rem 1rem;
    vertical-align: middle;
    font-size: 1.1rem;
}
.te-td-from {
    width: 25%;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}
.te-td-subject { color: var(--text); }
.te-subject-text {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 340px;
}
.te-td-date {
    width: 25%;
    color: var(--text-muted);
    font-size: 1.02rem;
    white-space: nowrap;
}
.te-td-action {
    width: 90px;
    text-align: right;
    white-space: nowrap;
}
.te-view-btn {
    background: var(--brand-light);
    color: var(--brand);
    border: 1px solid rgba(20,88,143,.2);
    padding: .35rem .85rem;
    border-radius: 6px;
    font-size: .98rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .14s ease;
    white-space: nowrap;
}
.te-view-btn:hover { background: var(--brand); color: #fff; }

/* ===== Ad slots ===== */
.te-ad-slot  { width: 100%; }
.te-ad-top   { min-height: 280px; margin-bottom: 1.5rem; }
.te-ad-bottom{ min-height: 200px; padding: .75rem; border-top: 1px solid var(--border); }
@media (max-width: 640px) {
    .te-ad-top, .te-ad-bottom { min-height: 160px; }
}

/* ===== Features grid ===== */
.te-features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: .5rem;
}
.te-feature {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1rem;
    text-align: center;
    box-shadow: var(--shadow);
}
.te-feature-icon { font-size: 2.16rem; margin-bottom: .6rem; }
.te-feature h3   { margin: 0 0 .35rem; font-size: 1.14rem; font-weight: 700; color: var(--text); }
.te-feature p    { margin: 0; font-size: 1.02rem; color: var(--text-muted); }

/* ===== Modal ===== */
.te-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15,23,42,.55);
    backdrop-filter: blur(3px);
}
.te-modal-dialog {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 860px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.te-modal-header {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
    flex-shrink: 0;
}
.te-modal-subject {
    flex: 1;
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.4;
    word-break: break-word;
}
.te-modal-close {
    background: none;
    border: 0;
    font-size: 1.68rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: .1rem .3rem;
    flex-shrink: 0;
    border-radius: 4px;
    transition: color .12s ease, background .12s ease;
}
.te-modal-close:hover { color: var(--text); background: var(--border); }
.te-modal-meta {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    padding: .65rem 1.25rem;
    font-size: 1.06rem;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
    color: var(--text-muted);
    flex-shrink: 0;
}
.te-modal-body {
    flex: 1;
    overflow: auto;
    padding: 0;
}
.te-email-content {
    width: 100%;
    min-height: 300px;
}
.te-email-content iframe {
    width: 100%;
    border: 0;
    display: block;
    min-height: 360px;
}
.te-email-plaintext {
    margin: 0;
    padding: 1.25rem;
    font-family: inherit;
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--surface);
    border: 0;
    overflow-x: auto;
}

/* ===== Mobile ===== */
@media (max-width: 640px) {

    /* Address buttons — stack vertically, full width, icon + label always visible */
    .te-address-row {
        flex-direction: column;
        align-items: stretch;
        padding: .5rem;
    }
    #current-email {
        font-size: 1.1rem;
        padding: .5rem .25rem;
        text-align: center;
        flex: 1 1 auto;
    }
    .te-address-btns {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: .4rem;
        width: 100%;
    }
    .te-address-btns .te-btn {
        width: 100%;
        height: 2.8rem;
        font-size: 1rem;
        flex-direction: column;
        gap: .2rem;
        padding: .3rem .4rem;
    }
    .te-address-btns .te-btn-label { display: block; font-size: .9rem; }
    .te-address-btns .te-btn-icon  { font-size: 1.2rem; line-height: 1; }

    /* Messages table → cards */
    .te-messages-table { display: block; }
    .te-messages-table thead { display: none; }
    .te-messages-table tbody {
        display: flex;
        flex-direction: column;
        gap: .75rem;
        padding: .75rem;
    }
    .te-messages-table tbody tr {
        display: flex;
        flex-direction: column;
        gap: .3rem;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        padding: .9rem 1rem;
        cursor: pointer;
        box-shadow: var(--shadow);
    }
    .te-messages-table tbody tr:hover { background: var(--brand-light); border-color: rgba(20,88,143,.25); }
    .te-messages-table td {
        display: block;
        padding: 0;
        max-width: none;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        border: 0;
        font-size: 1.1rem;
    }
    .te-td-from    { font-size: .98rem; color: var(--brand); }
    .te-td-subject { font-size: 1.14rem; font-weight: 600; color: var(--text); }
    .te-subject-text { white-space: normal; overflow: visible; max-width: none; }
    .te-td-date    { font-size: .96rem; color: var(--text-faint); }
    .te-td-action  { text-align: left; }
    .te-view-btn   { width: 100%; text-align: center; padding: .5rem; margin-top: .3rem; font-size: 1.08rem; }

    .te-features { grid-template-columns: repeat(2, 1fr); }
    .te-modal { padding: 0; align-items: flex-end; }
    .te-modal-dialog { max-height: 96vh; border-radius: var(--radius) var(--radius) 0 0; }

    .te-custom-fields { flex-direction: column; }
    .te-custom-fields .te-field { width: 100%; }
    .te-custom-fields input, .te-custom-fields select { width: 100%; }
}

@media (max-width: 480px) {
    .te-hero h1 { font-size: 2.28rem; }
    .te-hero p  { font-size: 1.08rem; }
    .te-features { grid-template-columns: repeat(2, 1fr); }
}
