
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Create Service - {{ hotelName() }} System</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        :root {
            --primary-green: #1a936f;
            --secondary-green: #88d498;
            --light-green: #c6dabf;
            --dark-green: #114b5f;
            --accent: #f3e9d2;
            --success: #28a745;
            --warning: #ffc107;
            --danger: #dc3545;
            --info: #17a2b8;
        }
        
        body {
            background-color: #f8f9fa;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            color: #333;
        }
        
        .navbar {
            background: linear-gradient(135deg, var(--dark-green) 0%, var(--primary-green) 100%);
            box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
            padding: 12px 0;
        }
        
        .sidebar {
            background: linear-gradient(180deg, var(--dark-green) 0%, var(--primary-green) 100%);
            color: white;
            height: calc(100vh - 70px);
            position: fixed;
            top: 70px;
            padding: 20px 0;
            z-index: 1000;
            overflow-y: auto;
            width: 280px;
            box-shadow: 3px 0 15px rgba(0, 0, 0, 0.1);
        }
        
        .sidebar .nav-link {
            color: rgba(255, 255, 255, 0.9);
            padding: 12px 25px;
            margin: 5px 15px;
            border-radius: 8px;
            transition: all 0.3s;
            font-weight: 500;
        }
        
        .sidebar .nav-link:hover {
            background-color: rgba(255, 255, 255, 0.1);
            color: white;
            transform: translateX(5px);
        }
        
        .sidebar .nav-link.active {
            background-color: var(--secondary-green);
            color: var(--dark-green);
            font-weight: 600;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }
        
        .sidebar .nav-link i {
            margin-right: 12px;
            width: 20px;
            text-align: center;
        }
        
        .main-content {
            margin-left: 280px;
            padding: 30px;
            margin-top: 70px;
            min-height: calc(100vh - 70px);
            background-color: #f8f9fa;
        }
        
        .dashboard-card {
            border-radius: 15px;
            transition: transform 0.3s, box-shadow 0.3s;
            border: none;
            box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
            overflow: hidden;
        }
        
        .dashboard-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
        }
        
        .card-header {
            background: linear-gradient(135deg, var(--primary-green) 0%, var(--secondary-green) 100%);
            color: white;
            border-radius: 0 !important;
            padding: 20px 25px;
            font-weight: 600;
            border: none;
        }
        
        .btn-primary {
            background: linear-gradient(135deg, var(--primary-green) 0%, var(--secondary-green) 100%);
            border: none;
            border-radius: 10px;
            padding: 12px 25px;
            font-weight: 600;
            transition: all 0.3s;
            box-shadow: 0 4px 15px rgba(26, 147, 111, 0.3);
        }
        
        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(26, 147, 111, 0.4);
            background: linear-gradient(135deg, var(--dark-green) 0%, var(--primary-green) 100%);
        }
        
        .btn-outline-primary {
            border: 2px solid var(--primary-green);
            color: var(--primary-green);
            border-radius: 10px;
            padding: 10px 20px;
            font-weight: 600;
            transition: all 0.3s;
            background: transparent;
        }
        
        .btn-outline-primary:hover {
            background: var(--primary-green);
            border-color: var(--primary-green);
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(26, 147, 111, 0.3);
        }
        
        .service-icon {
            width: 70px;
            height: 70px;
            background: linear-gradient(135deg, var(--primary-green) 0%, var(--secondary-green) 100%);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 1.8rem;
            margin-bottom: 15px;
            box-shadow: 0 5px 15px rgba(26, 147, 111, 0.3);
        }
        
        .form-control, .form-select, .form-check-input {
            border-radius: 10px;
            border: 2px solid #e9ecef;
            padding: 12px 15px;
            transition: all 0.3s;
        }
        
        .form-control:focus, .form-select:focus {
            border-color: var(--primary-green);
            box-shadow: 0 0 0 0.25rem rgba(26, 147, 111, 0.25);
        }
        
        .form-check-input:checked {
            background-color: var(--primary-green);
            border-color: var(--primary-green);
        }
        
        .form-label {
            font-weight: 600;
            color: var(--dark-green);
            margin-bottom: 8px;
        }
        
        .breadcrumb {
            background: transparent;
            padding: 0;
        }
        
        .breadcrumb-item.active {
            color: var(--primary-green);
            font-weight: 600;
        }
        
        .alert {
            border-radius: 12px;
            border: none;
            box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
            padding: 15px 20px;
        }
        
        .preview-image {
            max-width: 200px;
            max-height: 150px;
            border-radius: 10px;
            border: 2px dashed #dee2e6;
            padding: 10px;
            display: none;
        }
        
        .availability-day {
            background: #f8f9fa;
            border-radius: 8px;
            padding: 10px 15px;
            margin-bottom: 10px;
            border: 1px solid #e9ecef;
            transition: all 0.3s;
        }
        
        .availability-day:hover {
            background: var(--light-green);
            border-color: var(--primary-green);
        }
        
        .availability-day.selected {
            background: var(--light-green);
            border-color: var(--primary-green);
        }
        
        .step-progress {
            display: flex;
            justify-content: space-between;
            margin-bottom: 30px;
            position: relative;
        }
        
        .step-progress:before {
            content: '';
            position: absolute;
            top: 20px;
            left: 0;
            right: 0;
            height: 3px;
            background: #e9ecef;
            z-index: 1;
        }
        
        .step {
            position: relative;
            z-index: 2;
            text-align: center;
            flex: 1;
        }
        
        .step-number {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: #e9ecef;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 10px;
            font-weight: 600;
            color: #6c757d;
            transition: all 0.3s;
        }
        
        .step.active .step-number {
            background: var(--primary-green);
            color: white;
            box-shadow: 0 4px 12px rgba(26, 147, 111, 0.3);
        }
        
        .step-label {
            font-size: 0.9rem;
            color: #6c757d;
            font-weight: 500;
        }
        
        .step.active .step-label {
            color: var(--primary-green);
            font-weight: 600;
        }
        
        @media (max-width: 992px) {
            .sidebar {
                transform: translateX(-100%);
                transition: transform 0.3s;
            }
            .sidebar.show {
                transform: translateX(0);
            }
            .main-content {
                margin-left: 0;
            }
        }
    </style>
