/* =====================================================
   RESET & BASE
   ===================================================== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Jost", Arial, sans-serif;
    background: #f4f6f8;
    color: #1f2937;
}

/* =====================================================
   APP LAYOUT
   ===================================================== */
.app {
    display: flex;
    height: 100vh;
}

/* =====================================================
   SIDEBAR
   ===================================================== */
.sidebar {
    width: 230px;
    background: #23a185;
    color: #ffffff;
    display: flex;
    flex-direction: column;
}

/* Logo */
.sidebar .logo {
    padding: 16px 20px 10px;
    display: flex;
    align-items: center;
}

.sidebar-logo {
    max-height: 36px;
    width: auto;
    display: block;
}

/* New Mail button under logo */
.new-mail {
    padding: 0 20px 16px;
}

.btn-new-mail {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    width: 100%;
    padding: 12px 14px;

    border-radius: 12px;
    text-decoration: none;

    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #fff;

    font-weight: 600;
    font-size: 14px;

    transition: background 0.2s ease, transform 0.12s ease, border 0.2s ease;
}

.btn-new-mail:hover {
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.30);
    transform: translateY(-1px);
}

.btn-new-mail i {
    font-size: 13px;
}

/* Nav links */
.sidebar nav a{
    padding: 12px 20px;
    color: #ffffff;
    text-decoration: none;

    display: flex;
    align-items: center;
    justify-content: space-between;

    font-weight: 500;
    border-left: 3px solid transparent;
}

.sidebar nav a:hover {
    background: rgba(255, 255, 255, 0.15);
}

.sidebar nav a.active {
    background: rgba(255, 255, 255, 0.17);
    border-left: 3px solid rgba(255, 255, 255, 0.75);
}

/* Folder label + count */
.sidebar nav a .nav-label{
    flex: 1;
    white-space: nowrap;
}

.sidebar nav a .nav-count{
    flex: 0 0 auto;

    /* ✅ Perfect circle */
    width: 28px;
    height: 28px;
    border-radius: 50%;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    font-size: 12px;
    font-weight: 700;
    line-height: 1;

    margin-left: auto; /* ✅ push fully to right */

    background: rgba(255, 255, 255, 0.20);
    color: #ffffff;
}

.sidebar nav a.active .nav-count {
    background: rgba(255, 255, 255, 0.20);
    color: #fff;
}

.sidebar nav a:hover .nav-count{
    background: rgba(255, 255, 255, 0.28);
}

.sidebar nav a.active .nav-count{
    background: #ffffff;
    color: #167c67; /* darker green */
}

/* Footer */
.sidebar footer {
    margin-top: auto;
    padding: 16px 20px;
    font-size: 14px;
    opacity: 0.9;
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 10px;

    color: #ffffff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    opacity: 0.9;
}

.sidebar-footer a:hover {
    opacity: 1;
    text-decoration: none;
}

.sidebar-footer i {
    font-size: 16px;
}

/* =====================================================
   MAIN CONTENT
   ===================================================== */
.content {
    flex: 1;
    background: #ffffff;
    overflow-y: auto;
    overflow-x: hidden;
}

/* =====================================================
   INBOX (FINAL, RESPONSIVE)
   ===================================================== */

.inbox {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 6px;
    overflow: hidden;
}

/* Each message row */
.mail-row {
    display: flex;
    align-items: center;
    width: 100%;
    font-size: 14px;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
}

/* Clickable mail content */
.mail-main {
    flex: 1;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) 160px;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: #1f2937;
    overflow: hidden;
}

/* Hover */
.mail-row:hover {
    background: #f8fafc;
}

