:root {
    --primary-color: #4f46e5;
    --secondary-color: #06b6d4;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-bg: #1f2937;
    --light-bg: #f9fafb;
    --border-color: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

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

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

/* Icon alignment fix */
svg {
    vertical-align: middle;
}

.btn svg,
.nav a svg {
    width: 18px;
    height: 18px;
}

/* Loading Spinner */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: white;
    box-shadow: var(--shadow);
    padding: 20px 0;
    margin-bottom: 30px;
    border-radius: 10px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
}

.logo svg {
    width: 28px;
    height: 28px;
}

.nav {
    display: flex;
    gap: 20px;
}

.nav a {
    text-decoration: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav a:hover {
    background: var(--light-bg);
    color: var(--primary-color);
}

/* Card */
.card {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.card-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.card-title svg {
    width: 24px;
    height: 24px;
}

/* Email Box */
.email-box {
    background: var(--primary-color);
    color: white;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    margin-bottom: 30px;
}

.email-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.2);
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.email-address {
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

/* Stats Container */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: white;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 28px;
    height: 28px;
}

.stat-info {
    flex: 1;
}

.stat-info h3 {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 5px 0;
    color: var(--text-primary);
    line-height: 1;
}

.stat-info p {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline-white {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    backdrop-filter: blur(10px);
}

.btn-outline-white:hover {
    background: white;
    color: var(--primary-color);
    transform: translateY(-2px);
}

.btn-outline-white svg {
    stroke: currentColor;
}

.btn-icon {
    padding: 10px;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background: white;
    cursor: pointer;
}

/* Email List */
.email-list {
    list-style: none;
}

.email-item {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.email-item:hover {
    background: var(--light-bg);
    padding-left: 25px;
}

.email-item.unread {
    background: rgba(79, 70, 229, 0.05);
    font-weight: 600;
}

.email-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.email-item-from {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
}

.email-item-date {
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
    text-align: right;
    min-width: 80px;
}

.email-item-subject {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

.email-item-preview {
    color: var(--text-secondary);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.email-detail-header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.email-detail-subject {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 15px;
}

.email-detail-meta {
    display: flex;
    gap: 30px;
    color: var(--text-secondary);
    align-items: center;
}

.email-detail-body {
    line-height: 1.8;
    color: var(--text-primary);
}

/* Notification */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
}

.notification {
    background: white;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification-success {
    border-left: 4px solid var(--success-color);
}

.notification-error {
    border-left: 4px solid var(--danger-color);
}

.notification-warning {
    border-left: 4px solid var(--warning-color);
}

.notification-info {
    border-left: 4px solid var(--secondary-color);
}

.notification svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.notification-success svg {
    color: var(--success-color);
}

.notification-error svg {
    color: var(--danger-color);
}

.notification-warning svg {
    color: var(--warning-color);
}

.notification-info svg {
    color: var(--secondary-color);
}

.notification-message {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
}

.notification-close {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.notification-close:hover {
    background: var(--light-bg);
    color: var(--text-primary);
}

.notification-close svg {
    width: 16px;
    height: 16px;
}

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

.empty-state svg {
    width: 100px;
    height: 100px;
    margin-bottom: 20px;
    color: var(--border-color);
}

.empty-state h3 {
    font-size: 24px;
    margin-bottom: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .email-display {
        flex-direction: column;
    }

    .email-address {
        font-size: 18px;
    }

    .card {
        padding: 20px;
    }

    .email-box {
        padding: 20px;
    }

    .stats-container {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }

    .stat-card {
        padding: 20px 15px;
        gap: 15px;
    }

    .stat-icon {
        width: 50px;
        height: 50px;
    }

    .stat-icon svg {
        width: 24px;
        height: 24px;
    }

    .stat-info h3 {
        font-size: 24px;
    }

    .stat-info p {
        font-size: 12px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 15px;
    }

    .card-header > div {
        width: 100%;
        justify-content: space-between;
    }

    #countdown-display {
        font-size: 13px;
        padding: 6px 12px;
    }

    #countdown-timer {
        font-size: 14px;
    }

    .btn-outline-white {
        padding: 10px 18px;
        font-size: 14px;
    }
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-overlay .modal-content {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-overlay .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-overlay .modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--text-primary);
}

.modal-overlay .modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-secondary);
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay .modal-close:hover {
    color: var(--text-primary);
}

.modal-overlay .modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-overlay .modal-body {
    padding: 20px;
}

.modal-overlay .modal-body .form-group {
    margin-bottom: 16px;
}

.modal-overlay .modal-body .form-group:last-child {
    margin-bottom: 0;
}

/* Countdown Timer */
#countdown-display {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    background: var(--light-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

#countdown-timer {
    font-size: 16px;
    font-weight: bold;
    color: var(--primary-color);
    min-width: 20px;
    text-align: center;
    transition: color 0.3s ease;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.gap-2 { gap: 16px; }

/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.95);
    margin-top: 50px;
    padding: 40px 0 20px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    padding: 0 20px;
    margin-bottom: 30px;
}

.footer-section h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
}

