/* ============================================================
   Kira Gen — Dark mode, clean layout (inspired by Internxt style)
   ============================================================ */

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

:root {
    --bg:          #111111;
    --bg-card:     #1a1a1a;
    --bg-sidebar:  #161616;
    --border:      rgba(255,255,255,0.18);
    --border-hover:rgba(255,255,255,0.35);
    --text-1:      #ffffff;
    --text-2:      #b0b0b0;
    --text-3:      #666666;
    --accent:      #ffffff;
    --success:     #22c55e;
    --danger:      #ef4444;
    --warning:     #eab308;
    --radius:      12px;
    --ease:        cubic-bezier(0.16, 1, 0.3, 1);
}

html { font-size: 16px; }

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text-1);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.header {
    padding: 3rem 2rem;
    display: flex;
    justify-content: center;
    border-bottom: none;
}

.logo-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    background: rgba(255, 255, 255, 0.05); /* glass effect */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.6rem 1.6rem;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

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

/* ── Main ── */
.main {
    flex: 1;
    max-width: 820px;
    width: 100%;
    margin: 0 auto;
    padding: 0 1.5rem 2rem;
}

/* ── Hero ── */
#hero-section {
    text-align: center;
    padding: 0 0 4rem;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1rem;
    color: var(--text-2);
    max-width: 440px;
    margin: 0 auto 2.5rem;
    line-height: 1.6;
}

/* ── Generate Form ── */
.generate-form {
    max-width: 380px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.generate-tabs {
    display: flex;
    background: #000000; /* Darker than the form to create a recessed look */
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 1.25rem;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-2);
    padding: 0.6rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s var(--ease);
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.12); /* Brighter pill to pop out */
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.custom-input-wrap {
    display: flex;
    align-items: center;
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

#custom-name {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-1);
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
}

.custom-domain {
    color: var(--text-3);
    padding-right: 1rem;
    font-weight: 500;
    font-size: 0.95rem;
}

.keep-it-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-2);
    cursor: pointer;
    margin-bottom: 1.25rem;
    justify-content: center;
}

.keep-it-label input[type="checkbox"] {
    accent-color: var(--success);
    width: 15px; height: 15px;
}

.cf-turnstile-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
    min-height: 65px;
}

.generate-form .btn-generate {
    width: 100%;
    justify-content: center;
}


/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s var(--ease);
    white-space: nowrap;
}

.btn svg {
    flex-shrink: 0;
}

.btn-primary {
    background: #ffffff;
    color: #000000;
    border-color: #ffffff;
    font-size: 1rem;
    padding: 0.75rem 2rem;
    border-radius: 50px;
    font-weight: 600;
}

.btn-primary:hover { background: #e0e0e0; border-color: #e0e0e0; }

.btn-outline {
    background: transparent;
    color: var(--text-2);
    border-color: var(--border);
}

.btn-outline:hover {
    color: var(--text-1);
    border-color: var(--border-hover);
    background: rgba(255,255,255,0.04);
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    flex-shrink: 0;
}

.icon-btn svg { width: 17px; height: 17px; }

.icon-btn:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-1);
}

/* ── Email Bar ── */
.email-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.email-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
}

.email-address {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-1);
    word-break: break-all;
}



.email-bar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Timer pill */
.timer-pill {
    padding: 0.45rem 0.85rem;
    border-radius: 50px;
    border: 1px solid var(--border);
    font-size: 0.82rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-1);
    background: transparent;
    min-width: 60px;
    text-align: center;
}

.timer-pill.urgent { border-color: var(--warning); color: var(--warning); }
.timer-pill.critical {
    border-color: var(--danger);
    color: var(--danger);
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }

/* ── Inbox Layout ── */
.inbox-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 420px;
}

/* Sidebar */
.inbox-sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

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

.inbox-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-1);
}

.inbox-list {
    flex: 1;
    overflow-y: auto;
}

.inbox-list::-webkit-scrollbar { width: 4px; }
.inbox-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

/* Inbox items */
.inbox-item {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    cursor: pointer;
    transition: background 0.15s;
}

