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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* Login Page */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-container h1 {
    text-align: center;
    margin-bottom: 10px;
    color: #667eea;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e1e1;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary {
    width: 100%;
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f1f1f1;
    color: #333;
}

.btn-secondary:hover {
    background: #e1e1e1;
}

.error-message {
    color: #e74c3c;
    font-size: 13px;
    margin-top: 15px;
    text-align: center;
    display: none;
}

.error-message.show {
    display: block;
}

/* Email List Page */
.header {
    background: white;
    padding: 20px 40px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 24px;
    color: #667eea;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

#user-info {
    color: #666;
    font-size: 14px;
}

.content {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.email-stats {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    gap: 30px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
}

.email-list {
    background: white;
    border-radius: 10px;
    overflow: hidden;
}

.email-item {
    padding: 20px;
    border-bottom: 1px solid #f1f1f1;
    cursor: pointer;
    transition: background 0.2s;
}

.email-item:hover {
    background: #f9f9f9;
}

.email-item:last-child {
    border-bottom: none;
}

.email-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.email-from {
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

.email-date {
    color: #999;
    font-size: 13px;
}

.email-subject {
    font-size: 14px;
    color: #555;
    margin-bottom: 8px;
}

.email-preview {
    font-size: 13px;
    color: #999;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-badges {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.badge {
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
}

.badge-dkim-pass {
    background: #d4edda;
    color: #155724;
}

.badge-dkim-fail {
    background: #f8d7da;
    color: #721c24;
}

.badge-dkim-neutral {
    background: #fff3cd;
    color: #856404;
}

.badge-spf-pass {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-spf-fail {
    background: #f8d7da;
    color: #721c24;
}

.badge-attachment {
    background: #e7e7e7;
    color: #555;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.pagination button {
    padding: 8px 16px;
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
}

.pagination button:hover:not(:disabled) {
    background: #667eea;
    color: white;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination .page-info {
    padding: 8px 16px;
    background: white;
    border-radius: 5px;
    color: #666;
}

/* Email Detail Page */
.email-detail {
    background: white;
    border-radius: 10px;
    padding: 30px;
}

.detail-header {
    border-bottom: 2px solid #f1f1f1;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.detail-subject {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

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

.detail-label {
    color: #666;
    font-weight: 500;
}

.detail-value {
    color: #333;
}

.detail-body {
    margin-top: 30px;
    line-height: 1.6;
}

.body-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    border-bottom: 2px solid #f1f1f1;
}

.body-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.body-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.body-content {
    padding: 20px;
    background: #f9f9f9;
    border-radius: 5px;
    min-height: 200px;
}

.body-plain {
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 13px;
}

.body-html iframe {
    width: 100%;
    min-height: 400px;
    border: none;
    background: white;
}

.detail-attachments {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #f1f1f1;
}

.attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.attachment-item {
    padding: 10px 15px;
    background: #f1f1f1;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.attachment-item:hover {
    background: #e1e1e1;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.no-emails {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.no-emails h3 {
    font-size: 18px;
    margin-bottom: 10px;
}
