/* ===== EmailPage — Modul Email StaerTeams ===== */

.email-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Toolbar */
.email-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
    flex-shrink: 0;
}

.email-toolbar-left,
.email-toolbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.email-search {
    width: 220px;
}

.email-new-notif {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    background: #c43e1c;
    padding: 3px 10px;
    border-radius: 12px;
    cursor: pointer;
    animation: email-pulse 1.5s ease-in-out infinite;
}

@keyframes email-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Body: 3-column layout */
.email-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Folders sidebar */
.email-folders {
    width: 180px;
    min-width: 150px;
    border-right: 1px solid #e0e0e0;
    background: #f5f6fa;
    overflow-y: auto;
    padding: 6px 0;
    flex-shrink: 0;
}

.email-folder-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    cursor: pointer;
    font-size: 0.875rem;
    color: #333;
    transition: background 0.15s;
}

.email-folder-item:hover {
    background: #e8eaf6;
}

.email-folder-item.active {
    background: #262f7d;
    color: #fff;
    font-weight: 600;
}

.email-folder-item.active .email-folder-badge {
    background: #fff;
    color: #262f7d;
}

.email-folder-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-folder-badge {
    background: #262f7d;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Message list */
.email-list {
    width: 360px;
    min-width: 280px;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    flex-shrink: 0;
}

.email-list-item {
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.15s;
}

.email-list-item:hover {
    background: #f5f6fa;
}

.email-list-item.selected {
    background: #e8eaf6;
    border-left: 3px solid #262f7d;
}

.email-list-item.unread {
    background: #fff;
}

.email-list-item.unread .email-from,
.email-list-item.unread .email-subject {
    font-weight: 700;
}

.email-list-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2px;
}

.email-from {
    font-size: 0.85rem;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.email-date {
    font-size: 0.75rem;
    color: #888;
    white-space: nowrap;
    flex-shrink: 0;
}

.email-subject {
    font-size: 0.82rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.email-preview {
    font-size: 0.78rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-load-more {
    padding: 10px;
    text-align: center;
}

/* Loading & empty states */
.email-loading,
.email-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    gap: 10px;
    color: #aaa;
    font-size: 0.9rem;
}

.email-empty i,
.email-detail-empty i {
    font-size: 2.5rem;
}

/* Detail panel */
.email-detail {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.email-detail-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 10px;
    color: #ccc;
    font-size: 0.9rem;
}

.email-detail-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
    flex-shrink: 0;
}

.email-detail-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.email-detail-header h5 {
    margin: 0 0 6px 0;
    font-size: 1.05rem;
    color: #222;
}

.email-detail-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.8rem;
    color: #555;
}

.email-attachments {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid #eee;
}

.email-att-link {
    font-size: 0.8rem;
    color: #262f7d;
    text-decoration: none;
    padding: 2px 8px;
    background: #f0f1f8;
    border-radius: 4px;
    transition: background 0.15s;
}

.email-att-link:hover {
    background: #dfe1f0;
}

.email-detail-body {
    flex: 1;
    overflow: hidden;
}

.email-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
}

/* Preview atasament */
.email-preview-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #666;
}

/* Compose */
.email-compose {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.email-compose-fields {
    flex-shrink: 0;
    padding-bottom: 6px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 6px;
}

.email-field-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
    min-width: 55px;
    text-align: right;
}

.email-compose-editor {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.email-richedit {
    height: 100% !important;
}

.email-compose-att-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 0 0 60px;
}

.email-compose-att-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    background: #f0f1f8;
    padding: 2px 8px;
    border-radius: 4px;
    color: #333;
}

.email-att-remove {
    cursor: pointer;
    color: #c00;
    font-size: 0.75rem;
}

.email-att-remove:hover {
    color: #900;
}

/* Context menu */
.email-ctx-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
}

.email-ctx-menu {
    position: fixed;
    z-index: 9999;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    min-width: 200px;
    padding: 4px 0;
}

.email-ctx-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.12s;
}

.email-ctx-item:hover {
    background: #f0f1f8;
}

.email-ctx-item.text-danger:hover {
    background: #fde8e8;
}

/* Move list */
.email-move-list {
    display: flex;
    flex-direction: column;
}

.email-move-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.12s;
}

.email-move-item:hover {
    background: #e8eaf6;
}

/* Responsive: sub 900px — hide folders, list fullwidth */
@media (max-width: 900px) {
    .email-folders {
        display: none;
    }
    .email-list {
        width: 100%;
        min-width: 0;
    }
}
