/* Mimino Email Client Styles */
.mimino-email-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    max-width: 100%;
    margin: 0 auto;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

:root {
    --primary-color: #1e40af;
}

/* Кнопка оновлення в лівому верхньому куті */
.refresh-button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    background: var(--primary-color);
    color: white;
    border: 1px solid var(--primary-color);
    margin: 0;
    flex-shrink: 0;
}

.refresh-button:hover {
    background: #1e3a8a;
    border-color: #1e3a8a;
}

/* Layout */
.email-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    min-height: 520px;
}

/* Sidebar */
.email-sidebar {
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
}

.email-list-header {
    padding: 12px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff;
}

.email-list-header h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.email-filters {
    margin-bottom: 8px;
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
    flex-direction: column;
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    padding-right: 32px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
    background: #ffffff;
    transition: border-color 0.15s ease;
}

.clear-search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 2px;
    font-size: 12px;
    border-radius: 2px;
    transition: all 0.15s ease;
    display: none;
}

.clear-search-btn:hover {
    color: var(--primary-color);
    background: rgba(30, 64, 175, 0.1);
}

.clear-search-btn.visible {
    display: block;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.search-status {
    font-size: 11px;
    color: #6b7280;
    margin-top: 4px;
    padding: 4px 0;
    line-height: 1.2;
}

.search-status.search-active {
    color: var(--primary-color);
    font-weight: 500;
}

/* Email List */
.email-list {
    max-height: 620px;
    overflow-y: auto;
}
div#email-list {
    overflow-x: hidden;
}

.email-item {
    padding: 12px 20px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: all 0.15s ease;
    background: #ffffff;
}

.email-item:hover {
    background: #f8fafc;
    transform: translateX(2px);
}

.email-item.selected {
    background: #eff6ff;
    border-left: 4px solid var(--primary-color);
}

.email-item.unread {
    background: #ffffff;
    border-left: 4px solid transparent;
}

.email-item.unread:hover {
    background: #f8fafc;
}

.email-item.unread.selected {
    background: #eff6ff;
    border-left: 4px solid var(--primary-color);
}

.email-sender {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 3px;
    font-size: 13px;
}

.email-sender-name {
    color: #374151;
}

.email-sender-email {
    color: #6b7280;
    font-size: 11px;
    margin-left: 6px;
}

.email-subject {
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
    font-size: 13px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.email-recipients {
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 4px;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.email-date {
    font-size: 11px;
    color: #9ca3af;
    text-align: right;
}

.loading {
    padding: 40px;
    text-align: center;
    color: #6b7280;
    font-style: italic;
}

/* Email Content */
.email-content {
    background: #ffffff;
}

.email-view {
    height: 100%;
    overflow-y: auto;
}

.no-email-selected {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9ca3af;
    text-align: center;
    padding: 40px;
}

.no-email-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-email-selected p {
    font-size: 16px;
    margin: 0;
}

/* Email Detail */
.email-detail {
    padding: 24px;
}

.email-detail-header {
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.email-detail-subject {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0 0 14px 0;
    line-height: 1.3;
}

.email-detail-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px 14px;
    font-size: 13px;
}

.email-detail-meta dt {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 70px;
}

.email-detail-meta dd {
    margin: 0;
    color: #374151;
}

.email-detail-body {
    line-height: 1.5;
    color: #374151;
    font-size: 14px;
}

.email-detail-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
}

/* Responsive */
@media (max-width: 1024px) {
    .email-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    
    .email-sidebar {
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }
    
    .email-list {
        max-height: 280px;
    }
}

@media (max-width: 768px) {
    .email-list-header h3 {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    .refresh-button {
        align-self: flex-end;
    }
    
    .email-detail {
        padding: 16px;
    }
    
    .email-detail-subject {
        font-size: 18px;
    }
}

/* Scrollbar Styling */
.email-list::-webkit-scrollbar,
.email-view::-webkit-scrollbar {
    width: 8px;
}

.email-list::-webkit-scrollbar-track,
.email-view::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.email-list::-webkit-scrollbar-thumb,
.email-view::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.email-list::-webkit-scrollbar-thumb:hover,
.email-view::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.email-item {
    animation: fadeIn 0.2s ease;
}

/* Error States */
.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px;
    border-radius: 4px;
    margin: 12px;
    text-align: center;
    font-size: 13px;
}

/* Success States */
.success-message {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
    padding: 12px;
    border-radius: 4px;
    margin: 12px;
    text-align: center;
    font-size: 13px;
}
