/* ============================================
   TempMail — Premium Design System
   ============================================ */

/* --- CSS Variables --- */
:root {
    --primary-h: 230;
    --primary-s: 76%;
    --primary-l: 63%;
    --primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
    --primary-dark: hsl(var(--primary-h), var(--primary-s), 50%);
    --primary-glow: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.35);
    --accent: #4facfe;
    --accent-glow: rgba(79, 172, 254, 0.3);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-accent: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-danger: linear-gradient(135deg, #f5576c 0%, #ff6b6b 100%);
    --gradient-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --bg-body: #080c1a;
    --bg-surface: rgba(255, 255, 255, 0.04);
    --bg-surface-hover: rgba(255, 255, 255, 0.07);
    --bg-glass: rgba(255, 255, 255, 0.06);
    --bg-glass-strong: rgba(255, 255, 255, 0.1);
    --text-primary: #f0f0f8;
    --text-secondary: #a0a0c0;
    --text-muted: #5a5a7a;
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.16);
    --border-active: rgba(102, 126, 234, 0.5);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 60px var(--primary-glow);
    --shadow-glow-accent: 0 0 40px var(--accent-glow);
    --sp-xs: 0.375rem;
    --sp-sm: 0.75rem;
    --sp-md: 1.25rem;
    --sp-lg: 2rem;
    --sp-xl: 3rem;
    --sp-2xl: 4.5rem;
    --r-sm: 8px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 28px;
    --r-full: 100px;
    --t-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.bg-wrapper { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.bg-orb { position: absolute; border-radius: 50%; filter: blur(120px); opacity: 0.5; animation: orbFloat 20s ease-in-out infinite; }
.bg-orb--1 { width: 600px; height: 600px; background: radial-gradient(circle, rgba(102,126,234,0.35), transparent 70%); top: -10%; left: -5%; }
.bg-orb--2 { width: 500px; height: 500px; background: radial-gradient(circle, rgba(118,75,162,0.3), transparent 70%); bottom: -10%; right: -5%; animation-delay: -7s; }
.bg-orb--3 { width: 400px; height: 400px; background: radial-gradient(circle, rgba(79,172,254,0.2), transparent 70%); top: 40%; left: 50%; transform: translateX(-50%); animation-delay: -14s; }
.bg-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px); background-size: 60px 60px; }
@keyframes orbFloat { 0%,100% { transform: translate(0,0) scale(1); } 25% { transform: translate(30px,-40px) scale(1.05); } 50% { transform: translate(-20px,20px) scale(0.95); } 75% { transform: translate(40px,30px) scale(1.02); } }

.container { max-width: 1280px; margin: 0 auto; padding: 0 var(--sp-lg); }

.header { position: sticky; top: 0; z-index: 100; padding: var(--sp-md) 0; background: rgba(8,12,26,0.75); backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%); border-bottom: 1px solid var(--border); }
.header__inner { display: flex; justify-content: space-between; align-items: center; }
.logo { display: flex; align-items: center; gap: var(--sp-sm); text-decoration: none; }
.logo__icon { width: 40px; height: 40px; background: var(--gradient-primary); border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; color: white; box-shadow: var(--shadow-sm), 0 0 20px var(--primary-glow); transition: transform var(--t-base), box-shadow var(--t-base); }
.logo__icon .logo__svg { width: 22px; height: 22px; }
.logo:hover .logo__icon { transform: scale(1.08) rotate(-3deg); box-shadow: var(--shadow-md), 0 0 30px var(--primary-glow); }
.logo__text { font-size: 1.4rem; font-weight: 800; background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.header__nav { display: flex; align-items: center; gap: var(--sp-sm); }
.header__badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: var(--r-full); background: var(--bg-glass); border: 1px solid var(--border); color: var(--text-secondary); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.3px; transition: all var(--t-base); }
.header__badge:hover { background: var(--bg-glass-strong); border-color: var(--border-hover); color: var(--text-primary); }