/* Columns */
.mail-from {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mail-subject {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #374151;
}

.mail-date {
    text-align: right;
    font-size: 13px;
    color: #6b7280;
    white-space: nowrap;
}

/* Actions */
.mail-actions {
    display: flex;
    gap: 6px;
    padding-right: 16px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.mail-actions button {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}

.mail-actions button:hover {
    background: #e5e7eb;
}

/* Empty inbox */
.empty-state {
    padding: 40px;
    text-align: center;
    color: #6b7280;
}

/* =====================================================
   COMPOSE – CONTAINER
   ===================================================== */
/* Shared width container */
.compose-container,
.compose-shell {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0 24px; 
}

/* =====================================================
   COMPOSE – HEADER
   ===================================================== */
.compose-header,
.compose-top {
    background: #e9f6f2;
    padding: 8px 14px;                /* slightly tighter */
    font-size: 14px;                  /* aligns with Zoho */
    font-weight: 600;
    color: #111827;
    border-bottom: 1px solid #dbeee8;
    border-radius: 8px 8px 0 0;
}

/* =====================================================
   COMPOSE – CARD / WRAPPER
   ===================================================== */
.compose-card,
.compose-compact {
    margin-top: 6px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 8px 8px;
}

/* =====================================================
   COMPOSE – ROWS (Zoho-style compact)
   ===================================================== */
.compose-compact .row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-bottom: 1px solid #f1f5f9;
}

/* Labels */
.compose-compact .label {
    width: 70px;
    font-size: 12.5px;                /* refined */
    font-weight: 500;
    color: #6b7280;
    flex-shrink: 0;
}

/* Inputs */
.compose-compact input {
    flex: 1;
    border: none;
    font-size: 14px;
    font-family: "Jost", Arial, sans-serif;
    background: transparent;
    padding: 4px 6px;
}

.compose-compact input:focus {
    outline: none;
}

/* =====================================================
   CC / BCC TOGGLES
   ===================================================== */
.toggle,
.cc-bcc-toggle a {
    font-size: 12px;
    font-weight: 500;
    color: #0b5cff;
    cursor: pointer;
    text-decoration: none;
}

.toggle:hover,
.cc-bcc-toggle a:hover {
    text-decoration: underline;
}

/* Hidden rows */
.hidden,
.cc-bcc {
    display: none;
}

/* =====================================================
   EDITOR TOOLBAR
   ===================================================== */
.editor-toolbar {
    display: flex;
    gap: 12px;
    padding: 6px 12px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    color: #374151;
}

/* =====================================================
   MESSAGE EDITOR
   ===================================================== */
.editor,
.compose-compact textarea {
    width: 100%;
    min-height: 240px;
    padding: 12px;
    border: none;
    resize: vertical;
    font-family: "Jost", Arial, sans-serif;
    font-size: 14px;
}

.editor:focus,
.compose-compact textarea:focus {
    outline: none;
}

/* =====================================================
   FOOTER / ACTIONS
   ===================================================== */
.compose-footer,
.compose-actions {
    display: flex;
    gap: 10px;
    padding: 10px 15px;
    border-top: 1px solid #e5e7eb;
}

/* =====================================================
   BUTTONS
   ===================================================== */
.send-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    background: #18a37a;
    color: #ffffff;

    padding: 6px 18px;
    border: none;
    border-radius: 999px;

    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.send-btn:hover {
    background: #45c49f;
}

.ghost-btn {
    background: transparent;
    border: none;
    color: #6b7280;
    font-size: 13px;
    cursor: pointer;
}

.ghost-btn:hover {
    color: #111827;
}

/* =====================================================
   FOCUS STATE (shared – accessible)
   ===================================================== */
.compose-compact input:focus-visible,
.compose-compact textarea:focus-visible {
    box-shadow: inset 0 -2px 0 #23a185;
}

/* =====================================================
   LOGIN
   ===================================================== */
.login-body {
    background: #f4f6f8;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

.login-box {
    background: #ffffff;
    padding: 30px;
    width: 320px;
    border-radius: 6px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.login-box h2 {
    text-align: center;
    font-weight: 600;
    margin-bottom: 20px;
}

.login-box input {
    width: 100%;
    padding: 10px;
    margin-bottom: 12px;
    font-family: "Jost", Arial, sans-serif;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
}

.login-box button {
    width: 100%;
    padding: 10px;
    background: #0b5cff;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-family: "Jost", Arial, sans-serif;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
}

.login-box button:hover {
    background: #094ad4;
}

.mail-view {
  padding: 20px;
}

.mail-body {
  margin-top: 20px;
}

.mail-row.unread {
    background: #f1f8ff;
}

.mail-row.unread .mail-from,
.mail-row.unread .mail-subject {
    font-weight: 600;
}

.mail-avatar {
    width: 36px;
    height: 36px;
    margin-left: 12px;
    border-radius: 50%;
    background: #d1fae5;
    color: #065f46;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.mail-row {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    align-items: center;
}

.mail-row:hover .mail-actions {
    opacity: 1;
}

/* =====================================================
   TOPBAR – PROFESSIONAL MAIL STYLE
   ===================================================== */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between; 
    gap: 8px;

    padding: 6px 16px;

    background: #8fc4b8;
    border-bottom: 1px solid #dbeee8;

    margin-bottom: 10px;        /* keep space below */

    position: sticky;
    top: 0;                    /* ✅ flush to top */
    z-index: 5;

    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.topbar > * {
    margin: 0 !important;
}

/* Left */
.folder-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

/* Center search */
.mail-search {
    width: 260px;
    padding: 7px 14px;
    font-size: 14px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #f9fafb;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    padding-left: 36px;
    height: 32px;
}

.mail-search:focus {
    background: #ffffff;
    border-color: #23a185;
    box-shadow: 0 0 0 3px rgba(35,161,133,0.12);
}

/* Right */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #111827;
    font-size: 14px;
}

.icon-btn:hover {
    background: #e5e7eb;
}

/* User */
.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;

    height: 32px;   
    max-height: 32px;
    
    padding-left: 14px;
    border-left: 1px solid #e5e7eb;
}

.user-chip .avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #d1fae5;
    color: #065f46;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-chip:hover .user-avatar-img {
    box-shadow: 0 0 0 2px rgba(35,161,133,0.25);
}

