/* =========================================================
   LoanNext Webmail — Webmail-specific styles
   ========================================================= */

/* ---- Login ---- */
.wm-login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 42px 40px;
    width: 100%;
    max-width: 400px;
}
.wm-login-logo {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--navy);
    text-align: center;
    margin-bottom: 28px;
}
.wm-login-logo span { color: var(--green); }
.wm-login-logo small {
    display: block;
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--slate);
    font-weight: 500;
    margin-top: 4px;
}

/* ---- Alerts ---- */
.wm-alert {
    padding: 13px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    margin-bottom: 18px;
}
.wm-alert-danger  { background: rgba(192,57,43,0.08); border: 1px solid rgba(192,57,43,0.2); color: #a02d22; }
.wm-alert-success { background: rgba(40,167,69,0.08); border: 1px solid rgba(40,167,69,0.2); color: #1a7a32; }

/* ---- Toolbar ---- */
.wm-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--white);
    border-bottom: 1px solid var(--line);
    padding: 12px 24px;
    gap: 12px;
    flex-wrap: wrap;
    margin: -28px -28px 0;
}
.wm-toolbar-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.wm-toolbar-right { display: flex; align-items: center; gap: 10px; }

/* ---- Folder dropdown ---- */
.wm-folder-dropdown { position: relative; }
.wm-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    min-width: 180px;
    z-index: 100;
    overflow: hidden;
}
.wm-dropdown-menu.open { display: block; }
.wm-dropdown-menu a {
    display: block;
    padding: 10px 16px;
    font-size: 0.875rem;
    color: var(--ink);
    transition: background 0.12s;
}
.wm-dropdown-menu a:hover { background: var(--paper); }

/* ---- Small outline button ---- */
.btn-outline-sm {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    font-size: 0.83rem;
    font-weight: 500;
    color: var(--navy);
    background: var(--white);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    text-decoration: none;
    font-family: var(--font-body);
    white-space: nowrap;
}
.btn-outline-sm:hover { border-color: var(--green); background: var(--paper); }
.btn-danger-sm { color: #a02d22; }
.btn-danger-sm:hover { border-color: #a02d22; background: rgba(192,57,43,0.05); }

/* ---- Mail list ---- */
.wm-mail-list {
    background: var(--white);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    border: 1px solid var(--line);
    border-top: none;
    overflow: hidden;
}
.wm-mail-row {
    display: grid;
    grid-template-columns: 16px 200px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    transition: background 0.12s;
    text-decoration: none;
    color: var(--ink);
}
.wm-mail-row:last-child { border-bottom: none; }
.wm-mail-row:hover { background: var(--paper); }
.wm-mail-row.unread { background: rgba(40,167,69,0.03); }
.wm-mail-row.unread .wm-mail-from,
.wm-mail-row.unread .wm-mail-subject { font-weight: 600; }

.wm-mail-dot { color: var(--green); font-size: 0.55rem; text-align: center; }
.wm-mail-from { font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--navy); }
.wm-mail-subject { font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--slate); }
.wm-mail-row.unread .wm-mail-subject { color: var(--ink); }
.wm-mail-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.wm-mail-date { font-size: 0.78rem; color: var(--slate); white-space: nowrap; }
.wm-mail-size { font-size: 0.72rem; color: var(--slate); }

/* ---- Empty state ---- */
.wm-empty {
    text-align: center;
    padding: 80px 24px;
    color: var(--slate);
    font-size: 0.95rem;
}
.wm-empty p { margin-top: 4px; }

/* ---- Pagination ---- */
.wm-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px;
    font-size: 0.875rem;
    color: var(--slate);
}

/* ---- Read view ---- */
.wm-read-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    overflow: hidden;
}
.wm-read-header {
    padding: 28px 32px;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
}
.wm-read-subject {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 18px;
    line-height: 1.3;
}
.wm-read-meta-grid {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 6px 16px;
    font-size: 0.875rem;
    margin-bottom: 20px;
}
.wm-meta-label { color: var(--slate); font-weight: 600; }
.wm-meta-value { color: var(--ink); word-break: break-word; }
.wm-att-badge {
    display: inline-block;
    background: var(--paper-dim);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 3px 10px;
    font-size: 0.8rem;
    margin: 2px 4px 2px 0;
}
.wm-read-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.wm-read-body { padding: 28px 32px; }
.wm-read-plaintext {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.75;
    color: var(--ink);
    white-space: pre-wrap;
    word-break: break-word;
}

/* ---- Compose ---- */
.wm-compose-options {
    margin-top: 6px;
    padding: 12px 16px;
    background: var(--paper);
    border-radius: var(--radius);
    border: 1px solid var(--line);
}
.wm-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.875rem;
    color: var(--ink);
    cursor: pointer;
}
.wm-checkbox-label input { accent-color: var(--green); width: 16px; height: 16px; cursor: pointer; }

/* ---- Modal ---- */
.wm-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(8,29,58,0.5);
    z-index: 300;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(3px);
}
.wm-modal-overlay.open { display: flex; }
.wm-modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 580px;
    padding: 28px;
    max-height: 90vh;
    overflow-y: auto;
}
.wm-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}
.wm-modal-head h3 { font-size: 1.1rem; color: var(--navy); }
.wm-modal-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--slate);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: background 0.12s;
}
.wm-modal-close:hover { background: var(--paper-dim); }

/* ---- Responsive tweaks ---- */
@media (max-width: 700px) {
    .wm-mail-row { grid-template-columns: 12px 1fr auto; }
    .wm-mail-from { display: none; }
    .wm-read-header { padding: 18px; }
    .wm-read-body { padding: 18px; }
    .wm-toolbar { margin: -16px -16px 0; padding: 10px 16px; }
}