</head>
<body>
    <!-- Navbar -->
    <nav class="navbar navbar-expand-lg navbar-dark fixed-top">
        <div class="container-fluid">
            <button class="navbar-toggler me-2" type="button" id="sidebarToggle">
                <i class="fas fa-bars"></i>
            </button>
            <a class="navbar-brand" href="/dashboard">
                <i class="fas fa-hotel me-2"></i>
                {{ hotelName() }} Management
            </a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav ms-auto">
                    <li class="nav-item dropdown">
                        <a class="nav-link position-relative" href="#" id="notificationsDropdown" role="button" data-bs-toggle="dropdown">
                            <i class="fas fa-bell"></i>
                            <span class="notification-badge">2</span>
                        </a>
                        <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="notificationsDropdown">
                            <li class="dropdown-header">Service Notifications</li>
                            <li><hr class="dropdown-divider"></li>
                            <li><a class="dropdown-item" href="#"><i class="fas fa-concierge-bell text-success me-2"></i> New room service request</a></li>
                            <li><a class="dropdown-item" href="#"><i class="fas fa-spa text-primary me-2"></i> Spa booking confirmed</a></li>
                        </ul>
                    </li>
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-bs-toggle="dropdown">
                            <i class="fas fa-user-circle me-1"></i> {{ Auth::user()->name ?? 'Admin User' }}
                        </a>
                        <ul class="dropdown-menu dropdown-menu-end">
                            <li><a class="dropdown-item" href="/profile"><i class="fas fa-user me-2"></i> Profile</a></li>
                            <li><a class="dropdown-item" href="/settings"><i class="fas fa-cog me-2"></i> Settings</a></li>
                            <li><hr class="dropdown-divider"></li>
                            <li>
                                <a class="dropdown-item" href="{{ route('logout') }}" 
                                   onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
                                    <i class="fas fa-sign-out-alt me-2"></i> Logout
                                </a>
                                <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                                    @csrf
                                </form>
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <!-- Sidebar -->
    <div class="sidebar" id="sidebar">
        <div class="sidebar-header text-center mb-4">
            <h5 class="text-white mb-0">Service Management</h5>
            <small class="text-light">Complete Service Control Panel</small>
        </div>
        
        <ul class="nav flex-column">
            <li class="nav-item">
                <a class="nav-link" href="/dashboard">
                    <i class="fas fa-home"></i> Dashboard
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="/rooms">
                    <i class="fas fa-bed"></i> Room Management
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="/maintenance">
                    <i class="fas fa-tools"></i> Maintenance
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="/reservations">
                    <i class="fas fa-calendar-check"></i> Reservations
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="/guests">
                    <i class="fas fa-users"></i> Guests
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="/inout">
                    <i class="fas fa-sign-in-alt"></i> In/Out Log
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link active" href="/services">
                    <i class="fas fa-concierge-bell"></i> Services
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="/pos">
                    <i class="fas fa-cash-register"></i> Point of Sale
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="/inventory">
                    <i class="fas fa-warehouse"></i> Inventory
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="/housekeeping">
                    <i class="fas fa-broom"></i> Housekeeping
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="/expenses">
                    <i class="fas fa-money-bill"></i> Expenses
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="/reports">
                    <i class="fas fa-chart-line"></i> Reports
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="/settings">
                    <i class="fas fa-cog"></i> Settings
                </a>
            </li>
        </ul>
        
        <div class="sidebar-footer mt-auto p-3 text-center">
            <small class="text-light">{{ hotelName() }} System v2.1</small>
        </div>
    </div>

    <!-- Main Content -->
    <div class="main-content">
        <!-- Page Header -->
        <div class="d-flex justify-content-between align-items-center mb-4">
            <div>
                <h2 class="mb-1 fw-bold">Create New Service</h2>
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="/dashboard">Dashboard</a></li>
                        <li class="breadcrumb-item"><a href="/services">Services</a></li>
                        <li class="breadcrumb-item active">Create Service</li>
                    </ol>
                </nav>
            </div>
            <div>
                <a href="/services" class="btn btn-outline-primary">
                    <i class="fas fa-arrow-left me-2"></i>Back to Services
                </a>
            </div>
        </div>

        <!-- Error/Success Messages -->
        <div id="alertContainer">
            @if(session('success'))
                <div class="alert alert-success alert-dismissible fade show" role="alert">
                    <i class="fas fa-check-circle me-2"></i>{{ session('success') }}
                    <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
                </div>
            @endif
            @if($errors->any())
                <div class="alert alert-danger alert-dismissible fade show" role="alert">
                    <i class="fas fa-exclamation-triangle me-2"></i>
                    <ul class="mb-0">
                        @foreach($errors->all() as $error)
                            <li>{{ $error }}</li>
                        @endforeach
                    </ul>
                    <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
                </div>
            @endif
        </div>

        <!-- Create Service Form -->
        <div class="row">
            <div class="col-lg-8">
                <div class="card dashboard-card">
                    <div class="card-header">
                        <h5 class="mb-0">Service Creation Wizard</h5>
                    </div>
                    <div class="card-body">
                        <!-- Step Progress -->
                        <div class="step-progress">
                            <div class="step active" id="step1">
                                <div class="step-number">1</div>
                                <div class="step-label">Basic Info</div>
                            </div>
                            <div class="step" id="step2">
                                <div class="step-number">2</div>
                                <div class="step-label">Pricing & Timing</div>
                            </div>
                            <div class="step" id="step3">
                                <div class="step-number">3</div>
                                <div class="step-label">Availability</div>
                            </div>
                            <div class="step" id="step4">
                                <div class="step-number">4</div>
                                <div class="step-label">Review</div>
                            </div>
                        </div>

                        <form action="{{ route('services.store') }}" method="POST" enctype="multipart/form-data" id="serviceForm">
                            @csrf
                            
                            <!-- Step 1: Basic Information -->
                            <div class="step-content" id="step1-content">
                                <h5 class="mb-4 text-primary"><i class="fas fa-info-circle me-2"></i>Basic Information</h5>
                                
                                <div class="row">
                                    <div class="col-md-6 mb-3">
                                        <label for="serviceName" class="form-label">Service Name *</label>
                                        <input type="text" class="form-control" id="serviceName" name="name" required 
                                               placeholder="e.g., Luxury Spa Package">
                                    </div>
                                    <div class="col-md-6 mb-3">
                                        <label for="serviceCategory" class="form-label">Category *</label>
                                        <select class="form-select" id="serviceCategory" name="service_category_id" required>
                                            <option value="">Select Category</option>
                                            @foreach($categories as $category)
                                                <option value="{{ $category->id }}" {{ old('service_category_id') == $category->id ? 'selected' : '' }}>
                                                    {{ $category->name }}
                                                </option>
                                            @endforeach
                                        </select>
                                    </div>
                                </div>
                                
                                <div class="mb-3">
                                    <label for="serviceDescription" class="form-label">Service Description</label>
                                    <textarea class="form-control" id="serviceDescription" name="description" rows="4" 
                                              placeholder="Describe the service in detail..."></textarea>
                                    <div class="form-text">Provide a clear description that helps guests understand what the service includes.</div>
                                </div>
                                
                                <div class="mb-3">
                                    <label for="serviceImage" class="form-label">Service Image</label>
                                    <input type="file" class="form-control" id="serviceImage" name="image" accept="image/*">
                                    <div class="form-text">Recommended size: 800x600px. Max file size: 2MB.</div>
                                    <img id="imagePreview" class="preview-image mt-2" src="#" alt="Image preview">
                                </div>
                                
                                <div class="d-flex justify-content-between mt-4">
                                    <div></div> <!-- Empty div for spacing -->
                                    <button type="button" class="btn btn-primary" onclick="showStep(2)">
                                        Next <i class="fas fa-arrow-right ms-2"></i>
                                    </button>
                                </div>
                            </div>

                            <!-- Step 2: Pricing & Timing -->
                            <div class="step-content" id="step2-content" style="display: none;">
                                <h5 class="mb-4 text-primary"><i class="fas fa-dollar-sign me-2"></i>Pricing & Timing</h5>
                                
                                <div class="row">
                                    <div class="col-md-4 mb-3">
                                        <label for="servicePrice" class="form-label">Price ($) *</label>
                                        <div class="input-group">
                                            <span class="input-group-text">$</span>
                                            <input type="number" class="form-control" id="servicePrice" name="price" 
                                                   step="0.01" min="0" required placeholder="0.00">
                                        </div>
                                    </div>
                                    <div class="col-md-4 mb-3">
                                        <label for="serviceDuration" class="form-label">Duration (minutes)</label>
                                        <input type="number" class="form-control" id="serviceDuration" name="duration" 
                                               min="0" placeholder="e.g., 60">
                                        <div class="form-text">Leave empty for flexible duration</div>
                                    </div>
                                    <div class="col-md-4 mb-3">
                                        <label for="serviceCapacity" class="form-label">Capacity (people)</label>
                                        <input type="number" class="form-control" id="serviceCapacity" name="capacity" 
                                               min="1" value="1">
                                    </div>
                                </div>
                                
                                <div class="row">
                                    <div class="col-md-6 mb-3">
                                        <label for="serviceStartTime" class="form-label">Available From</label>
                                        <input type="time" class="form-control" id="serviceStartTime" name="start_time" value="07:00">
                                    </div>
                                    <div class="col-md-6 mb-3">
                                        <label for="serviceEndTime" class="form-label">Available To</label>
                                        <input type="time" class="form-control" id="serviceEndTime" name="end_time" value="22:00">
                                    </div>
                                </div>
                                
                                <div class="mb-3">
                                    <label class="form-label">Pricing Type</label>
                                    <div>
                                        <div class="form-check form-check-inline">
                                            <input class="form-check-input" type="radio" name="pricing_type" id="fixedPrice" value="fixed" checked>
                                            <label class="form-check-label" for="fixedPrice">Fixed Price</label>
                                        </div>
                                        <div class="form-check form-check-inline">
                                            <input class="form-check-input" type="radio" name="pricing_type" id="hourlyRate" value="hourly">
                                            <label class="form-check-label" for="hourlyRate">Hourly Rate</label>
                                        </div>
                                        <div class="form-check form-check-inline">
                                            <input class="form-check-input" type="radio" name="pricing_type" id="perPerson" value="per_person">
                                            <label class="form-check-label" for="perPerson">Per Person</label>
                                        </div>
                                    </div>
                                </div>
                                
                                <div class="d-flex justify-content-between mt-4">
                                    <button type="button" class="btn btn-outline-primary" onclick="showStep(1)">
                                        <i class="fas fa-arrow-left me-2"></i>Back
                                    </button>
                                    <button type="button" class="btn btn-primary" onclick="showStep(3)">
                                        Next <i class="fas fa-arrow-right ms-2"></i>
                                    </button>
                                </div>
                            </div>

                            <!-- Step 3: Availability -->
                            <div class="step-content" id="step3-content" style="display: none;">
                                <h5 class="mb-4 text-primary"><i class="fas fa-calendar-alt me-2"></i>Availability Settings</h5>
                                
                                <div class="mb-4">
                                    <label class="form-label mb-3">Available Days</label>
                                    <div class="row" id="availabilityDays">
                                        <div class="col-md-4 mb-2">
                                            <div class="availability-day" data-day="monday">
                                                <div class="form-check">
                                                    <input class="form-check-input" type="checkbox" name="available_days[]" value="monday" id="monday" checked>
                                                    <label class="form-check-label fw-bold" for="monday">Monday</label>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-4 mb-2">
                                            <div class="availability-day" data-day="tuesday">
                                                <div class="form-check">
                                                    <input class="form-check-input" type="checkbox" name="available_days[]" value="tuesday" id="tuesday" checked>
                                                    <label class="form-check-label fw-bold" for="tuesday">Tuesday</label>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-4 mb-2">
                                            <div class="availability-day" data-day="wednesday">
                                                <div class="form-check">
                                                    <input class="form-check-input" type="checkbox" name="available_days[]" value="wednesday" id="wednesday" checked>
                                                    <label class="form-check-label fw-bold" for="wednesday">Wednesday</label>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-4 mb-2">
                                            <div class="availability-day" data-day="thursday">
                                                <div class="form-check">
                                                    <input class="form-check-input" type="checkbox" name="available_days[]" value="thursday" id="thursday" checked>
                                                    <label class="form-check-label fw-bold" for="thursday">Thursday</label>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-4 mb-2">
                                            <div class="availability-day" data-day="friday">
                                                <div class="form-check">
                                                    <input class="form-check-input" type="checkbox" name="available_days[]" value="friday" id="friday" checked>
                                                    <label class="form-check-label fw-bold" for="friday">Friday</label>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-4 mb-2">
                                            <div class="availability-day" data-day="saturday">
                                                <div class="form-check">
                                                    <input class="form-check-input" type="checkbox" name="available_days[]" value="saturday" id="saturday" checked>
                                                    <label class="form-check-label fw-bold" for="saturday">Saturday</label>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-4 mb-2">
                                            <div class="availability-day" data-day="sunday">
                                                <div class="form-check">
                                                    <input class="form-check-input" type="checkbox" name="available_days[]" value="sunday" id="sunday" checked>
                                                    <label class="form-check-label fw-bold" for="sunday">Sunday</label>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                
                                <div class="mb-3">
                                    <div class="form-check form-switch">
                                        <input class="form-check-input" type="checkbox" id="advanceBooking" name="advance_booking" checked>
                                        <label class="form-check-label" for="advanceBooking">
                                            Allow advance booking
                                        </label>
                                    </div>
                                </div>
                                
                                <div class="mb-3">
                                    <div class="form-check form-switch">
                                        <input class="form-check-input" type="checkbox" id="serviceActive" name="is_active" value="1" checked>
                                        <label class="form-check-label" for="serviceActive">
                                            Service is active and available to guests
                                        </label>
                                    </div>
                                </div>
                                
                                <div class="d-flex justify-content-between mt-4">
                                    <button type="button" class="btn btn-outline-primary" onclick="showStep(2)">
                                        <i class="fas fa-arrow-left me-2"></i>Back
                                    </button>
                                    <button type="button" class="btn btn-primary" onclick="showStep(4)">
                                        Next <i class="fas fa-arrow-right ms-2"></i>
                                    </button>
                                </div>
                            </div>

                            <!-- Step 4: Review & Submit -->
                            <div class="step-content" id="step4-content" style="display: none;">
                                <h5 class="mb-4 text-primary"><i class="fas fa-clipboard-check me-2"></i>Review Service Details</h5>
                                
                                <div class="card bg-light">
                                    <div class="card-body">
                                        <div class="row">
                                            <div class="col-md-6">
                                                <h6>Basic Information</h6>
                                                <p><strong>Name:</strong> <span id="reviewName">-</span></p>
                                                <p><strong>Category:</strong> <span id="reviewCategory">-</span></p>
                                                <p><strong>Description:</strong> <span id="reviewDescription">-</span></p>
                                            </div>
                                            <div class="col-md-6">
                                                <h6>Pricing & Timing</h6>
                                                <p><strong>Price:</strong> $<span id="reviewPrice">-</span></p>
                                                <p><strong>Duration:</strong> <span id="reviewDuration">-</span></p>
                                                <p><strong>Available:</strong> <span id="reviewTime">-</span></p>
                                            </div>
                                        </div>
                                        <div class="row mt-3">
                                            <div class="col-12">
                                                <h6>Availability</h6>
                                                <p><strong>Days:</strong> <span id="reviewDays">-</span></p>
                                                <p><strong>Status:</strong> <span id="reviewStatus">-</span></p>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                
                                <div class="d-flex justify-content-between mt-4">
                                    <button type="button" class="btn btn-outline-primary" onclick="showStep(3)">
                                        <i class="fas fa-arrow-left me-2"></i>Back
                                    </button>
                                    <button type="submit" class="btn btn-success">
                                        <i class="fas fa-check me-2"></i>Create Service
                                    </button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
            
            <!-- Sidebar with Tips and Recent Services -->
            <div class="col-lg-4">
                <!-- Quick Tips -->
                <div class="card dashboard-card mb-4">
                    <div class="card-header">
                        <h5 class="mb-0"><i class="fas fa-lightbulb me-2"></i>Quick Tips</h5>
                    </div>
                    <div class="card-body">
                        <div class="alert alert-info">
                            <h6><i class="fas fa-info-circle me-2"></i>Service Creation Best Practices</h6>
                            <ul class="small mb-0 ps-3">
                                <li>Use clear, descriptive names that guests will understand</li>
                                <li>Set appropriate pricing based on market rates</li>
                                <li>Define accurate duration to manage guest expectations</li>
                                <li>Upload high-quality images for better engagement</li>
                                <li>Set realistic availability based on staff capacity</li>
                            </ul>
                        </div>
                        
                        <h6 class="mt-3">Required Fields</h6>
                        <ul class="small text-muted">
                            <li>Service Name</li>
                            <li>Category</li>
                            <li>Price</li>
                        </ul>
                    </div>
                </div>
                
                <!-- Recent Services -->
                <div class="card dashboard-card">
                    <div class="card-header">
                        <h5 class="mb-0"><i class="fas fa-history me-2"></i>Recently Added</h5>
                    </div>
                    <div class="card-body">
                        <div class="list-group list-group-flush">
                            <div class="list-group-item px-0">
                                <div class="d-flex justify-content-between align-items-start">
                                    <div>
                                        <h6 class="mb-1">Luxury Spa Package</h6>
                                        <small class="text-muted">Spa & Wellness • $120</small>
                                    </div>
                                    <span class="badge bg-success">Active</span>
                                </div>
                            </div>
                            <div class="list-group-item px-0">
                                <div class="d-flex justify-content-between align-items-start">
                                    <div>
                                        <h6 class="mb-1">Executive Business Lunch</h6>
                                        <small class="text-muted">Room Service • $45</small>
                                    </div>
                                    <span class="badge bg-success">Active</span>
                                </div>
                            </div>
                            <div class="list-group-item px-0">
                                <div class="d-flex justify-content-between align-items-start">
                                    <div>
                                        <h6 class="mb-1">Airport Transfer</h6>
                                        <small class="text-muted">Transportation • $75</small>
                                    </div>
                                    <span class="badge bg-success">Active</span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // Sidebar toggle for mobile
        document.getElementById('sidebarToggle').addEventListener('click', function() {
            document.getElementById('sidebar').classList.toggle('show');
        });

        // Image preview functionality
        document.getElementById('serviceImage').addEventListener('change', function(e) {
            const file = e.target.files[0];
            if (file) {
                const reader = new FileReader();
                reader.onload = function(e) {
                    const preview = document.getElementById('imagePreview');
                    preview.src = e.target.result;
                    preview.style.display = 'block';
                }
                reader.readAsDataURL(file);
            }
        });

        // Availability day selection styling
        document.querySelectorAll('.availability-day').forEach(day => {
            day.addEventListener('click', function() {
                const checkbox = this.querySelector('input[type="checkbox"]');
                checkbox.checked = !checkbox.checked;
                this.classList.toggle('selected', checkbox.checked);
            });
            
            // Initialize selected state
            const checkbox = day.querySelector('input[type="checkbox"]');
            day.classList.toggle('selected', checkbox.checked);
        });

        // Multi-step form functionality
        let currentStep = 1;

        function showStep(step) {
            // Hide all steps
            document.querySelectorAll('.step-content').forEach(content => {
                content.style.display = 'none';
            });
            
            // Remove active class from all steps
            document.querySelectorAll('.step').forEach(stepEl => {
                stepEl.classList.remove('active');
            });
            
            // Show current step and mark as active
            document.getElementById(`step${step}-content`).style.display = 'block';
            document.getElementById(`step${step}`).classList.add('active');
            
            // Update review section if we're on the last step
            if (step === 4) {
                updateReviewSection();
            }
            
            currentStep = step;
        }

        function updateReviewSection() {
            // Basic Information
            document.getElementById('reviewName').textContent = document.getElementById('serviceName').value || '-';
            document.getElementById('reviewCategory').textContent = document.getElementById('serviceCategory').options[document.getElementById('serviceCategory').selectedIndex].text || '-';
            document.getElementById('reviewDescription').textContent = document.getElementById('serviceDescription').value || 'No description';
            
            // Pricing & Timing
            document.getElementById('reviewPrice').textContent = document.getElementById('servicePrice').value || '-';
            const duration = document.getElementById('serviceDuration').value;
            document.getElementById('reviewDuration').textContent = duration ? duration + ' minutes' : 'Flexible';
            document.getElementById('reviewTime').textContent = `${document.getElementById('serviceStartTime').value} - ${document.getElementById('serviceEndTime').value}`;
            
            // Availability
            const selectedDays = Array.from(document.querySelectorAll('input[name="available_days[]"]:checked'))
                .map(checkbox => {
                    const day = checkbox.value;
                    return day.charAt(0).toUpperCase() + day.slice(1);
                })
                .join(', ');
            document.getElementById('reviewDays').textContent = selectedDays || 'No days selected';
            
            const isActive = document.getElementById('serviceActive').checked;
            document.getElementById('reviewStatus').textContent = isActive ? 'Active' : 'Inactive';
        }

        // Form validation before submission
        document.getElementById('serviceForm').addEventListener('submit', function(e) {
            const name = document.getElementById('serviceName').value.trim();
            const category = document.getElementById('serviceCategory').value;
            const price = document.getElementById('servicePrice').value;
            
            if (!name || !category || !price) {
                e.preventDefault();
                alert('Please complete all required fields (Name, Category, and Price).');
                showStep(1);
            }
        });

        // Initialize the form on first step
        document.addEventListener('DOMContentLoaded', function() {
            showStep(1);
        });
    </script>
</body>
</html>
