@extends('layouts.app')

@section('content')

<style>
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&family=Inter:wght@400;500;600;700&display=swap');

:root{
    --navy-950:#050B1A;
    --navy-900:#0A1730;
    --navy-800:#0F2247;
    --navy-700:#15316B;
    --navy-600:#1D4090;
    --navy-500:#2955B8;
    --accent:#3D6FE0;
    --accent-light:#6E93F2;
    --gold:#E3B341;
    --ink:#0A1730;
    --muted:#5C6B8A;
    --line:#E1E7F5;
    --paper:#F7F9FE;
    --radius-lg:26px;
    --radius-md:16px;
    --shadow-sm:0 8px 24px rgba(5,11,26,.08);
    --shadow-md:0 24px 60px rgba(5,11,26,.35);
    --font-display:'Plus Jakarta Sans',sans-serif;
    --font-body:'Inter',sans-serif;
}

*{ box-sizing:border-box; }

body{
    background:
        radial-gradient(1000px 600px at 15% 10%, rgba(61,111,224,.12), transparent 60%),
        radial-gradient(900px 500px at 90% 90%, rgba(227,179,65,.06), transparent 55%),
        linear-gradient(180deg,#F7F9FE 0%,#EEF2FC 100%);
    font-family:var(--font-body);
    color:var(--ink);
    min-height:100vh;
}

.login-shell{
    min-height:100vh;
    display:flex;
    justify-content:center;
    align-items:center;
    padding:40px 20px;
}

.login-grid{
    width:100%;
    max-width:980px;
    display:grid;
    grid-template-columns:1.05fr 1fr;
    background:#fff;
    border-radius:var(--radius-lg);
    overflow:hidden;
    border:1px solid var(--line);
    box-shadow:var(--shadow-md);
}

/* ---------- left / brand panel ---------- */

.login-brand{
    position:relative;
    background:
        radial-gradient(600px 400px at 100% 0%, rgba(110,147,242,.25), transparent 60%),
        radial-gradient(500px 400px at 0% 100%, rgba(227,179,65,.10), transparent 55%),
        linear-gradient(150deg,var(--navy-950) 0%,var(--navy-900) 45%,var(--navy-700) 100%);
    color:#fff;
    padding:52px 46px;
    display:flex;
    flex-direction:column;
    justify-content:space-between;
    overflow:hidden;
}

.login-brand::before{
    content:"";
    position:absolute;
    inset:0;
    background-image:
        linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
    background-size:34px 34px;
    mask-image:radial-gradient(circle at 30% 20%, black, transparent 70%);
    pointer-events:none;
}

.login-brand::after{
    content:"";
    position:absolute;
    width:280px;
    height:280px;
    border-radius:50%;
    background:radial-gradient(circle, rgba(227,179,65,.18), transparent 70%);
    top:-90px;
    right:-90px;
    pointer-events:none;
}

.brand-top{ position:relative; z-index:1; }

.brand-mark{
    width:60px;
    height:60px;
    border-radius:16px;
    background:rgba(255,255,255,.98);
    display:flex;
    align-items:center;
    justify-content:center;
    box-shadow:0 10px 26px rgba(0,0,0,.25);
    margin-bottom:30px;
}

.brand-mark img{ width:36px; height:36px; object-fit:contain; }

.eyebrow{
    font-family:var(--font-display);
    font-size:11.5px;
    font-weight:700;
    letter-spacing:.12em;
    text-transform:uppercase;
    color:var(--gold);
    display:inline-flex;
    align-items:center;
    gap:9px;
    margin-bottom:18px;
}

.eyebrow::before{
    content:"";
    width:18px;
    height:2px;
    background:var(--gold);
    display:inline-block;
    border-radius:2px;
}

.login-brand h1{
    font-family:var(--font-display);
    font-size:30px;
    font-weight:800;
    line-height:1.24;
    letter-spacing:-.015em;
    margin-bottom:16px;
}

.login-brand p{
    color:rgba(255,255,255,.72);
    font-size:14.5px;
    line-height:1.85;
    max-width:340px;
}

.brand-points{
    position:relative;
    z-index:1;
    display:flex;
    flex-direction:column;
    gap:15px;
    margin-top:38px;
}

.brand-point{
    display:flex;
    align-items:center;
    gap:13px;
    font-size:13.5px;
    color:rgba(255,255,255,.9);
    padding:12px 14px;
    border-radius:13px;
    background:rgba(255,255,255,.05);
    border:1px solid rgba(255,255,255,.09);
    backdrop-filter:blur(6px);
    transition:.25s;
}

.brand-point:hover{
    background:rgba(255,255,255,.09);
    transform:translateX(3px);
}

.brand-point .dot{
    width:30px;
    height:30px;
    border-radius:9px;
    background:linear-gradient(150deg, var(--accent), var(--navy-600));
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:14px;
    flex-shrink:0;
    box-shadow:0 4px 12px rgba(61,111,224,.4);
}

.brand-foot{
    position:relative;
    z-index:1;
    font-size:12px;
    color:rgba(255,255,255,.4);
    padding-top:26px;
    margin-top:26px;
    border-top:1px solid rgba(255,255,255,.1);
}

/* ---------- right / form panel ---------- */

.login-form-panel{
    padding:52px 48px;
    display:flex;
    flex-direction:column;
    justify-content:center;
}

.form-head{ margin-bottom:32px; }

.form-head .eyebrow{ color:var(--accent); }
.form-head .eyebrow::before{ background:var(--accent); }

.form-head h2{
    font-family:var(--font-display);
    font-size:26px;
    font-weight:800;
    color:var(--navy-900);
    letter-spacing:-.015em;
    margin-bottom:8px;
}

.form-head p{
    color:var(--muted);
    font-size:14.5px;
    line-height:1.7;
}

.alert-error{
    background:#FDECEC;
    border:1px solid #F6C8C8;
    color:#C62828;
    padding:14px 17px;
    border-radius:13px;
    margin-bottom:22px;
    font-size:13.5px;
    line-height:1.6;
}

.alert-error ul{ list-style:none; margin:0; padding:0; }

.form-group{ margin-bottom:20px; }

.form-group label{
    display:block;
    margin-bottom:9px;
    font-weight:600;
    font-size:13.5px;
    color:var(--navy-900);
}

.form-group input{
    width:100%;
    height:52px;
    border:1.5px solid var(--line);
    border-radius:14px;
    padding:0 17px;
    font-size:14.5px;
    font-family:var(--font-body);
    color:var(--ink);
    background:var(--paper);
    transition:.25s;
}

.form-group input::placeholder{ color:#9AA6BC; }

.form-group input:focus{
    border-color:var(--accent);
    outline:none;
    background:#fff;
    box-shadow:0 0 0 4px rgba(61,111,224,.12);
}

.password-wrapper{ position:relative; }

.password-wrapper input{ padding-right:78px; }

.show-password{
    position:absolute;
    right:7px;
    top:50%;
    transform:translateY(-50%);
    background:rgba(61,111,224,.1);
    border:none;
    color:var(--navy-700);
    font-weight:600;
    font-size:12.5px;
    padding:9px 13px;
    border-radius:10px;
    cursor:pointer;
    transition:.2s;
}

.show-password:hover{ background:rgba(61,111,224,.18); }

.login-button{
    width:100%;
    height:54px;
    border:none;
    border-radius:14px;
    background:linear-gradient(135deg, var(--accent) 0%, var(--navy-700) 100%);
    color:#fff;
    font-family:var(--font-display);
    font-size:15px;
    font-weight:700;
    letter-spacing:.01em;
    cursor:pointer;
    box-shadow:0 16px 34px rgba(29,64,144,.32);
    transition:.25s;
    margin-top:8px;
}

.login-button:hover{
    transform:translateY(-2px);
    box-shadow:0 20px 42px rgba(29,64,144,.4);
    filter:brightness(1.05);
}

.login-button:active{
    transform:translateY(0);
}

.login-form-footer{
    margin-top:28px;
    text-align:center;
    color:var(--muted);
    font-size:13px;
    line-height:1.7;
}

.login-form-footer a{
    color:var(--navy-700);
    font-weight:600;
    text-decoration:none;
}

.login-form-footer a:hover{ text-decoration:underline; }

/* ---------- responsive ---------- */

@media(max-width:860px){
    .login-grid{ grid-template-columns:1fr; max-width:460px; }
    .login-brand{ padding:38px 34px; }
    .brand-points{ display:none; }
    .login-form-panel{ padding:40px 34px; }
}
</style>

<div class="login-shell">

<div class="login-grid">

    <!-- LEFT: brand panel -->
    <div class="login-brand">

        <div class="brand-top">
            <div class="brand-mark">
                <img src="{{ asset('images/logo-smkn7.png') }}" alt="Logo SMKN 7 Palembang">
            </div>

            <div class="eyebrow">SMKN 7 Palembang</div>

            <h1>Sistem Informasi<br>Data Kunjungan Tamu</h1>

            <p>
                Kelola pendataan tamu sekolah secara digital — cepat, rapi,
                dan tersimpan aman di database sekolah.
            </p>

            <div class="brand-points">
                <div class="brand-point">
                    <span class="dot">📝</span>
                    Pencatatan tamu digital
                </div>
                <div class="brand-point">
                    <span class="dot">📊</span>
                    Laporan kunjungan otomatis
                </div>
                <div class="brand-point">
                    <span class="dot">🔒</span>
                    Data tersimpan aman
                </div>
            </div>
        </div>

        <div class="brand-foot">
            &copy; {{ date('Y') }} SMKN 7 Palembang
        </div>

    </div>

    <!-- RIGHT: form panel -->
    <div class="login-form-panel">

        <div class="form-head">
            <div class="eyebrow">Login Pihak Sekolah</div>
            <h2>Selamat Datang Kembali</h2>
            <p>Masuk untuk mengelola data kunjungan tamu SMKN 7 Palembang.</p>
        </div>

        @if(session('error'))
            <div class="alert-error">
                {{ session('error') }}
            </div>
        @endif

        @if($errors->any())
            <div class="alert-error">
                <ul>
                    @foreach($errors->all() as $error)
                        <li>{{ $error }}</li>
                    @endforeach
                </ul>
            </div>
        @endif

        <form action="{{ route('login.process') }}" method="POST">

            @csrf

            <div class="form-group">
                <label>ID Petugas</label>
                <input
                    type="text"
                    name="id"
                    value="{{ old('id') }}"
                    placeholder="Masukkan ID Petugas"
                    required
                >
            </div>

            <div class="form-group">
                <label>Password</label>

                <div class="password-wrapper">

                    <input
                        type="password"
                        name="password"
                        id="password"
                        placeholder="Masukkan Password"
                        required
                    >

                    <button
                        type="button"
                        class="show-password"
                        onclick="togglePassword()">
                        Lihat
                    </button>

                </div>

            </div>

            <button class="login-button">
                Masuk
            </button>

        </form>

        <div class="login-form-footer">
            Sistem Informasi Data Kunjungan Tamu<br>
            <a href="{{ url('/') }}">&larr; Kembali ke Beranda</a>
        </div>

    </div>

</div>

</div>

<script>
function togglePassword(){

    let x=document.getElementById('password');

    if(x.type==="password"){
        x.type="text";
    }else{
        x.type="password";
    }

}
</script>

@endsection