/* Minimal CSS for Duck Temp Email */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #fafafa;
    --card: #fff;
    --text: #222;
    --muted: #666;
    --border: #ddd;
    --accent: #de5833;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-size: 14px;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 16px;
}

/* Header */
.header {
    padding: 12px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
}

/* Buttons */
.btn {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--card);
    cursor: pointer;
    font-size: 13px;
}

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

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

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
    background: #c44d2b;
}

.btn-icon {
    padding: 6px 10px;
}

.hidden {
    display: none !important;
}

/* Address Section */
.address-section {
    background: var(--card);
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 16px;
}

.address-section > label {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
}

.address-display {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.address-display input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: monospace;
    font-size: 14px;
    background: var(--bg);
}

.address-actions {
    display: flex;
    gap: 8px;
}

/* Inbox */
.inbox-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.inbox-section h2 {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.email-count {
    color: var(--muted);
    font-weight: normal;
}

.email-list {
    max-height: 400px;
    overflow-y: auto;
}

.empty-inbox {
    padding: 40px 16px;
    text-align: center;
    color: var(--muted);
}

.email-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

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

.email-item:last-child {
    border-bottom: none;
}

.email-item.unread {
    background: #fffbf9;
}

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

.email-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.email-time {
    font-size: 11px;
    color: var(--muted);
}

.email-duck-badge {
    font-size: 11px;
    color: var(--accent);
    background: #fff3e0;
    padding: 2px 6px;
    border-radius: 3px;
}

.email-from {
    font-size: 13px;
    margin-bottom: 2px;
}

.email-from-name {
    font-weight: 500;
}

.email-subject {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-excerpt {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.email-attachment-badge {
    font-size: 11px;
    margin-left: 6px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 20px;
}

.modal-content {
    background: var(--card);
    border-radius: 6px;
    width: 100%;
    max-width: 900px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 15px;
    font-weight: 600;
    word-break: break-word;
    padding-right: 12px;
}

.modal-meta {
    padding: 8px 16px;
    background: var(--bg);
    font-size: 12px;
    flex-shrink: 0;
}

.meta-row {
    display: flex;
    margin-bottom: 3px;
}

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

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

.meta-value {
    word-break: break-all;
}

.meta-value.email-address {
    font-family: monospace;
    font-size: 11px;
    color: var(--accent);
}

.modal-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-body iframe {
    width: 100%;
    height: 100%;
    min-height: 500px;
    border: none;
}

.modal-body pre {
    padding: 16px;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Attachments */
.attachments-section {
    padding: 10px 16px;
    background: var(--bg);
    border-top: 1px solid var(--border);
}

.attachments-section h4 {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 8px;
}

.attachments-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text);
    font-size: 12px;
}

.attachment-item:hover {
    border-color: var(--accent);
}

.attachment-icon {
    font-size: 14px;
}

.attachment-name {
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-size {
    font-size: 10px;
    color: var(--muted);
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

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

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

.loading-overlay p {
    margin-top: 10px;
    color: var(--muted);
    font-size: 13px;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 300;
}

.toast {
    padding: 10px 14px;
    border-radius: 4px;
    margin-top: 8px;
    color: #fff;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.toast.success {
    background: #28a745;
}

.toast.error {
    background: #dc3545;
}

.toast.warning {
    background: #ffc107;
    color: #222;
}

/* Responsive */
@media (max-width: 500px) {
    .container {
        padding: 12px;
    }
    
    .address-actions {
        flex-direction: column;
    }
    
    .modal-content {
        max-height: 90vh;
    }
}
