/* ============================================================
   TempMail - Modern Dark Mode Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---- CSS Variables ---- */
:root {
    --bg-primary: #0a0a12;
    --bg-secondary: #12121e;
    --bg-card: rgba(22, 22, 38, 0.85);
    --bg-card-hover: rgba(30, 30, 50, 0.95);
    --bg-input: rgba(18, 18, 30, 0.9);
    --border-color: rgba(255, 255, 255, 0.06);
    --border-glow: rgba(138, 92, 246, 0.3);
    --text-primary: #f0f0f5;
    --text-secondary: #8888a4;
    --text-muted: #55556a;
    --accent-purple: #8b5cf6;
    --accent-purple-light: #a78bfa;
    --accent-green: #10b981;
    --accent-green-light: #34d399;
    --accent-pink: #f43f5e;
    --accent-pink-light: #fb7185;
    --accent-blue: #3b82f6;
    --accent-orange: #f59e0b;
    --gradient-purple: linear-gradient(135deg, #8b5cf6, #6d28d9);
    --gradient-green: linear-gradient(135deg, #10b981, #059669);
    --gradient-pink: linear-gradient(135deg, #f43f5e, #e11d48);
    --gradient-blue: linear-gradient(135deg, #3b82f6, #2563eb);
    --gradient-mixed: linear-gradient(135deg, #8b5cf6, #6d28d9, #4f46e5);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ---- Background decoration ---- */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    right: -30%;
    width: 80vw;
    height: 80vw;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.06) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    bottom: -40%;
    left: -20%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.04) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* ---- Container ---- */
.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

/* ---- Header ---- */
.header {
    text-align: center;
    padding: 40px 0 10px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 8px 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--accent-green);
    backdrop-filter: blur(10px);
    margin-bottom: 20px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    50% { opacity: 0.8; box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

.header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-purple-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
}

.header p.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 400;
}

/* ---- Email Card ---- */
.email-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 28px;
    margin: 24px 0;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.email-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle at top right, rgba(139, 92, 246, 0.08), transparent 70%);
    pointer-events: none;
}

.email-card-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent-green);
    margin-bottom: 16px;
}

.email-display {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-bottom: 14px;
    transition: var(--transition);
}

.email-display:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
}

.email-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-purple);
    border-radius: var(--radius-sm);
    margin-right: 14px;
    flex-shrink: 0;
}

.email-icon svg {
    width: 18px;
    height: 18px;
    fill: white;
}

.email-text {
    flex: 1;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-primary);
    word-break: break-all;
    letter-spacing: -0.01em;
}

.copy-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-purple);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
    position: relative;
}

.copy-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 0 16px rgba(139, 92, 246, 0.4);
}

.copy-btn:active {
    transform: scale(0.95);
}

.copy-btn svg {
    width: 18px;
    height: 18px;
    fill: white;
}

.copy-tooltip {
    position: absolute;
    top: -32px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-green);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.copy-tooltip.show {
    opacity: 1;
    top: -38px;
}

/* Domain & Timer info */
.email-info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.domain-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 50px;
    padding: 6px 14px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--accent-green);
}

.domain-badge svg {
    width: 14px;
    height: 14px;
    fill: var(--accent-green);
}

.timer-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 50px;
    padding: 6px 14px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--accent-orange);
}

.timer-badge svg {
    width: 14px;
    height: 14px;
    fill: var(--accent-orange);
}

/* Action buttons */
.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-purple {
    background: var(--gradient-purple);
    color: white;
    flex: 1;
    min-width: 140px;
}

.btn-purple:hover {
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}

.btn-green {
    background: transparent;
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-green:hover {
    background: rgba(16, 185, 129, 0.1);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.2);
}

.btn-pink {
    background: var(--gradient-pink);
    color: white;
}

.btn-pink:hover {
    box-shadow: 0 4px 20px rgba(244, 63, 94, 0.4);
}

.btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* ---- Custom Email Modal ---- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 32px;
    width: 90%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
}

.custom-email-form {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
}

.custom-email-form input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-right: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    padding: 14px 16px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.custom-email-form input:focus {
    border-color: var(--accent-purple);
}

.custom-email-form input::placeholder {
    color: var(--text-muted);
}

