/* Email Browser Popup */
.emailBrowserPopup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 13;
}

.emailBrowserPopup .background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    opacity: 0.4;
}

.emailBrowserPopup .contentHolder {
    position: relative;
    width: 1100px;
    max-width: 95%;
    background: #fff;
    margin: 30px auto;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    max-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
}

/* Header */
.emailBrowserPopup .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--trackrHeaderColor);
    color: #fff;
    border-radius: 6px 6px 0 0;
}

.emailBrowserPopup .header .title {
    font-size: 20px;
    font-weight: 500;
}

.emailBrowserPopup .header .closeBtn {
    cursor: pointer;
    font-size: 18px;
    padding: 5px 10px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.emailBrowserPopup .header .closeBtn:hover {
    opacity: 1;
}

/* Search Area */
.emailBrowserPopup .searchArea {
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.emailBrowserPopup .searchInputHolder {
    display: flex;
    gap: 10px;
}

.emailBrowserPopup .searchInput {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.emailBrowserPopup .searchInput:focus {
    outline: none;
    border-color: var(--trackrHeaderColor);
}

.emailBrowserPopup .searchBtn {
    padding: 10px 20px;
    background: var(--trackrHeaderColor);
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.emailBrowserPopup .searchBtn:hover {
    background: var(--trackrDarkBlueColor);
}

/* Search Suggestions */
.emailBrowserPopup .searchSuggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.emailBrowserPopup .suggestionChip {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.emailBrowserPopup .suggestionChip.emailChip {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #90caf9;
}

.emailBrowserPopup .suggestionChip.emailChip:hover {
    background: #bbdefb;
}

.emailBrowserPopup .suggestionChip.keywordChip {
    background: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #ce93d8;
}

.emailBrowserPopup .suggestionChip.keywordChip:hover {
    background: #e1bee7;
}

/* Emails List */
.emailBrowserPopup .emailsListHolder {
    flex: 1;
    overflow-y: auto;
    min-height: 300px;
    max-height: 500px;
}

.emailBrowserPopup .emailsList {
    /* Compact list - no padding needed */
}

/* Empty and Loading States */
.emailBrowserPopup .emptyState,
.emailBrowserPopup .loadingState {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #999;
}

.emailBrowserPopup .emptyState.hide,
.emailBrowserPopup .loadingState.hide {
    display: none;
}

.emailBrowserPopup .emptyIcon,
.emailBrowserPopup .loadingIcon {
    font-size: 48px;
    margin-bottom: 15px;
}

.emailBrowserPopup .emptyText,
.emailBrowserPopup .loadingText {
    font-size: 16px;
}

/* Email Row - Compact List Style */
.emailBrowserPopup .emailRow {
    border-bottom: 1px solid #e0e0e0;
    background: #fff;
    transition: background 0.15s;
}

.emailBrowserPopup .emailRow:first-child {
    border-top: 1px solid #e0e0e0;
}

.emailBrowserPopup .emailRow:hover {
    background: #f5f5f5;
}

.emailBrowserPopup .emailRow.added {
    background: #e8f5e9;
}

/* Already added to project (loaded from database) */
.emailBrowserPopup .emailRow.alreadyAdded {
    background: #fafafa;
}

.emailBrowserPopup .emailRow.alreadyAdded .emailFrom,
.emailBrowserPopup .emailRow.alreadyAdded .emailSubject {
    color: #757575;
}

.emailBrowserPopup .alreadyAddedBadge {
    display: inline-block;
    padding: 2px 8px;
    background: #4caf50;
    color: #fff;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 500;
    margin-left: 8px;
    vertical-align: middle;
}

.emailBrowserPopup .emailRowHeader {
    display: flex;
    align-items: flex-start;
    padding: 10px 15px;
    cursor: pointer;
}

.emailBrowserPopup .checkboxHolder {
    padding-top: 3px;
    margin-right: 12px;
}

.emailBrowserPopup .emailCheckbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.emailBrowserPopup .emailInfo {
    flex: 1;
    min-width: 0;
}

.emailBrowserPopup .emailFrom {
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.emailBrowserPopup .emailSubject {
    color: #333;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.emailBrowserPopup .emailDate {
    font-size: 12px;
    color: #888;
    margin-bottom: 4px;
}

.emailBrowserPopup .emailSnippet {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Quick-add project buttons in row header */
.emailBrowserPopup .quickAddProjects {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-left: 15px;
    flex-shrink: 0;
}

.emailBrowserPopup .quickAddProject {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.emailBrowserPopup .quickAddProject:hover {
    background: #ffe0b2;
    border-color: #ffb74d;
}

.emailBrowserPopup .quickAddProject .addIcon {
    font-size: 10px;
    font-weight: bold;
}

.emailBrowserPopup .quickAddProject.added {
    background: #e8f5e9;
    color: #2e7d32;
    border-color: #a5d6a7;
    cursor: default;
}

.emailBrowserPopup .quickAddProject.added .addIcon {
    display: none;
}

.emailBrowserPopup .quickAddProject.added::before {
    content: '\f00c';
    font-family: FontAwesome;
    margin-right: 4px;
    font-size: 10px;
}

/* Email Detail Modal */
.emailDetailModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 14;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emailDetailModal .modalBackground {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    opacity: 0.5;
}

.emailDetailModal .modalContent {
    position: relative;
    width: 700px;
    max-width: 90%;
    max-height: 85vh;
    background: #fff;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.emailDetailModal .modalHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--trackrHeaderColor);
    color: #fff;
    border-radius: 8px 8px 0 0;
}

.emailDetailModal .modalHeader .modalTitle {
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 15px;
}

.emailDetailModal .modalHeader .modalCloseBtn {
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.emailDetailModal .modalHeader .modalCloseBtn:hover {
    opacity: 1;
}

/* Quick-add projects in modal */
.emailDetailModal .modalQuickAddProjects {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.emailDetailModal .modalQuickAddProjects .quickAddLabel {
    font-size: 12px;
    color: #666;
    margin-right: 5px;
    align-self: center;
}

.emailDetailModal .modalQuickAddProject {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.emailDetailModal .modalQuickAddProject:hover {
    background: #ffe0b2;
    border-color: #ffb74d;
}

.emailDetailModal .modalQuickAddProject .addIcon {
    font-size: 11px;
    font-weight: bold;
}

.emailDetailModal .modalQuickAddProject.added {
    background: #e8f5e9;
    color: #2e7d32;
    border-color: #a5d6a7;
    cursor: default;
}

.emailDetailModal .modalQuickAddProject.added .addIcon {
    display: none;
}

.emailDetailModal .modalQuickAddProject.added::before {
    content: '\f00c';
    font-family: FontAwesome;
    margin-right: 4px;
    font-size: 11px;
}

/* Email headers in modal */
.emailDetailModal .emailHeaders {
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 13px;
    color: #666;
}

.emailDetailModal .emailHeaders .headerRow {
    margin-bottom: 4px;
}

.emailDetailModal .emailHeaders .headerRow:last-child {
    margin-bottom: 0;
}

.emailDetailModal .emailHeaders .headerLabel {
    font-weight: 500;
    color: #333;
    display: inline-block;
    width: 50px;
}

/* Email body in modal */
.emailDetailModal .emailBodyHolder {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    font-size: 14px;
    line-height: 1.6;
}

.emailDetailModal .emailBodyHolder img {
    max-width: 100%;
    height: auto;
}

/* Footer */
.emailBrowserPopup .footerArea {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
    border-radius: 0 0 6px 6px;
}

.emailBrowserPopup .selectedCount {
    font-size: 14px;
    color: #666;
}

.emailBrowserPopup .bulkAddHolder {
    display: flex;
    gap: 10px;
    align-items: center;
}

.emailBrowserPopup .bulkAddHolder.hasProject .bulkProjectInput {
    background: #e8f5e9;
    border-color: #a5d6a7;
}

.emailBrowserPopup .bulkProjectInput {
    width: 250px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.emailBrowserPopup .bulkProjectInput:focus {
    outline: none;
    border-color: var(--trackrHeaderColor);
}

.emailBrowserPopup .bulkAddBtn {
    padding: 8px 20px;
    background: var(--trackrHeaderColor);
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.emailBrowserPopup .bulkAddBtn:hover {
    background: var(--trackrDarkBlueColor);
}

/* Scrollbar styling */
.emailBrowserPopup .emailsListHolder::-webkit-scrollbar {
    width: 8px;
}

.emailBrowserPopup .emailsListHolder::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.emailBrowserPopup .emailsListHolder::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.emailBrowserPopup .emailsListHolder::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
