* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

input, textarea, [contenteditable="true"], #emailInput, .message-body, .message-body * {
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

::-webkit-scrollbar {
    display: none;
}

* {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

:root {
    --bg-primary: #0a0c0f;
    --bg-secondary: #111316;
    --bg-tertiary: #1a1c21;
    --border: #22262b;
    --text-primary: #e4e7eb;
    --text-secondary: #9aa4b8;
    --text-muted: #6b7280;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-soft: rgba(59, 130, 246, 0.1);
    --card-bg: #111316;
    --toast-bg: #1e1e1e;
    --toast-text: #ffffff;
    --gradient: linear-gradient(135deg, #3b82f6, #8b5cf6);
    --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

body.light {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --border: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-soft: rgba(59, 130, 246, 0.05);
    --card-bg: #ffffff;
    --toast-bg: #1e293b;
    --toast-text: #ffffff;
    --gradient: linear-gradient(135deg, #3b82f6, #8b5cf6);
    --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.logo span {
    color: var(--text-primary);
}

.nav-links {
    display: flex;
    gap: 30px;
    align-items: center;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    transition: all 0.2s;
    position: relative;
}

.nav-links a:hover {
    color: var(--accent);
}

.nav-links a.active {
    color: var(--text-primary);
    font-weight: 500;
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient);
    border-radius: 2px;
}

.server-selector {
    margin-right: 10px;
}

.server-select {
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: 30px;
    padding: 8px 16px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.server-select:hover {
    border-color: var(--accent);
}

.server-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.theme-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 4px;
    display: flex;
    gap: 4px;
}

.theme-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    background: transparent;
    color: var(--text-muted);
    transition: all 0.2s;
}

.theme-btn.active {
    background: var(--accent);
    color: white;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.email-section {
    background: var(--bg-secondary);
    border-radius: 30px;
    padding: 40px;
    border: 1px solid var(--border);
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.email-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient);
}

.email-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.email-label i {
    font-size: 18px;
}

.email-box {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 25px;
}

.email-box input {
    flex: 1;
    min-width: 300px;
    height: 70px;
    padding: 0 25px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
    transition: all 0.3s;
    letter-spacing: 0.5px;
}

.email-box input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.email-box input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 16px;
}

.btn {
    height: 70px;
    padding: 0 35px;
    border: none;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: var(--accent);
}

.btn-primary {
    background: var(--gradient);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: var(--gradient);
    filter: brightness(1.1);
}

.btn-personalizar {
    display: flex;
}

.stats {
    display: flex;
    gap: 40px;
    padding-top: 25px;
    border-top: 2px solid var(--border);
    flex-wrap: wrap;
}

.stat {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.stat-label {
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 500;
}

.stat-value {
    color: var(--accent);
    font-weight: 700;
    font-size: 28px;
}

.status-badge {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #10b981;
    margin-right: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.main-grid {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 30px;
    align-items: start;
}

.inbox-section {
    background: var(--bg-secondary);
    border-radius: 30px;
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.inbox-header {
    padding: 25px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.inbox-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.inbox-header h3 i {
    color: var(--accent);
    font-size: 20px;
}

.message-count {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 6px 16px;
    border-radius: 40px;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid var(--border);
}

.messages {
    max-height: 600px;
    overflow-y: auto;
}

.message-item {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

.message-item:hover {
    background: var(--accent-soft);
    transform: translateX(5px);
}

.message-item.active {
    background: var(--accent-soft);
    border-left: 4px solid var(--accent);
}

.message-subject {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 16px;
}

.message-from {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.message-from i {
    color: var(--accent);
    font-size: 12px;
}

.message-date {
    color: var(--text-muted);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.preview-section {
    background: var(--bg-secondary);
    border-radius: 30px;
    border: 1px solid var(--border);
    padding: 35px;
    min-height: 600px;
    box-shadow: var(--shadow);
    overflow-y: auto;
    max-height: 600px;
}

.empty-preview {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-align: center;
    padding: 60px 20px;
}

.empty-preview i {
    font-size: 64px;
    margin-bottom: 20px;
    color: var(--accent);
    opacity: 0.5;
}

.empty-preview p {
    font-size: 18px;
    font-weight: 500;
}

.message-view {
    color: var(--text-primary);
}

.message-view-header {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 2px solid var(--border);
}

.message-view-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    line-height: 1.3;
}

.message-meta {
    display: flex;
    gap: 30px;
    color: var(--text-secondary);
    font-size: 15px;
    flex-wrap: wrap;
    background: var(--bg-tertiary);
    padding: 15px 20px;
    border-radius: 15px;
}

.message-body {
    line-height: 1.8;
    color: var(--text-secondary);
    font-size: 16px;
    user-select: text;
}

.message-body pre {
    background: var(--bg-tertiary);
    padding: 25px;
    border-radius: 15px;
    overflow-x: auto;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    color: var(--text-primary);
    border: 1px solid var(--border);
    margin: 20px 0;
    user-select: text;
}

.message-body p {
    margin-bottom: 20px;
}

.message-body a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.message-body a:hover {
    text-decoration: underline;
}

.copy-button {
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: 40px;
    padding: 12px 25px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
    transition: all 0.3s;
}

.copy-button:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.copy-button i {
    font-size: 18px;
}

.loading {
    text-align: center;
    padding: 60px;
    color: var(--text-muted);
}

.loading-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--toast-bg);
    color: var(--toast-text);
    padding: 15px 25px;
    border-radius: 50px;
    font-size: 14px;
    box-shadow: var(--shadow);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast i {
    color: var(--accent);
}

@media (max-width: 768px) {
    .main-grid {
        grid-template-columns: 1fr;
    }

    .email-box {
        flex-direction: column;
    }

    .email-box input {
        width: 100%;
        min-width: auto;
        height: 60px;
        font-size: 18px;
    }

    .btn {
        width: 100%;
        justify-content: center;
        height: 60px;
    }

    .nav-container {
        flex-direction: column;
        text-align: center;
    }

    .nav-links {
        justify-content: center;
    }

    .stats {
        justify-content: center;
    }

    .stat-value {
        font-size: 24px;
    }

    .server-selector {
        margin-right: 0;
        width: 100%;
    }
    
    .server-select {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .email-section {
        padding: 30px 20px;
    }

    .preview-section {
        padding: 25px 20px;
    }

    .message-meta {
        flex-direction: column;
        gap: 15px;
    }

    .message-view-title {
        font-size: 22px;
    }
}