.domain-select {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    padding: 14px 16px;
    color: var(--accent-purple);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%238b5cf6'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 30px;
    min-width: 140px;
}

.domain-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-actions {
    display: flex;
    gap: 10px;
}

.modal-actions .btn {
    flex: 1;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
}

.error-msg {
    color: var(--accent-pink);
    font-size: 0.8rem;
    margin-bottom: 12px;
    display: none;
}

/* ---- Inbox Section ---- */
.inbox-section {
    margin: 30px 0 40px;
}

.inbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.inbox-title {
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.inbox-count {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.clear-btn {
    background: none;
    border: none;
    color: var(--accent-blue);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    padding: 4px 8px;
    border-radius: 6px;
}

.clear-btn:hover {
    background: rgba(59, 130, 246, 0.1);
}

/* Email list */
.email-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.email-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.email-item:hover {
    border-color: var(--border-glow);
    background: var(--bg-card-hover);
    transform: translateX(4px);
}

.email-item-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-blue);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    margin-top: 2px;
}

.email-item-icon svg {
    width: 18px;
    height: 18px;
    fill: white;
}

.email-item-content {
    flex: 1;
    min-width: 0;
}

.email-item-from {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.email-item-subject {
    font-size: 0.82rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.email-item-time {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.email-item-delete {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
    flex-shrink: 0;
}

.email-item-delete:hover {
    background: rgba(244, 63, 94, 0.1);
    color: var(--accent-pink);
}

.email-item-delete svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 50px 20px;
}

.empty-state svg {
    width: 56px;
    height: 56px;
    fill: var(--text-muted);
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ---- Email Detail Modal ---- */
.email-detail-modal .modal {
    max-width: 640px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.email-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.email-detail-header h3 {
    margin-bottom: 0;
    text-align: left;
    flex: 1;
    font-size: 1.1rem;
}

.email-detail-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.email-detail-close:hover {
    background: rgba(244, 63, 94, 0.1);
    color: var(--accent-pink);
    border-color: rgba(244, 63, 94, 0.3);
}

.email-detail-close svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.email-detail-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.email-detail-meta-item {
    display: flex;
    gap: 10px;
    font-size: 0.82rem;
}

.email-detail-meta-item .label {
    color: var(--text-muted);
    font-weight: 500;
    min-width: 50px;
}

.email-detail-meta-item .value {
    color: var(--text-secondary);
    word-break: break-all;
}

.email-detail-toggle {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.toggle-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.toggle-btn.active {
    background: var(--gradient-purple);
    color: white;
}

.email-detail-body {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-secondary);
    min-height: 200px;
}

.email-detail-body iframe {
    width: 100%;
    min-height: 300px;
    border: none;
    background: white;
    border-radius: var(--radius-sm);
}

/* ---- Footer ---- */
.footer {
    text-align: center;
    padding: 30px 0 40px;
    border-top: 1px solid var(--border-color);
    margin-top: 20px;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 6px;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--accent-purple-light);
    background: rgba(139, 92, 246, 0.08);
}

.footer-links .sep {
    color: var(--text-muted);
    font-size: 0.6rem;
}

.footer p {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ---- Loading spinner ---- */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-purple);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- Toast notifications ---- */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    z-index: 2000;
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    border-color: rgba(16, 185, 129, 0.3);
}

.toast.error {
    border-color: rgba(244, 63, 94, 0.3);
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .container {
        padding: 0 16px;
    }

    .header {
        padding: 30px 0 10px;
    }

    .header h1 {
        font-size: 1.6rem;
    }

    .email-card {
        padding: 20px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .email-display {
        padding: 12px 14px;
    }

    .email-text {
        font-size: 0.88rem;
    }

    .modal {
        padding: 24px;
        margin: 16px;
        width: calc(100% - 32px);
    }

    .custom-email-form {
        flex-direction: column;
        gap: 8px;
    }

    .custom-email-form input {
        border-right: 1px solid var(--border-color);
        border-radius: var(--radius-md);
    }

    .domain-select {
        border-radius: var(--radius-md);
        width: 100%;
    }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ---- Selection ---- */
::selection {
    background: rgba(139, 92, 246, 0.3);
    color: white;
}