.footer-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 14px;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-links a:hover {
    color: var(--primary-color);
}

.footer-links svg {
    width: 16px;
    height: 16px;
}

.footer-links span {
    color: var(--text-secondary);
    font-size: 14px;
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding: 20px;
    text-align: center;
}

.footer-bottom p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

/* Responsive Footer */
@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .footer {
        margin-top: 30px;
        padding: 30px 0 15px;
    }
}

/* ========== 邮件详情模态框 ========== */
.email-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.email-modal-overlay.active {
    opacity: 1;
}

.email-modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.email-modal-overlay.active .email-modal {
    transform: scale(1);
}

.email-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    gap: 20px;
}

.email-modal-header h2 {
    flex: 1;
    margin: 0;
    font-size: 24px;
    color: var(--text-primary);
    word-break: break-word;
}

.email-modal-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.email-modal-delete,
.email-modal-close {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.email-modal-delete:hover {
    background: #fee;
    color: #dc2626;
}

.email-modal-close:hover {
    background: var(--light-bg);
    color: var(--text-primary);
}

.email-modal-delete svg,
.email-modal-close svg {
    width: 20px;
    height: 20px;
}

.email-modal-meta {
    padding: 20px 24px;
    background: var(--light-bg);
    border-bottom: 1px solid var(--border-color);
}

.email-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.email-meta-item:last-child {
    margin-bottom: 0;
}

.email-meta-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.email-meta-item strong {
    color: var(--text-primary);
    margin-right: 4px;
}

.email-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    line-height: 1.6;
}

.email-modal-body p {
    margin: 0 0 16px 0;
}

.email-modal-body p:last-child {
    margin-bottom: 0;
}

.email-modal-body a {
    color: var(--primary-color);
    text-decoration: none;
}

.email-modal-body a:hover {
    text-decoration: underline;
}

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

/* ========== 删除确认对话框 ========== */
.delete-confirm-modal {
    max-width: 420px;
    padding: 32px;
    text-align: center;
}

.delete-confirm-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fef2f2;
    border-radius: 50%;
    color: #dc2626;
}

.delete-confirm-icon svg {
    width: 32px;
    height: 32px;
}

.delete-confirm-modal h3 {
    margin: 0 0 12px 0;
    font-size: 20px;
    color: var(--text-primary);
}

.delete-confirm-modal p {
    margin: 0 0 24px 0;
    color: var(--text-secondary);
    line-height: 1.5;
}

.delete-confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.delete-confirm-actions button {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 100px;
}

.btn-cancel {
    background: var(--light-bg);
    color: var(--text-primary);
}

.btn-cancel:hover {
    background: #e5e7eb;
}

.btn-delete {
    background: #dc2626;
    color: white;
}

.btn-delete:hover {
    background: #b91c1c;
}

/* 模态框响应式 */
@media (max-width: 768px) {
    .email-modal-overlay {
        padding: 0;
        align-items: stretch;
    }
    
    .email-modal {
        max-height: 100vh;
        border-radius: 0;
        height: 100%;
    }
    
    .email-modal-header {
        padding: 16px;
    }
    
    .email-modal-header h2 {
        font-size: 20px;
    }
    
    .email-modal-meta {
        padding: 16px;
    }
    
    .email-modal-body {
        padding: 16px;
    }
}