/* ==========================================================================
   Apple Mail.app 3-Pane Interface & Interactive Contact Styles
   ========================================================================== */

.mail-layout {
    display: flex;
    overflow: hidden;
    height: 100%;
    position: relative;
}

/* 1. Left Mailbox Sidebar */
.mail-sidebar {
    width: 170px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--window-border);
    padding: 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.mail-sidebar .sidebar-title {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 8px 0 4px 6px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.mail-sidebar .sidebar-item {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    color: #ddd;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.mail-sidebar .sidebar-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.mail-sidebar .sidebar-item.active {
    background: var(--sidebar-active);
    color: #fff;
    font-weight: 500;
}

.mail-sidebar .sidebar-item .badge {
    margin-left: auto;
    font-size: 11px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 600;
}

.mail-sidebar .sidebar-item.active .badge {
    background: var(--accent);
}

/* 2. Middle Message List Column */
.mail-list-container {
    width: 250px;
    background: rgba(22, 22, 22, 0.6);
    border-right: 1px solid var(--window-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mail-search-box {
    padding: 10px 12px;
    border-bottom: 1px solid var(--window-border);
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
}

.mail-search-box i {
    color: #8e8e93;
    font-size: 12px;
}

.mail-search-box input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 12.5px;
    color: #fff;
    font-family: inherit;
}

.mail-search-box input::placeholder {
    color: #777;
}

.mail-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.mail-item {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}

.mail-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.mail-item.active {
    background: var(--sidebar-active);
}

.mail-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.mail-sender-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--mail-unread-blue);
    display: inline-block;
    box-shadow: 0 0 6px var(--mail-unread-blue);
}

.unread-dot.read {
    display: none;
}

.mail-sender {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.mail-time {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 400;
}

.mail-subject {
    font-size: 12.5px;
    font-weight: 500;
    color: #e0e0e0;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mail-snippet {
    font-size: 11.5px;
    color: #888;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mail-star-btn {
    color: #666;
    font-size: 11px;
    margin-left: 4px;
    transition: color 0.15s;
}

.mail-star-btn.starred {
    color: var(--mail-star-yellow);
}

/* 3. Right Reading Pane */
.mail-reader {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(16, 16, 16, 0.45);
    overflow-y: auto;
    padding: 24px 28px;
}

.mail-reader-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mail-tool-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: #ddd;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s ease;
}

.mail-tool-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.mail-reader-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.mail-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #007aff, #00c6ff);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0,0,0,0.35);
    flex-shrink: 0;
}

.mail-meta {
    flex: 1;
}

.mail-reader-subject {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
    line-height: 1.3;
}

.mail-reader-from, .mail-reader-to {
    font-size: 12.5px;
    color: #aaa;
    line-height: 1.5;
}

.mail-verified-badge {
    color: #43e97b;
    font-size: 11px;
    margin-left: 4px;
}

.mail-date {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
}

.mail-reader-body {
    flex: 1;
}

.mail-reader-body p {
    font-size: 13.5px;
    line-height: 1.7;
    color: #ddd;
    margin-bottom: 14px;
}

.mail-attachment-box {
    margin: 18px 0;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mail-attachment-box:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.mail-attachment-box i {
    font-size: 24px;
    color: #ff5f56;
}

.mail-attachment-info h4 {
    font-size: 13px;
    color: #fff;
    margin-bottom: 2px;
}

.mail-attachment-info span {
    font-size: 11px;
    color: #888;
}

.mail-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px dashed rgba(255, 255, 255, 0.12);
}

.mail-action-btn {
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #eee;
    font-size: 12.5px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
}

.mail-action-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    transform: translateY(-1px);
}

.mail-action-btn.primary {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
}

.mail-action-btn.primary:hover {
    background: var(--accent-hover);
}

/* 4. Interactive Compose Modal */
.mail-compose-modal {
    position: absolute;
    top: 40px;
    left: 30px;
    right: 30px;
    bottom: 25px;
    background: rgba(28, 28, 28, 0.96);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    z-index: 100;
    animation: composeAppear 0.2s ease-out;
}

@keyframes composeAppear {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.mail-compose-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;
    font-size: 13px;
    color: #fff;
}

.close-compose-btn {
    background: none;
    border: none;
    color: #aaa;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.close-compose-btn:hover { color: #fff; }

.mail-compose-fields {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 12px;
}

.compose-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #aaa;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 8px;
}

.compose-row span {
    width: 55px;
    color: #888;
}

.compose-row input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    outline: none;
    font-size: 13px;
    font-family: inherit;
}

#compose-message {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    resize: none;
    outline: none;
    padding: 10px 0;
    line-height: 1.6;
}

.compose-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Compose Attachment Drop Zone */
.compose-attachment-zone {
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: #888;
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.2s ease;
}

.compose-attachment-zone:hover {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.04);
}

.compose-attachment-zone i {
    color: #007aff;
    margin-right: 6px;
}
