@extends('layouts.student')

@section('title', 'Choose Bookmark Style - Lindsay\'s Leather')

@section('head')
<style>
    body.with-order-header {
        font-family: 'Montserrat', sans-serif;
        background-color: #f8f9fa;
        margin: 0;
        padding: 0;
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .landing-container {
        max-width: 800px;
        width: 100%;
        padding: 2rem;
        margin: 0 auto;
    }
    
    .lindsay-card {
        background: white;
        border-radius: 16px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
        padding: 2rem;
        border: 1px solid rgba(181, 112, 47, 0.1);
    }
    
    .flex {
        display: flex;
    }
    
    .justify-between {
        justify-content: space-between;
    }
    
    .items-center {
        align-items: center;
    }
    
    .mb-6 {
        margin-bottom: 1.5rem;
    }
    
    .body-text {
        font-family: 'Montserrat', sans-serif;
        font-weight: 400;
    }
    
    .progress-bar {
        height: 4px;
        background: #e5e7eb;
        border-radius: 2px;
        overflow: hidden;
        margin-bottom: 2rem;
    }
    
    .progress-fill {
        height: 100%;
        background: #B5702F;
        border-radius: 2px;
        transition: width 0.5s ease;
    }
    
    .landing-title {
        font-family: 'Lato', sans-serif;
        font-weight: 700;
        font-size: 2.5rem;
        color: #371C16;
        margin-bottom: 1rem;
        line-height: 1.2;
        text-align: center;
    }
    
    .landing-subtitle {
        font-family: 'Montserrat', sans-serif;
        font-size: 1.125rem;
        color: #6b7280;
        text-align: center;
        margin-bottom: 2.5rem;
    }
    
    .style-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-bottom: 2rem;
    }
    
    .style-card {
        background: #f8f9fa;
        border: 3px solid #e5e7eb;
        border-radius: 12px;
        padding: 1.5rem;
        cursor: pointer;
        transition: all 0.3s ease;
        position: relative;
    }
    
    .style-card:hover {
        border-color: #B5702F;
        background: rgba(181, 112, 47, 0.05);
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(181, 112, 47, 0.15);
    }
    
    .style-card.selected {
        border-color: #B5702F;
        background: rgba(181, 112, 47, 0.1);
        box-shadow: 0 6px 20px rgba(181, 112, 47, 0.2);
    }
    
    .style-title {
        font-family: 'Lato', sans-serif;
        font-size: 1.5rem;
        font-weight: 700;
        color: #371C16;
        margin-bottom: 0.75rem;
    }
    
    .style-description {
        font-family: 'Montserrat', sans-serif;
        font-size: 1rem;
        color: #6b7280;
        margin-bottom: 1rem;
    }
    
    .style-preview {
        background: white;
        border-radius: 8px;
        padding: 1.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 200px;
    }
    
    .style-visual {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
        font-family: 'Lato', sans-serif;
        color: #371C16;
    }
    
    .visual-stamp {
        width: 60px;
        height: 60px;
        background: #B5702F;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-weight: 700;
        font-size: 0.75rem;
    }
    
    .visual-text {
        display: flex;
        flex-direction: column; /* Make text vertical */
        gap: 0.35rem;
    }
    
    .visual-char {
        width: 32px;
        height: 32px;
        background: #e5e7eb;
        border-radius: 4px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        font-size: 0.875rem;
    }
    
    .lindsay-btn {
        font-family: 'Lato', sans-serif;
        font-weight: 600;
        border-radius: 12px;
        padding: 16px 32px;
        min-height: 52px;
        transition: all 0.3s ease;
        border: none;
        cursor: pointer;
        text-decoration: none;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        background: #B5702F;
        color: white;
        width: 100%;
    }
    
    .lindsay-btn:hover:not(:disabled) {
        background: #371C16;
        transform: translateY(-1px);
        box-shadow: 0 6px 20px rgba(181, 112, 47, 0.3);
    }
    
    .lindsay-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }
    
    /* Mobile Responsive */
    @media (max-width: 768px) {
        .landing-container {
            padding: 1rem;
        }
        
        .lindsay-card {
            padding: 1.5rem 1rem;
            width: 100%;
        }
        
        .landing-title {
            font-size: 2rem;
        }
        
        .landing-subtitle {
            font-size: 1rem;
        }
        
        .style-title {
            font-size: 1.25rem;
        }
        
        .style-description {
            font-size: 0.9375rem;
        }
    }