.inbox-item:hover { background: rgba(255,255,255,0.04); }
.inbox-item:last-child { border-bottom: none; }

.inbox-item.unread .item-subject { font-weight: 700; color: var(--text-1); }
.inbox-item.unread { border-left: 2px solid var(--text-1); }

.item-subject {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.item-from {
    font-size: 0.75rem;
    color: var(--text-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-date {
    font-size: 0.72rem;
    color: var(--text-3);
    margin-top: 2px;
}

/* Viewer pane */
.inbox-viewer {
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2.5rem;
    gap: 0.75rem;
}

.empty-icon {
    width: 72px; height: 72px;
    color: var(--text-3);
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.empty-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-1);
}

.empty-sub {
    font-size: 0.82rem;
    color: var(--text-3);
    margin-bottom: 0.25rem;
}

/* Message viewer */
.message-viewer {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-self: stretch;
}

.message-viewer-header {
    height: 72px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.msg-subject {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.msg-meta {
    font-size: 0.78rem;
    color: var(--text-3);
}

.msg-body {
    padding: 1.25rem;
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-2);
    overflow-y: auto;
    flex: 1;
    word-break: break-word;
}

.msg-body pre { white-space: pre-wrap; font-family: inherit; }
.msg-body img { max-width: 100%; height: auto; }
.msg-body a { color: #fff; text-decoration: underline; }

/* Loading spinner */
.msg-loading {
    display: flex; align-items: center; justify-content: center;
    padding: 3rem;
}

.spinner {
    width: 28px; height: 28px;
    border: 2px solid rgba(255,255,255,0.1);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* Spinning refresh */
.icon-btn.spinning svg { animation: spin 0.8s linear infinite; }

/* ── Expiry note ── */
.expiry-note {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    justify-content: center;
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--text-3);
}

.expiry-note strong { color: var(--text-2); }

/* ── Modal ── */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    visibility: visible;
    transition: all 0.2s var(--ease);
}

.modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    transform: scale(1);
    transition: transform 0.2s var(--ease);
}

.modal.hidden .modal-content {
    transform: scale(0.95);
}

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

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.modal-body {
    padding: 1.5rem;
}

.cred-notice {
    font-size: 0.85rem;
    color: var(--text-2);
    margin-bottom: 1.25rem;
}

.cred-row {
    background: var(--bg-sidebar);
    border: 1px solid rgba(255,255,255,0.06);
    padding: 0.85rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.cred-row span {
    color: var(--text-3);
}

.cred-row strong {
    color: var(--text-1);
    font-family: monospace;
    font-size: 1rem;
}

.mt-2 { margin-top: 1rem; background: transparent; border: none; padding: 0; justify-content: center; }

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1.25rem;
    font-size: 0.85rem;
    color: var(--text-1);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s var(--ease);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

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

/* ── Utilities ── */
.hidden { display: none !important; }

/* ── Responsive ── */
@media (max-width: 600px) {
    .header { padding: 2rem 1rem; }
    .main { padding: 0 1rem 1.5rem; }
    .inbox-layout { grid-template-columns: 1fr; min-height: auto; }
    .inbox-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: none;
        transition: max-height 0.3s var(--ease), opacity 0.3s var(--ease), border 0.3s var(--ease);
    }
    /* Fit 2 items without scroll; scroll kicks in at 3+ */
    .inbox-sidebar .inbox-list {
        max-height: 150px;
        overflow-y: auto;
    }
    /* Hide sidebar on mobile when inbox is empty */
    .inbox-sidebar.sidebar-empty {
        max-height: 0;
        overflow: hidden;
        border-bottom: none;
        opacity: 0;
        pointer-events: none;
    }
    .email-bar { flex-direction: column; align-items: stretch; }
    .email-bar-actions { 
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
    }
    .email-bar-actions .btn {
        flex: 1;
        min-width: 40%;
        justify-content: center;
    }
    .timer-pill {
        width: 100%;
        flex: 1 1 100%;
        padding: 0.6rem 0;
    }
}
