:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #e0e7ff;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #22c55e;
    --warning: #f59e0b;
    --bg: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --border-light: #475569;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    padding: 30px 0;
}

.logo {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    margin-top: 5px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-tertiary);
    color: var(--text);
}

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

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

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

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

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

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-icon {
    padding: 8px;
    background: transparent;
}

.btn-icon:hover {
    background: var(--bg-tertiary);
}

/* Select */
.select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
}

.select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Email Section */
.email-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid var(--border);
}

.email-display {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.email-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg);
    padding: 15px 20px;
    border-radius: var(--radius);
    border: 2px solid var(--primary);
}

.email-address {
    flex: 1;
    font-size: 1.25rem;
    font-weight: 600;
    font-family: 'SF Mono', 'Fira Code', monospace;
    word-break: break-all;
}

.email-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    justify-content: space-between;
}

.custom-input {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    flex: 1;
    min-width: 200px;
}

.custom-input label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}

.custom-input input[type="checkbox"] {
    cursor: pointer;
}

.input-text {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 14px;
    flex: 1;
    min-width: 150px;
}

.input-text:focus {
    outline: none;
    border-color: var(--primary);
}

.input-text:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.domain-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.domain-selector label {
    color: var(--text-secondary);
    font-size: 14px;
}

.email-timer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
    margin-top: 15px;
    color: var(--text-secondary);
    font-size: 14px;
}

#timer {
    font-weight: 600;
    color: var(--primary);
}

/* Inbox Section */
.inbox-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
}

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

.inbox-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
}

.badge {
    background: var(--primary);
    color: white;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.inbox {
    min-height: 300px;
}

.inbox-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.inbox-empty svg {
    margin-bottom: 15px;
    opacity: 0.5;
}

.inbox-empty p {
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.inbox-empty span {
    font-size: 14px;
}

.inbox-empty.hidden {
    display: none;
}

/* Email List */
.email-list {
    max-height: 500px;
    overflow-y: auto;
}

.email-item {
    display: flex;
    gap: 15px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s ease;
}

.email-item:hover {
    background: var(--bg-tertiary);
}

.email-item.unread {
    background: rgba(99, 102, 241, 0.1);
}

.email-item.unread .email-sender {
    font-weight: 600;
}

.email-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
}

.email-content {
    flex: 1;
    min-width: 0;
}

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

.email-sender {
    font-size: 15px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-date {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    margin-left: 10px;
}

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

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

.email-indicators {
    display: flex;
    gap: 5px;
    margin-top: 5px;
}

.indicator {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.indicator.attachment {
    background: var(--warning);
    color: #000;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
}

.modal-sm {
    max-width: 500px;
}

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

.modal-header h3 {
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 15px;
}

.modal-meta {
    padding: 15px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.meta-row {
    display: flex;
    gap: 10px;
    font-size: 14px;
    margin-bottom: 5px;
}

.meta-row:last-child {
    margin-bottom: 0;
}

.meta-label {
    color: var(--text-muted);
    min-width: 50px;
}

.modal-tabs {
    display: flex;
    gap: 5px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border);
}

.tab {
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius);
    font-size: 14px;
    transition: all 0.2s ease;
}

.tab:hover {
    background: var(--bg-tertiary);
}

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

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.modal-body .email-content {
    display: none;
}

.modal-body .email-content.active {
    display: block;
}

#email-html {
    background: white;
    color: #333;
    padding: 20px;
    border-radius: var(--radius);
    min-height: 200px;
}

#email-html iframe {
    width: 100%;
    min-height: 300px;
    border: none;
}

#email-text {
    white-space: pre-wrap;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 14px;
    background: var(--bg);
    padding: 20px;
    border-radius: var(--radius);
}

.modal-attachments {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
}

.modal-attachments:empty {
    display: none;
}

.attachment-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: var(--radius);
    font-size: 13px;
    margin-right: 10px;
    margin-bottom: 10px;
}

.modal-actions {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

/* Textarea */
.textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 13px;
    resize: vertical;
}

.textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.import-actions {
    margin-top: 15px;
    display: flex;
    justify-content: flex-end;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    background: var(--bg-tertiary);
    color: var(--text);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1001;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--success);
    color: white;
}

.toast.error {
    background: var(--danger);
    color: white;
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-muted);
    font-size: 14px;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 15px;
    }

    .logo {
        font-size: 2rem;
    }

    .email-address {
        font-size: 1rem;
    }

    .email-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .domain-selector {
        flex-direction: column;
        align-items: stretch;
    }

    .email-item {
        padding: 12px 15px;
    }

    .email-avatar {
        width: 40px;
        height: 40px;
    }

    .modal-content {
        max-height: 100vh;
        border-radius: 0;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Loading animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}