.main { padding: var(--sp-xl) 0 var(--sp-2xl); min-height: calc(100vh - 180px); }
.hero { text-align: center; margin-bottom: var(--sp-2xl); animation: fadeInUp 0.7s ease both; }
.hero__title { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 900; line-height: 1.15; background: linear-gradient(135deg, #667eea, #4facfe, #764ba2); background-size: 200% auto; -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; animation: shimmer 4s linear infinite; margin-bottom: var(--sp-md); }
@keyframes shimmer { 0% { background-position: 0% center; } 100% { background-position: 200% center; } }

.app-layout { display: grid; grid-template-columns: 420px 1fr; gap: var(--sp-lg); align-items: start; animation: fadeInUp 0.7s ease 0.2s both; }
.panel--generator { display: flex; flex-direction: column; gap: var(--sp-lg); position: sticky; top: 100px; }

.card { background: var(--bg-glass); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-lg); backdrop-filter: blur(16px) saturate(150%); -webkit-backdrop-filter: blur(16px) saturate(150%); transition: all var(--t-slow); }
.card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-md); }
.card--generator:hover { box-shadow: var(--shadow-md), var(--shadow-glow); }
.card--inbox { min-height: 500px; display: flex; flex-direction: column; }
.card__header { margin-bottom: var(--sp-lg); }
.card__header--inbox { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--sp-sm); }
.card__title { display: flex; align-items: center; gap: var(--sp-sm); font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }

.email-display { margin-bottom: var(--sp-lg); }
.email-display__label { display: block; font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: var(--sp-xs); }
.email-display__box { display: flex; align-items: center; gap: var(--sp-sm); padding: var(--sp-md); background: rgba(102,126,234,0.08); border: 2px solid rgba(102,126,234,0.3); border-radius: var(--r-md); transition: all var(--t-base); }
.email-display__box:hover { background: rgba(102,126,234,0.12); border-color: rgba(102,126,234,0.5); box-shadow: 0 0 30px rgba(102,126,234,0.15); }
.email-display__address { flex: 1; font-size: 1rem; font-weight: 700; color: var(--text-primary); word-break: break-all; }

.email-form { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-md); margin-bottom: var(--sp-lg); }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 0.78rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.form-input-wrapper { position: relative; }
.form-input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; transition: color var(--t-base); }
.form-input, .form-select { width: 100%; background: rgba(255,255,255,0.04); border: 1.5px solid var(--border); border-radius: var(--r-sm); padding: 12px 14px 12px 40px; color: var(--text-primary); font-size: 0.92rem; font-weight: 500; font-family: inherit; transition: all var(--t-base); }
.form-input::placeholder { color: var(--text-muted); }
.form-input:hover, .form-select:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.06); }
.form-input:focus, .form-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(102,126,234,0.15); background: rgba(255,255,255,0.06); }
.form-select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667eea' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 40px; }
.form-select option { background: #1a1a2e; color: var(--text-primary); }
.form-select--full { padding-left: 14px; }
.form-hint { font-size: 0.72rem; color: var(--text-muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-xs); border: none; font-family: inherit; font-weight: 700; cursor: pointer; border-radius: var(--r-md); transition: all var(--t-base); text-decoration: none; position: relative; overflow: hidden; }
.btn--primary { background: var(--gradient-primary); color: white; padding: 14px var(--sp-lg); font-size: 1rem; width: 100%; box-shadow: var(--shadow-sm), 0 0 20px var(--primary-glow); }
.btn--primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-md), 0 0 40px var(--primary-glow); }
.btn--primary:active { transform: translateY(0) scale(0.98); }
.btn--primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn--danger { background: var(--gradient-danger); color: white; padding: 10px var(--sp-md); font-size: 0.85rem; margin-top: var(--sp-sm); }
.btn--danger:hover { transform: translateY(-1px); box-shadow: 0 0 20px rgba(245,87,108,0.3); }
.btn--ghost { background: var(--bg-glass); color: var(--text-secondary); border: 1px solid var(--border); padding: 8px 12px; }
.btn--ghost:hover { background: var(--bg-glass-strong); color: var(--text-primary); border-color: var(--border-hover); }
.btn--sm { padding: 8px 14px; font-size: 0.82rem; border-radius: var(--r-sm); }
.btn-icon { background: transparent; border: none; color: var(--primary); cursor: pointer; padding: 8px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; transition: all var(--t-fast); }
.btn-icon:hover { background: rgba(102,126,234,0.15); transform: scale(1.1); }
.btn-icon:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }
.btn-icon--close { color: var(--text-secondary); }
.btn-icon--close:hover { color: #f5576c; background: rgba(245,87,108,0.15); }

.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 8px; border-radius: var(--r-full); background: var(--gradient-primary); color: white; font-size: 0.72rem; font-weight: 800; }

