/* Outlook-style Mail Interface */
.outlook-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: #f6f8fa;
}

/* Top Header */
.outlook-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: white;
    border-bottom: 1px solid #e1e4e8;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    z-index: 100;
}

.outlook-header h4 {
    font-size: 18px;
    font-weight: 600;
    color: #24292e;
}

/* Search Box */
.search-box {
    position: relative;
    width: 300px;
}

.search-box i.bi-search {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6a737d;
    pointer-events: none;
}

.search-box input {
    padding-left: 36px;
    padding-right: 32px;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    width: 100%;
}

.search-box input:focus {
    border-color: var(--primary, #6366f1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-box .btn-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: #6a737d;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
}

.search-box .btn-clear:hover {
    background: #f6f8fa;
    color: #24292e;
}

/* Main Content Area */
.outlook-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Sidebar - Folders */
.outlook-sidebar {
    width: 220px;
    background: white;
    border-right: 1px solid #e1e4e8;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.folder-list {
    padding: 8px 0;
}

.folder-header {
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #6a737d;
    letter-spacing: 0.5px;
}

.folder-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    margin: 2px 8px;
    border: none;
    background: transparent;
    color: #24292e;
    text-align: left;
    width: calc(100% - 16px);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.folder-item:hover {
    background: #f6f8fa;
}

.folder-item.active {
    background: linear-gradient(135deg, var(--primary, #6366f1) 0%, #818cf8 100%);
    color: white;
    font-weight: 500;
}

.folder-item i {
    font-size: 16px;
    width: 20px;
}

.folder-item .badge {
    margin-left: auto;
    font-size: 11px;
    padding: 2px 6px;
}

/* Message List */
.outlook-message-list {
    width: 380px;
    background: white;
    border-right: 1px solid #e1e4e8;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.message-list-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e1e4e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.message-list-header h6 {
    font-size: 16px;
    font-weight: 600;
    color: #24292e;
}

.message-list-body {
    flex: 1;
    overflow-y: auto;
}

/* Message Item */
.message-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid #f6f8fa;
    cursor: pointer;
    transition: background-color 0.15s;
}

.message-item:hover {
    background-color: #f6f8fa;
}

.message-item.selected {
    background: linear-gradient(90deg, #f0f4ff 0%, #e8eeff 100%);
    border-left: 3px solid var(--primary, #6366f1);
}

.message-item.unread {
    background-color: #f9fafb;
}

.message-item-sender {
    display: flex;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary, #6366f1) 0%, #818cf8 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.avatar-large {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary, #6366f1) 0%, #818cf8 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
}

.message-item-info {
    flex: 1;
    min-width: 0;
}

.message-item-from {
    font-size: 13px;
    font-weight: 500;
    color: #24292e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-item.unread .message-item-from {
    font-weight: 700;
}

.message-item-subject {
    font-size: 13px;
    color: #24292e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.message-item.unread .message-item-subject {
    font-weight: 600;
}

.message-item-preview {
    font-size: 12px;
    color: #6a737d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.message-item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    margin-left: 8px;
}

.message-item-date {
    font-size: 11px;
    color: #6a737d;
    white-space: nowrap;
}

.message-item.unread .message-item-date {
    font-weight: 600;
    color: var(--primary, #6366f1);
}

/* Reading Pane */
.outlook-reading-pane {
    flex: 1;
    background: white;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.reading-pane-header {
    padding: 16px 24px;
    border-bottom: 1px solid #e1e4e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reading-pane-header h5 {
    font-size: 18px;
    font-weight: 600;
    color: #24292e;
    margin: 0;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reading-pane-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.message-header {
    padding-bottom: 16px;
    border-bottom: 1px solid #e1e4e8;
}

.message-body {
    padding-top: 20px;
    line-height: 1.6;
    color: #24292e;
}

/* Attachments */
.attachments-section {
    background: #f6f8fa;
}

.attachments-section h6 {
    font-size: 13px;
    font-weight: 600;
    color: #24292e;
    margin-bottom: 0;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    font-size: 13px;
}

.attachment-item i.bi-file-earmark {
    color: var(--primary, #6366f1);
    font-size: 18px;
}

.attachment-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.attachment-size {
    color: #6a737d;
    font-size: 11px;
}

.attachment-item .btn-link {
    padding: 2px 6px;
    color: var(--primary, #6366f1);
    text-decoration: none;
}

.attachment-item .btn-link:hover {
    background: #f6f8fa;
    border-radius: 4px;
}

/* HTML Email Rendering */
.html-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #24292e;
}

.html-body img {
    max-width: 100%;
    height: auto;
}

.html-body a {
    color: var(--primary, #6366f1);
    text-decoration: none;
}

.html-body a:hover {
    text-decoration: underline;
}

.html-body table {
    border-collapse: collapse;
    max-width: 100%;
}

.html-body table td,
.html-body table th {
    padding: 8px;
    border: 1px solid #e1e4e8;
}

.blocked-image {
    padding: 20px;
    background: #f6f8fa;
    border: 1px dashed #e1e4e8;
    border-radius: 6px;
    text-align: center;
    color: #6a737d;
    margin: 10px 0;
}

.blocked-image i {
    font-size: 24px;
    display: block;
    margin-bottom: 8px;
}

.plain-text-body {
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
}

/* Scrollbar Styling */
.outlook-sidebar::-webkit-scrollbar,
.message-list-body::-webkit-scrollbar,
.reading-pane-body::-webkit-scrollbar {
    width: 8px;
}

.outlook-sidebar::-webkit-scrollbar-track,
.message-list-body::-webkit-scrollbar-track,
.reading-pane-body::-webkit-scrollbar-track {
    background: #f6f8fa;
}

.outlook-sidebar::-webkit-scrollbar-thumb,
.message-list-body::-webkit-scrollbar-thumb,
.reading-pane-body::-webkit-scrollbar-thumb {
    background: #d1d5da;
    border-radius: 4px;
}

.outlook-sidebar::-webkit-scrollbar-thumb:hover,
.message-list-body::-webkit-scrollbar-thumb:hover,
.reading-pane-body::-webkit-scrollbar-thumb:hover {
    background: #959da5;
}

/* Responsive */
@media (max-width: 1200px) {
    .outlook-sidebar {
        width: 60px;
    }
    
    .folder-item span {
        display: none;
    }
    
    .folder-header {
        display: none;
    }
    
    .folder-item {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .outlook-main {
        flex-direction: column;
    }
    
    .outlook-sidebar,
    .outlook-message-list {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e1e4e8;
    }
    
    .outlook-reading-pane {
        display: none;
    }
    
    .outlook-reading-pane.show-mobile {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
    }
}