</style>
@endsection

@section('content')
<div class="landing-container">
    <div class="lindsay-card">
        <!-- Back Button and Step Indicator -->
        <div class="flex justify-between items-center mb-6">
            <x-back-button href="{{ route('student.index') }}" />
            <span class="body-text" style="color: #6b7280;">Step 2 of 4</span>
        </div>

        <!-- Progress Bar -->
        <div class="progress-bar">
            <div class="progress-fill" style="width: 50%;"></div>
        </div>

        <!-- Page Title -->
        <h1 class="landing-title">Choose Bookmark Style</h1>
        <p class="landing-subtitle">Select how you want to customize your bookmark</p>

        <!-- Style Selection Grid -->
        <div class="style-grid">
            <!-- Style 1: Top & Bottom Stamps + Text -->
            <div class="style-card" data-style="1" onclick="selectStyle('1')">
                <div class="style-title">Style 1: Top & Bottom Stamps + Text</div>
                <div class="style-description">1 large stamp at top + 7 text characters + 1 large stamp at bottom</div>
                <div class="style-preview">
                    <div class="style-visual">
                        <div class="visual-stamp"></div>
                        <div class="visual-text">
                            <div class="visual-char">A</div>
                            <div class="visual-char">B</div>
                            <div class="visual-char">C</div>
                            <div class="visual-char">D</div>
                            <div class="visual-char">E</div>
                            <div class="visual-char">F</div>
                            <div class="visual-char">G</div>
                        </div>
                        <div class="visual-stamp"></div>
                    </div>
                </div>
            </div>

            <!-- Style 2: Stamps Only -->
            <div class="style-card" data-style="2" onclick="selectStyle('2')">
                <div class="style-title">Style 2: Stamps Only</div>
                <div class="style-description">6 large stamps vertically arranged (no text)</div>
                <div class="style-preview">
                    <div class="style-visual">
                        <div class="visual-stamp"></div>
                        <div class="visual-stamp"></div>
                        <div class="visual-stamp"></div>
                        <div class="visual-stamp"></div>
                        <div class="visual-stamp"></div>
                        <div class="visual-stamp"></div>
                    </div>
                </div>
            </div>

            <!-- Style 3: Text + Bottom Stamp -->
            <div class="style-card" data-style="3" onclick="selectStyle('3')">
                <div class="style-title">Style 3: Text + Bottom Stamp</div>
                <div class="style-description">8 text characters at top + 1 large stamp at bottom</div>
                <div class="style-preview">
                    <div class="style-visual">
                        <div class="visual-text">
                            <div class="visual-char">A</div>
                            <div class="visual-char">B</div>
                            <div class="visual-char">C</div>
                            <div class="visual-char">D</div>
                            <div class="visual-char">E</div>
                            <div class="visual-char">F</div>
                            <div class="visual-char">G</div>
                            <div class="visual-char">H</div>
                        </div>
                        <div class="visual-stamp"></div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Continue Button -->
        <form id="styleForm" method="GET" action="{{ route('student.bookmark-customize') }}">
            <input type="hidden" name="style" id="selectedStyle" value="">
            <button type="submit" id="continueBtn" class="lindsay-btn" disabled>
                Continue to Customize →
            </button>
        </form>
    </div>
</div>
@endsection

@section('scripts')
<script>
    let selectedStyleValue = null;

    function selectStyle(style) {
        // Remove selected class from all cards
        document.querySelectorAll('.style-card').forEach(card => {
            card.classList.remove('selected');
        });

        // Add selected class to clicked card
        const selectedCard = document.querySelector(`.style-card[data-style="${style}"]`);
        if (selectedCard) {
            selectedCard.classList.add('selected');
        }

        // Update hidden input and enable button
        selectedStyleValue = style;
        document.getElementById('selectedStyle').value = style;
        document.getElementById('continueBtn').disabled = false;

        console.log('Selected bookmark style:', style);
    }

    // Prevent form submission if no style selected
    document.getElementById('styleForm').addEventListener('submit', function(e) {
        if (!selectedStyleValue) {
            e.preventDefault();
            alert('Please select a bookmark style first.');
            return false;
        }
    });
</script>
@endsection

