/* Email UI Design - Inspired by modern email clients */
:root {
    --primary: #1a73e8;
    --primary-hover: #1557b0;
    --sidebar-bg: #f8f9fa;
    --sidebar-active: #e8f0fe;
    --sidebar-text: #5f6368;
    --border: #dadce0;
    --card: #ffffff;
    --text: #202124;
    --text-muted: #5f6368;
    --unread-bg: #f6f8fc;
    --danger: #d93025;
    --success: #1e8e3e;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #fff;
    color: var(--text);
    min-height: 100vh;
}

/* Top Bar */
.topbar {
    height: 64px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar .logo {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text);
    margin-right: 24px;
}

.search-wrap {
    flex: 1;
    max-width: 720px;
    position: relative;
}

.search-wrap input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 0.95rem;
    background: #f1f3f4;
}

.search-wrap input:focus {
    outline: none;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.search-wrap::before {
    content: "🔍";
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
}

.btn-sync {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 0.9rem;
    cursor: pointer;
    margin-left: 16px;
}

.btn-sync:hover {
    background: var(--primary-hover);
}

/* Layout */
.app-layout {
    display: flex;
    min-height: calc(100vh - 64px);
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 16px 0;
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.95rem;
    border-radius: 0 24px 24px 0;
    margin: 0 8px;
}

.sidebar-nav a:hover {
    background: rgba(0,0,0,0.05);
}

.sidebar-nav a.active {
    background: var(--sidebar-active);
    color: var(--primary);
    font-weight: 500;
}

.sidebar-nav .count {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.sidebar-nav .icon {
    width: 20px;
    margin-right: 16px;
    text-align: center;
}

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 24px;
}

.sidebar-label {
    padding: 8px 24px;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Filter Bar */
.filter-bar {
    padding: 12px 24px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.filter-bar select,
.filter-bar input[type="date"] {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
}

.filter-bar .btn-search {
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

/* Email List */
.email-list-wrap {
    flex: 1;
    overflow-y: auto;
}

.email-row {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    border-bottom: 1px solid #f0f0f0;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

.email-row:hover {
    background: #f8f9fa;
}

.email-row.unread {
    background: var(--unread-bg);
}

.email-row.unread:hover {
    background: #eef1f5;
}

.email-row .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #4285f4);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
    margin-right: 16px;
}

.email-row .content {
    flex: 1;
    min-width: 0;
}

.email-row .subject {
    font-weight: 500;
    font-size: 0.95rem;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-row .meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.email-row .meta span {
    margin-right: 12px;
}

.email-row .badges {
    flex-shrink: 0;
    display: flex;
    gap: 6px;
    align-items: center;
}

.email-row .badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
}

.badge-claim { background: #fce8e6; color: #c5221f; }
.badge-policy { background: #e8f0fe; color: #1967d2; }
.badge-quote { background: #e6f4ea; color: #137333; }
.badge-underwriting { background: #fef7e0; color: #b06000; }
.badge-customer { background: #f3e8fd; color: #9334e6; }
.badge-internal { background: #e8eaed; color: #5f6368; }
.badge-marketing { background: #e6f1ff; color: #1967d2; }
.badge-uncategorized { background: #f1f3f4; color: #5f6368; }

/* Pagination */
.pagination {
    padding: 16px 24px;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--primary);
    background: #f1f3f4;
    font-size: 0.9rem;
}

.pagination a:hover {
    background: var(--sidebar-active);
}

.pagination .current {
    background: var(--primary);
    color: white;
}

/* Empty State */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    color: var(--text-muted);
}

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

.empty-state p { margin-bottom: 8px; font-size: 1rem; }

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show { display: flex; }

.modal-sync {
    background: white;
    border-radius: 12px;
    padding: 24px;
    min-width: 400px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-sync h3 { margin-bottom: 16px; color: var(--primary); }

.progress-bar-wrap {
    height: 8px;
    background: #e8eaed;
    border-radius: 4px;
    overflow: hidden;
    margin: 16px 0;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-msg { font-size: 0.9rem; color: var(--text-muted); margin-top: 8px; }

.progress-percent { font-weight: 600; color: var(--primary); }
