* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #1a1a1a;
    --bg-darker: #0f0f0f;
    --bg-card: #252525;
    --bg-card-hover: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --accent-purple: #8b5cf6;
    --accent-purple-hover: #7c3aed;
    --border-color: #333333;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.hidden {
    display: none !important;
}

/* Login Container */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 100%;
}

.login-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.login-card h2 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 24px;
}

.login-card p {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 14px;
}

/* App Container */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    font-size: 32px;
}

.app-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    color: var(--text-primary);
}

.btn-primary {
    background: var(--accent-purple);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-purple-hover);
}

.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
}

.btn-purple {
    background: var(--accent-purple);
    color: white;
    padding: 10px 24px;
}

.btn-purple:hover {
    background: var(--accent-purple-hover);
}

.btn-small {
    padding: 6px 14px;
    font-size: 13px;
}

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}

.search-container {
    flex: 1;
    max-width: 500px;
}

.search-input {
    width: 100%;
    padding: 10px 15px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-purple);
    background: var(--bg-card-hover);
}

.search-input::placeholder {
    color: var(--text-muted);
}

/* Loading */
.loading {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--accent-purple);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Email List */
.email-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.email-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.email-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-purple);
    transform: translateX(4px);
}

.email-item.unread {
    border-left: 3px solid var(--accent-purple);
}

.email-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
}

.email-content {
    flex: 1;
    min-width: 0;
}

.email-from {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-from-address {
    color: var(--text-secondary);
    font-weight: normal;
}

.email-subject {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-preview {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    margin-top: 4px;
}

.email-date {
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
    padding-top: 2px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 16px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-darker);
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    color: var(--text-primary);
    flex: 1;
    margin-right: 20px;
    font-size: 20px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 32px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.modal-body {
    padding: 28px;
}

.email-meta {
    background: var(--bg-darker);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.email-meta p {
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 14px;
}

.email-meta p:last-child {
    margin-bottom: 0;
}

.email-meta strong {
    color: var(--text-primary);
    margin-right: 8px;
}

.email-body {
    color: var(--text-primary);
    line-height: 1.8;
    font-size: 15px;
}

.email-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 15px 0;
}

.email-body pre {
    background: var(--bg-darker);
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    border: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        padding: 15px;
    }

    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-container {
        max-width: 100%;
    }

    .email-row {
        flex-direction: column;
    }

    .email-date {
        align-self: flex-start;
        margin-top: 8px;
    }

    .modal-content {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }
}