.sidebar nav a.active {
    background: rgba(255, 255, 255, 0.2);
    font-weight: 500;
}

.compose-form label {
    font-size: 14px !important;
    color: #6b7280;
    margin-bottom: 4px;
    display: block;
} 

/* =========================================
   TOPBAR AVATAR (IMAGE)
   ====================================== */
.user-avatar-img {
    width: 28px;
    height: 28px;

    object-fit: contain;   
    display: block;
    flex-shrink: 0;

    border-radius: 50%;
    background: #ffffff;
}

.topbar img {
    max-height: 32px;
}

.folder-stats {
    margin-left: 10px;
    font-size: 13px;
    color: #6b7280;
    font-weight: 400;
    white-space: nowrap;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    height: 32px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);   /* CRITICAL */
    font-size: 13px;
    color: #9ca3af;
    pointer-events: none;
}

.app-launcher:hover {
    background: #e0f2fe;
}

/* ===============================
   DELETE BUTTON – DESTRUCTIVE
   =============================== */
.mail-actions .delete-btn {
    background: #fee2e2;              /* light red */
    border: 1px solid #fecaca;
    color: #b91c1c;                   /* red icon */
}

.mail-actions .delete-btn:hover {
    background: #fecaca;
    border-color: #f87171;
    color: #7f1d1d;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;

    padding: 6px 10px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.editor-toolbar .tool-group {
    display: flex;
    gap: 4px;
}

.editor-toolbar button {
    background: transparent;
    border: none;

    width: 32px;
    height: 32px;

    border-radius: 6px;

    display: flex;
    align-items: center;
    justify-content: center;

    color: #374151;
    font-size: 14px;

    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.editor-toolbar button:hover {
    background: #e5e7eb;
    color: #111827;
}

.editor-toolbar button:active {
    background: #dbeafe;
    color: #1d4ed8;
}

.editor-toolbar .divider {
    width: 1px;
    height: 16px;
    background: #e5e7eb;
    margin: 0 4px;
}

.new-mail {
    padding: 0 14px 14px;
}

.btn-new-mail {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #fff;
    font-weight: 400;
    padding: 12px 14px;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.1s ease;
}

.btn-new-mail:hover {
    background: linear-gradient(135deg, #4338ca, #4f46e5);
    transform: translateY(-1px);
}

.btn-new-mail i {
    font-size: 14px;
}

.alert.error{
    background:#fee2e2;
    border:1px solid #fecaca;
    color:#991b1b;
    padding:10px 14px;
    border-radius:8px;
    margin:10px 0;
    font-size:14px;
}