.inbox-controls { display: flex; align-items: center; gap: var(--sp-sm); }
.live-indicator { display: flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: var(--r-full); background: rgba(17,153,142,0.1); border: 1px solid rgba(17,153,142,0.25); color: #38ef7d; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.live-indicator__dot { width: 7px; height: 7px; border-radius: 50%; background: #38ef7d; animation: pulse 2s ease-in-out infinite; }

.email-list { flex: 1; overflow-y: auto; border-top: 1px solid var(--border); }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--sp-2xl) var(--sp-lg); text-align: center; min-height: 350px; }
.empty-state__icon { width: 80px; height: 80px; border-radius: 50%; background: var(--bg-glass); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; margin-bottom: var(--sp-lg); color: var(--text-muted); }
.empty-state__title { font-size: 1.1rem; font-weight: 700; color: var(--text-secondary); margin-bottom: var(--sp-xs); }
.empty-state__text { font-size: 0.88rem; color: var(--text-muted); max-width: 280px; }

.email-item { display: grid; grid-template-columns: auto 1fr auto; gap: var(--sp-md); align-items: center; padding: var(--sp-md); border-bottom: 1px solid var(--border); cursor: pointer; transition: all var(--t-fast); position: relative; }
.email-item::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gradient-primary); border-radius: 0 3px 3px 0; opacity: 0; transition: opacity var(--t-fast); }
.email-item:last-child { border-bottom: none; }
.email-item:hover { background: var(--bg-surface-hover); }
.email-item:hover::before { opacity: 1; }
.email-item__avatar { width: 44px; height: 44px; background: var(--gradient-primary); border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; color: white; font-weight: 800; font-size: 0.95rem; flex-shrink: 0; box-shadow: var(--shadow-sm); }
.email-item__body { min-width: 0; }
.email-item__from { font-weight: 700; font-size: 0.92rem; color: var(--text-primary); margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-item__subject { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-item__preview { font-size: 0.8rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-item__time { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; font-weight: 600; flex-shrink: 0; align-self: start; padding-top: 2px; }

.skeleton-list { padding: var(--sp-sm); }
.skeleton-item { display: flex; align-items: center; gap: var(--sp-md); padding: var(--sp-md); }
.skeleton-item__body { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.skeleton { background: linear-gradient(90deg, var(--bg-glass) 25%, var(--bg-glass-strong) 50%, var(--bg-glass) 75%); background-size: 200% 100%; animation: skeletonShimmer 1.5s infinite ease-in-out; border-radius: var(--r-sm); }
.skeleton--avatar { width: 44px; height: 44px; border-radius: var(--r-md); flex-shrink: 0; }
.skeleton--line { height: 12px; }
.skeleton--w40 { width: 40%; }
.skeleton--w50 { width: 50%; }
.skeleton--w60 { width: 60%; }
.skeleton--w70 { width: 70%; }
.skeleton--w80 { width: 80%; }
@keyframes skeletonShimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

.modal { display: none; position: fixed; inset: 0; z-index: 1000; align-items: center; justify-content: center; padding: var(--sp-lg); }
.modal.active { display: flex; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); animation: fadeIn 0.25s ease; }
.modal__dialog { position: relative; background: linear-gradient(180deg, rgba(26,26,46,0.98), rgba(15,15,35,0.98)); border: 1px solid var(--border); border-radius: var(--r-lg); max-width: 800px; width: 100%; max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg), var(--shadow-glow); animation: modalSlideUp 0.35s var(--t-spring); animation-fill-mode: both; }
.modal__header { padding: var(--sp-lg); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: start; gap: var(--sp-md); }
.modal__title { font-size: 1.3rem; font-weight: 800; color: var(--text-primary); line-height: 1.3; flex: 1; }
.modal__meta { padding: var(--sp-md) var(--sp-lg); background: rgba(255,255,255,0.02); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.modal__meta-row { display: flex; align-items: center; gap: var(--sp-sm); font-size: 0.85rem; }
.modal__meta-label { color: var(--text-muted); font-weight: 700; min-width: 48px; }
.modal__meta-value { color: var(--text-primary); }
.modal__tabs { padding: var(--sp-sm) var(--sp-lg); border-bottom: 1px solid var(--border); display: flex; gap: 4px; }
.tab { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: none; color: var(--text-muted); padding: 8px 16px; border-radius: var(--r-sm); font-family: inherit; font-size: 0.82rem; font-weight: 700; cursor: pointer; transition: all var(--t-fast); }
.tab:hover { background: var(--bg-glass); color: var(--text-primary); }
.tab.active { background: var(--primary); color: white; }
.modal__body { flex: 1; overflow-y: auto; padding: var(--sp-lg); }
.email-content { color: var(--text-primary); line-height: 1.8; word-wrap: break-word; }
.email-content pre { white-space: pre-wrap; font-family: inherit; }
.modal__footer { padding: var(--sp-md) var(--sp-lg); border-top: 1px solid var(--border); display: flex; justify-content: flex-end; }
@keyframes modalSlideUp { from { transform: translateY(40px) scale(0.96); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }

.toast-container { position: fixed; bottom: var(--sp-lg); right: var(--sp-lg); z-index: 2000; display: flex; flex-direction: column; gap: var(--sp-sm); }
.toast { background: rgba(26,26,46,0.95); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-md) var(--sp-lg); box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: var(--sp-sm); min-width: 300px; max-width: 420px; animation: toastSlideIn 0.35s var(--t-spring) both; position: relative; overflow: hidden; }
.toast::after { content: ''; position: absolute; bottom: 0; left: 0; height: 3px; width: 100%; animation: toastProgress 3s linear forwards; }
.toast.success { border-left: 4px solid #38ef7d; }
.toast.success::after { background: var(--gradient-success); }
.toast.error { border-left: 4px solid #f5576c; }
.toast.error::after { background: var(--gradient-danger); }
.toast__icon { flex-shrink: 0; }
.toast__message { flex: 1; color: var(--text-primary); font-size: 0.85rem; font-weight: 600; }
@keyframes toastSlideIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastProgress { from { width: 100%; } to { width: 0; } }

.footer { padding: var(--sp-lg) 0; border-top: 1px solid var(--border); text-align: center; color: var(--text-muted); font-size: 0.85rem; }
.footer__inner { display: flex; justify-content: center; align-items: center; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.85); } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spinning { animation: spin 0.8s linear infinite; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

@media (max-width: 1024px) {
    .app-layout { grid-template-columns: 1fr; }
    .panel--generator { position: static; }
    .header__nav { display: none; }
}
@media (max-width: 768px) {
    .container { padding: 0 var(--sp-md); }
    .hero__title { font-size: 1.8rem; }
    .email-form { grid-template-columns: 1fr; }
    .email-item { grid-template-columns: auto 1fr; gap: var(--sp-sm); }
    .email-item__time { grid-column: 2; }
    .modal__dialog { max-height: 95vh; border-radius: var(--r-md); }
    .modal__title { font-size: 1.1rem; }
    .card { padding: var(--sp-md); }
}
@media (max-width: 480px) {
    :root { --sp-lg: 1.25rem; }
    .email-display__box { flex-direction: column; text-align: center; gap: var(--sp-sm); }
    .toast-container { left: var(--sp-md); right: var(--sp-md); bottom: var(--sp-md); }
    .toast { min-width: auto; max-width: 100%; }
}