:root {
    --bg-dark: #0a0a0f;
    --bg-panel: rgba(20, 20, 28, 0.6);
    --bg-panel-hover: rgba(30, 30, 42, 0.8);
    --border: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(138, 43, 226, 0.4);
    --primary: #9d4edd;
    --primary-hover: #7b2cbf;
    --secondary: rgba(255, 255, 255, 0.1);
    --secondary-hover: rgba(255, 255, 255, 0.15);
    --text-main: #ffffff;
    --text-muted: #a0a0ab;
    --accent: #e0aaff;
    --danger: #ff4d4d;
    --success: #38b000;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

h1, h2, h3, .logo {
    font-family: 'Outfit', sans-serif;
}

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

.glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
}

.glow-1 {
    width: 600px; height: 600px;
    background: #5a189a;
    top: -200px; left: -100px;
}

.glow-2 {
    width: 500px; height: 500px;
    background: #00b4d8;
    bottom: -150px; right: -50px;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 5%;
    border-bottom: 1px solid var(--border);
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-main);
}

.logo i {
    color: var(--primary);
}

.logo .accent {
    color: var(--accent);
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 2rem;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--text-main);
}

/* Layout Container */
.container {
    display: flex;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    gap: 2rem;
    height: calc(100vh - 120px);
}

/* Sidebar */
.sidebar {
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.email-control {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: blur(16px);
}

.email-control h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.email-display-wrapper {
    display: flex;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transition: border-color 0.3s;
}

.email-display-wrapper:focus-within {
    border-color: var(--border-highlight);
}

.email-display-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.875rem 1rem;
    color: var(--accent);
    font-family: 'Inter', monospace;
    font-size: 0.95rem;
    font-weight: 600;
    outline: none;
}

.email-display-wrapper button {
    background: var(--secondary);
    border: none;
    padding: 0 1rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.email-display-wrapper button:hover {
    background: var(--secondary-hover);
    color: var(--text-main);
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.btn {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: none;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

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

.btn.primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(157, 78, 221, 0.3);
}

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

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

.btn.full-width {
    width: 100%;
}

.storage-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(56, 176, 0, 0.1);
    border: 1px solid rgba(56, 176, 0, 0.2);
    border-radius: 12px;
    color: var(--success);
    font-size: 0.85rem;
    font-weight: 500;
}

/* Inbox Section */
.inbox {
    flex: 1;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.refresh-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.refresh-btn:hover {
    background: var(--secondary);
    color: var(--text-main);
}

.refresh-btn.spinning i {
    animation: spin 1s linear infinite;
}

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

.email-list {
    flex: 1;
    overflow-y: auto;
    position: relative;
    padding: 1rem;
}

/* Scrollbar */
.email-list::-webkit-scrollbar { width: 6px; }
.email-list::-webkit-scrollbar-track { background: transparent; }
.email-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

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

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-main);
}

.empty-state span {
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.loader {
    margin-top: 1.5rem;
    width: 24px; height: 24px;
    border: 3px solid var(--secondary);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

/* Email Item (in list) */
.email-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.email-item:hover {
    background: var(--bg-panel-hover);
    border-color: var(--border-highlight);
    transform: translateX(4px);
}

.email-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.email-sender {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.email-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.email-subject {
    font-weight: 500;
    color: var(--accent);
    font-size: 1.05rem;
}

.email-preview {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s forwards;
}

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

.glass-panel {
    background: #14141c;
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    transform: translateY(20px);
    animation: slideUp 0.3s forwards ease-out;
}

.small-modal {
    max-width: 400px;
    padding: 2rem;
}

@keyframes slideUp {
    to { transform: translateY(0); }
}

.close-modal, .close-custom-modal {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
    background: none; border: none;
}

.close-modal:hover, .close-custom-modal:hover {
    color: var(--danger);
}

.modal-header {
    padding: 2rem 2rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    padding-right: 2rem;
}

.modal-meta {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    color: var(--text-main);
    line-height: 1.6;
}

/* Iframe inside modal for safe HTML rendering */
.modal-body iframe {
    width: 100%;
    min-height: 400px;
    border: none;
    background: white; /* Most emails expect a white background */
    border-radius: 8px;
}

/* Form Styles for Custom Modal */
.small-modal h2 { margin-bottom: 0.5rem; }
.small-modal p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }

.input-group {
    display: flex;
    margin-bottom: 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.input-group input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.875rem 1rem;
    color: white;
    outline: none;
}

.domain-addon {
    padding: 0.875rem 1rem;
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    border-left: 1px solid var(--border);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        height: auto;
    }
    .sidebar { width: 100%; }
    .inbox { height: 60vh; }
}
