<script setup>
import { useForm, router } from '@inertiajs/vue3'

const props = defineProps({
    status: String,
})

const form = useForm({})

const resend = () => {
    form.post('/email/verification-notification')
}

const logout = () => {
    router.post('/logout')
}
</script>

<template>
    <div class="auth-screen">
        <div class="scanlines" />
        <div class="terminal-frame">
            <div class="terminal-header">
                <span class="header-dot red" />
                <span class="header-dot yellow" />
                <span class="header-dot green" />
                <span class="header-title">AUTH.SYS v2.0</span>
            </div>

            <div class="terminal-body">
                <div class="prompt-line">
                    <span class="prompt-symbol">&gt;</span>
                    <span class="prompt-text">EMAIL VERIFICATION</span>
                    <span class="cursor" />
                </div>

                <h1 class="page-title">VERIFY<br>EMAIL</h1>

                <div class="divider">
                    <span>━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</span>
                </div>

                <div class="info-block">
                    <div class="info-line">
                        <span class="info-icon">[!]</span>
                        <p class="info-text">
                            ACCOUNT ACTIVATION REQUIRED. A VERIFICATION LINK HAS BEEN TRANSMITTED TO YOUR EMAIL ADDRESS.
                        </p>
                    </div>
                    <p class="info-sub">
                        CHECK YOUR INBOX AND CLICK THE LINK TO ACTIVATE YOUR ACCOUNT.
                    </p>
                </div>

                <div v-if="status === 'verification-link-sent'" class="status-msg">
                    <span class="status-prefix">OK:</span> NEW VERIFICATION LINK TRANSMITTED.
                </div>

                <div class="actions">
                    <button
                        @click="resend"
                        class="submit-btn"
                        :disabled="form.processing"
                    >
                        <span v-if="form.processing">TRANSMITTING...</span>
                        <span v-else>&gt;&gt; RESEND VERIFICATION</span>
                    </button>

                    <button
                        @click="logout"
                        class="logout-btn"
                    >
                        LOGOUT
                    </button>
                </div>

                <div class="divider">
                    <span>━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</span>
                </div>

                <div class="status-line">
                    <span class="status-label">SESSION STATUS:</span>
                    <span class="status-value blink-slow">AWAITING VERIFICATION</span>
                </div>
            </div>
        </div>
    </div>
</template>

<style scoped>
.auth-screen {
    width: 100vw;
    height: 100vh;
    background: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.08) 2px,
        rgba(0, 0, 0, 0.08) 4px
    );
    pointer-events: none;
    z-index: 1;
}

.terminal-frame {
    position: relative;
    z-index: 2;
    width: 480px;
    background: #0d0d1a;
    border: 2px solid #00d2ff;
    box-shadow:
        0 0 40px rgba(0, 210, 255, 0.25),
        inset 0 0 40px rgba(0, 210, 255, 0.03);
}

.terminal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(0, 210, 255, 0.08);
    border-bottom: 1px solid rgba(0, 210, 255, 0.3);
}

.header-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: block;
}

.header-dot.red    { background: #e94560; box-shadow: 0 0 6px #e94560; }
.header-dot.yellow { background: #f5a623; box-shadow: 0 0 6px #f5a623; }
.header-dot.green  { background: #00ff88; box-shadow: 0 0 6px #00ff88; }

.header-title {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: #8892b0;
    margin-left: auto;
    letter-spacing: 2px;
}

.terminal-body {
    padding: 32px 40px;
}

.prompt-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.prompt-symbol {
    font-family: 'VT323', monospace;
    font-size: 20px;
    color: #00ff88;
}

.prompt-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: #8892b0;
    letter-spacing: 2px;
}

.cursor {
    display: inline-block;
    width: 10px;
    height: 16px;
    background: #00d2ff;
    animation: blink 1s step-end infinite;
    margin-left: 4px;
}

@keyframes blink {
    50% { opacity: 0; }
}

.page-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 18px;
    color: #00d2ff;
    text-shadow: 0 0 30px rgba(0, 210, 255, 0.5);
    letter-spacing: 3px;
    line-height: 1.6;
    margin: 0 0 16px 0;
}

.divider {
    font-family: 'VT323', monospace;
    font-size: 16px;
    color: rgba(0, 210, 255, 0.3);
    margin: 16px 0;
    overflow: hidden;
}

.info-block {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.info-line {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.info-icon {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    color: #f5a623;
    flex-shrink: 0;
    padding-top: 2px;
}

.info-text {
    font-family: 'VT323', monospace;
    font-size: 18px;
    color: #e8e8e8;
    line-height: 1.4;
    margin: 0;
    letter-spacing: 0.5px;
}

.info-sub {
    font-family: 'VT323', monospace;
    font-size: 16px;
    color: #8892b0;
    margin: 0;
    padding-left: 28px;
    letter-spacing: 0.5px;
}

.status-msg {
    font-family: 'VT323', monospace;
    font-size: 17px;
    color: #00ff88;
    background: rgba(0, 255, 136, 0.08);
    border: 1px solid rgba(0, 255, 136, 0.3);
    padding: 10px 14px;
    margin-bottom: 16px;
}

.status-prefix {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: bold;
    margin-right: 6px;
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.submit-btn {
    padding: 14px 24px;
    background: rgba(0, 210, 255, 0.08);
    border: 2px solid #00d2ff;
    color: #00d2ff;
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    width: 100%;
}

.submit-btn:hover:not(:disabled) {
    background: rgba(0, 210, 255, 0.18);
    box-shadow: 0 0 24px rgba(0, 210, 255, 0.35);
    transform: translateY(-1px);
}

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

.logout-btn {
    padding: 10px 24px;
    background: transparent;
    border: 1px solid rgba(233, 69, 96, 0.4);
    color: #8892b0;
    font-family: 'VT323', monospace;
    font-size: 18px;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    width: 100%;
}

.logout-btn:hover {
    border-color: #e94560;
    color: #e94560;
    background: rgba(233, 69, 96, 0.06);
}

.status-line {
    display: flex;
    gap: 12px;
    align-items: center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
}

.status-label {
    color: #8892b0;
    letter-spacing: 1px;
}

.status-value {
    color: #f5a623;
    letter-spacing: 1px;
}

.blink-slow {
    animation: blink-slow 2s step-end infinite;
}

@keyframes blink-slow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
</style>
