/* style.css - EZx Mail 主样式表 */

:root {
    /* 颜色系统 */
    --primary-color: #1a73e8;
    --primary-hover: #1557b0;
    --primary-light: rgba(26, 115, 232, 0.1);
    --secondary-color: #5f6368;
    --success-color: #34a853;
    --warning-color: #fbbc04;
    --danger-color: #ea4335;
    
    /* 背景色 */
    --bg-primary: #ffffff;
    --bg-secondary: #f6f8fc;
    --bg-hover: #f1f3f4;
    --bg-active: #e8f0fe;
    
    /* 文字颜色 */
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --text-tertiary: #80868b;
    
    /* 边框 */
    --border-color: #e0e0e0;
    --border-radius: 8px;
    --border-radius-lg: 16px;
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
    --shadow-md: 0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15);
    --shadow-lg: 0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 8px 16px 4px rgba(60, 64, 67, 0.15);
    
    /* 尺寸 */
    --header-height: 64px;
    --sidebar-width: 256px;
    --sidebar-collapsed-width: 72px;
}

/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
}

/* 应用容器 */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ==================== 顶部导航栏 ==================== */
.header {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    height: var(--header-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    width: var(--sidebar-width);
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
}

.logo-icon {
    font-size: 32px;
    color: var(--primary-color);
}

.logo-text {
    font-size: 22px;
    font-weight: 400;
    color: var(--text-secondary);
}

.search-bar {
    flex: 1;
    max-width: 720px;
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border-radius: 24px;
    padding: 0 16px;
    height: 48px;
    transition: all 0.3s ease;
}

.search-bar:focus-within {
    background: var(--bg-primary);
    box-shadow: var(--shadow-md);
}

.search-bar .search-icon {
    color: var(--text-secondary);
    margin-right: 12px;
}

.search-bar input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    outline: none;
    color: var(--text-primary);
}

.search-bar input::placeholder {
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    padding-left: 16px;
}

/* 图标按钮 */
.icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: var(--bg-hover);
}

.icon-btn:active {
    background: var(--bg-active);
}

/* 用户头像 */
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #667eea);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-left: 8px;
}

/* ==================== 主体区域 ==================== */
.main-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ==================== 侧边栏 ==================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-primary);
    padding: 16px 0;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    transition: width 0.3s ease;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .compose-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .badge,
.sidebar.collapsed .nav-section-title {
    display: none;
}

/* 撰写按钮 */
.compose-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 16px 16px;
    padding: 16px 24px;
    background: var(--bg-primary);
    border: none;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.compose-btn:hover {
    box-shadow: var(--shadow-md);
    background: var(--bg-secondary);
}

.compose-btn .material-icons {
    font-size: 24px;
    color: var(--text-primary);
}

.sidebar.collapsed .compose-btn {
    padding: 16px;
    justify-content: center;
    margin: 0 12px 16px;
}

/* 导航菜单 */
.nav-menu {
    display: flex;
    flex-direction: column;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 24px;
    margin: 2px 8px;
    border-radius: 0 24px 24px 0;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: var(--bg-hover);
}

.nav-item.active {
    background: var(--bg-active);
    color: var(--primary-color);
}

.nav-item.active .material-icons {
    color: var(--primary-color);
}

.nav-item .material-icons {
    font-size: 20px;
    color: var(--text-secondary);
}

.badge {
    margin-left: auto;
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.nav-divider {
    height: 1px;
    background: var(--border-color);
    margin: 12px 0;
}

.nav-section-title {
    padding: 12px 24px 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.label-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.nav-more {
    display: none;
}

.nav-more.show {
    display: block;
}

/* ==================== 主内容区 ==================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    margin: 16px 16px 16px 0;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

/* 工具栏 */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
    min-height: 52px;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-info {
    font-size: 12px;
    color: var(--text-secondary);
    margin-right: 8px;
}

/* 复选框 */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    cursor: pointer;
}

.checkbox-wrapper input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

/* ==================== 邮件列表 ==================== */
.email-list {
    flex: 1;
    overflow-y: auto;
}

.email-item {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.email-item:hover {
    box-shadow: inset 3px 0 0 var(--primary-color), 0 1px 4px rgba(0, 0, 0, 0.1);
}

.email-item.unread {
    background: var(--bg-secondary);
    font-weight: 500;
}

.email-item.selected {
    background: var(--bg-active);
}

.email-checkbox {
    margin-right: 12px;
}

.email-star {
    margin-right: 12px;
    color: var(--text-tertiary);
    cursor: pointer;
}

.email-star.starred {
    color: var(--warning-color);
}

.email-star:hover {
    color: var(--warning-color);
}

.email-sender {
    width: 200px;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-content {
    flex: 1;
    display: flex;
    overflow: hidden;
    margin: 0 16px;
}

.email-subject {
    font-size: 14px;
    margin-right: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-snippet {
    color: var(--text-secondary);
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-date {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* 空状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
}

.empty-state .material-icons {
    font-size: 64px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 400;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
}

/* ==================== 撰写邮件模态框 ==================== */
.compose-modal {
    position: fixed;
    bottom: 0;
    right: 24px;
    width: 500px;
    background: var(--bg-primary);
    border-radius: 12px 12px 0 0;
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

.compose-modal.show {
    display: flex;
}

.compose-modal.minimized {
    height: 48px;
    overflow: hidden;
}

.compose-modal.fullscreen {
    width: 100%;
    height: 100%;
    right: 0;
    border-radius: 0;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.compose-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--text-primary);
    color: white;
    border-radius: 12px 12px 0 0;
    cursor: move;
}

.compose-header span {
    font-size: 14px;
    font-weight: 500;
}

.compose-actions {
    display: flex;
    gap: 4px;
}

.compose-actions .icon-btn {
    width: 32px;
    height: 32px;
    color: white;
}

.compose-actions .icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.compose-body {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.compose-field {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
}

.compose-field label {
    font-size: 14px;
    color: var(--text-secondary);
    min-width: 60px;
}

.compose-field input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    padding: 4px 0;
}

.compose-content {
    flex: 1;
    min-height: 200px;
}

.compose-content textarea {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    resize: none;
    padding: 16px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.6;
}

.compose-footer {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
}

.send-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.send-btn:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-sm);
}

.send-btn .material-icons {
    font-size: 18px;
}

.compose-tools {
    display: flex;
    gap: 4px;
    margin-left: 16px;
}

.delete-draft {
    margin-left: auto;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: -100%;
        top: var(--header-height);
        height: calc(100vh - var(--header-height));
        z-index: 99;
        transition: left 0.3s ease;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .search-bar {
        max-width: none;
        margin: 0 16px;
    }
    
    .header-left {
        width: auto;
    }
    
    .logo-text {
        display: none;
    }
    
    .compose-modal {
        width: 100%;
        right: 0;
    }
    
    .email-sender {
        width: 120px;
    }
}

/* ==================== 动画效果 ==================== */
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 刷新按钮旋转动画 */
.icon-btn.spinning .material-icons {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 骨架屏加载效果 */
.skeleton {
    background: linear-gradient(90deg, var(--bg-hover) 25%, var(--bg-secondary) 50%, var(--bg-hover) 75%);
    background-size: 200% 100%;
    animation: skeleton 1.5s ease-in-out infinite;
}

@keyframes skeleton {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}
