:root {
    --bg-dark: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-1: #8b5cf6;
    --accent-2: #3b82f6;
    --accent-glow: rgba(139, 92, 246, 0.5);
    --danger: #ef4444;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Animated Background Orbs */
.background-orbs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 20s infinite alternate;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--accent-1);
    top: -10%;
    left: -10%;
    animation-delay: 0s;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: var(--accent-2);
    bottom: 10%;
    right: -5%;
    animation-delay: -5s;
    animation-direction: alternate-reverse;
}

.orb-3 {
    width: 250px;
    height: 250px;
    background: #ec4899;
    top: 40%;
    left: 40%;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(100px, 100px) scale(1.2); }
}

/* Layout Containers */
.app-container {
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Header Section */
.header-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-area h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(to right, var(--accent-1), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.email-control {
    display: flex;
    align-items: center;
    gap: 16px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 4px 4px 4px 16px;
    width: 350px;
    transition: all 0.3s ease;
}

.input-wrapper:hover {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 10px rgba(255,255,255,0.05);
}

.input-wrapper input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'Outfit', monospace;
    font-size: 1.1rem;
    width: 100%;
    outline: none;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.primary-btn {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    border: none;
    border-radius: 8px;
    color: white;
    padding: 10px 20px;
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.primary-btn:active {
    transform: translateY(0);
}

.special-btn {
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
}
.special-btn:hover {
    box-shadow: 0 6px 20px rgba(236, 72, 153, 0.6);
}

/* Main Content Area */
.main-content {
    display: flex;
    gap: 20px;
    flex: 1;
    min-height: 0;
}

.accounts-list, .inbox-list {
    width: 300px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.accounts-header, .inbox-header {
    padding: 20px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accounts-header h2, .inbox-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.accounts-container, .messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.accounts-container::-webkit-scrollbar, .messages-container::-webkit-scrollbar {
    width: 6px;
}
.accounts-container::-webkit-scrollbar-thumb, .messages-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    gap: 16px;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-1);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.account-item, .email-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.account-item:hover, .email-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.account-item.active, .email-item.active {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.4);
}

.account-address {
    font-family: 'Outfit', monospace;
    font-size: 0.9rem;
    color: var(--text-primary);
    word-break: break-all;
    margin-bottom: 8px;
}

.account-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.account-badge {
    font-size: 0.75rem;
    background: rgba(255,255,255,0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.email-sender {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-subject {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-time {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    text-align: right;
}

/* Email Viewer */
.email-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.email-content-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    gap: 16px;
}

.email-header-view {
    padding: 24px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
}

.view-subject {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.view-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.view-meta span.sender {
    color: var(--text-primary);
    font-weight: 500;
    background: rgba(255,255,255,0.1);
    padding: 4px 8px;
    border-radius: 4px;
}

.email-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    font-size: 1rem;
    line-height: 1.6;
    color: #e2e8f0;
}

iframe.email-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white; /* Emails usually expect a white bg */
    border-radius: 8px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--accent-1);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 900px) {
    .app-container { height: 100vh; width: 100%; border-radius: 0; gap: 10px; padding: 10px; }
    .header-panel { flex-direction: column; gap: 16px; padding: 16px; }
    .email-control { width: 100%; flex-direction: column; }
    .input-wrapper { width: 100%; }
    .primary-btn { width: 100%; justify-content: center; }
    .main-content { flex-direction: column; }
    .accounts-list, .inbox-list { width: 100%; height: 250px; flex: none; }
}
