@extends('layouts.yellow')

@section('content')
<style>
  :root {
    --azul-primario: #2A4E6D;
    --azul-secundario: #3B6EA5;
    --azul-destacado: #4A90E2;
    --azul-suave: #E3F2FD;
    --degradado-azul: linear-gradient(135deg, #4A90E2 0%, #2A4E6D 100%);
    --amarillo-primario: #FFD54F;
    --amarillo-secundario: #FFECB3;
    --naranja-destacado: #FF9800;
    --verde-exito: #4CAF50;
    --rojo-error: #F44336;
    --gris-claro: #F5F7FA;
    --gris-medio: #E1E5E9;
    --gris-oscuro: #6C757D;
    --borde-principal: #D0D7DE;
    --sombra-suave: 0 4px 12px rgba(0, 0, 0, 0.05);
    --sombra-media: 0 6px 16px rgba(0, 0, 0, 0.08);
    --sombra-hover: 0 8px 24px rgba(0, 0, 0, 0.12);
    --transicion: all 0.3s ease;
    --fuente-principal: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  }

  /* Contenedor principal con animación */
  .services-form-container {
    font-family: var(--fuente-principal);
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--sombra-media);
    animation: fadeIn 0.5s ease-out;
    max-width: 1200px;
    margin: 0 auto;
    overflow: hidden;
  }

  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }

  /* Cabecera del formulario */
  .services-form-header {
    background: var(--degradado-azul);
    color: white;
    padding: 1.5rem 2rem;
    position: relative;
    overflow: hidden;
  }

  .services-form-header::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 150px;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    clip-path: polygon(100% 0, 0 0, 100% 100%);
  }

  .services-form-header h3 {
    margin: 0;
    font-weight: 600;
    display: flex;
    align-items: center;
  }

  .services-form-header h3 i {
    margin-right: 10px;
    font-size: 1.2em;
  }

  .services-form-body {
    padding: 2rem;
  }

  /* Campos del formulario */
  .form-group label {
    font-weight: 600;
    color: var(--azul-primario);
    margin-bottom: 8px;
    display: block;
    font-size: 0.95rem;
    transition: var(--transicion);
  }

  .form-control {
    border: 2px solid var(--borde-principal);
    border-radius: 10px;
    padding: 12px 15px;
    width: 100%;
    color: #333;
    font-size: 1rem;
    transition: var(--transicion);
    background-color: var(--gris-claro);
  }

  .form-control:hover {
    border-color: var(--azul-secundario);
    background-color: #fff;
  }
  
  .form-control:focus {
    border-color: var(--azul-destacado);
    box-shadow: 0 0 0 4px rgba(74,144,226,0.15);
    outline: none;
    background-color: #fff;
  }

  /* Selects con estilo personalizado */
  select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234A90E2'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 35px;
    cursor: pointer;
  }

  /* Botones con efectos */
  .btn-primary {
    background: var(--degradado-azul);
    color: #fff;
    padding: 12px 25px;
    border-radius: 50px;
    border: none;
    transition: var(--transicion);
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(74,144,226,0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(42,78,109,0.4);
  }

  .btn-primary:active {
    transform: translateY(1px);
    box-shadow: 0 3px 8px rgba(42,78,109,0.4);
  }

  /* Efecto de onda en botón */
  .btn-primary::after {
    content: "";
    display: block;
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    transform: scale(0);
    transition: transform 0.5s;
  }

  .btn-primary:active::after {
    transform: scale(2);
    opacity: 0;
    transition: transform 0s, opacity 0.5s;
  }

  .btn-primary i {
    margin-right: 8px;
  }

  .btn-light {
    background: white;
    color: var(--azul-primario);
    border: none;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: var(--transicion);
    display: inline-flex;
    align-items: center;
  }

  .btn-light:hover {
    background: var(--gris-claro);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  }

  .btn-light i {
    margin-right: 8px;
  }

  /* Alerta de errores */
  .alert-danger {
    background-color: rgba(244,67,54,0.1);
    border-left: 4px solid var(--rojo-error);
    color: #d32f2f;
    border-radius: 0;
    padding: 1rem;
    margin-bottom: 1.5rem;
  }

  .alert-danger ul {
    padding-left: 1.5rem;
  }

  /* Responsive */
  @media (max-width: 767px) {
    .services-form-container {
      border-radius: 0;
      box-shadow: none;
    }
    
    .services-form-body {
      padding: 1.5rem;
    }
    
    .services-form-header {
      padding: 1.2rem 1.5rem;
    }
    
    .form-control {
      padding: 10px 12px;
    }
    
    .btn-primary {
      width: 100%;
      margin-bottom: 0.5rem;
    }
  }
</style>

<div class="container-fluid">
  <div class="services-form-container">
    <div class="services-form-header">
      <div class="d-flex justify-content-between align-items-center">
        <h3><i class="fas fa-heartbeat"></i> Crear Servicio Médico</h3>
        <a href="{{ route('/admin/view-medical-services') }}" class="btn-light">
          <i class="fas fa-arrow-left"></i> Volver
        </a>
      </div>
    </div>
    
    <div class="services-form-body">
      @if($errors->any())
        <div class="alert alert-danger">
          <ul class="mb-0">
            @foreach($errors->all() as $error)
              <li>{{ $error }}</li>
            @endforeach
          </ul>
        </div>
      @endif

      <form action="{{ route('/admin/create-medical-services') }}" method="POST">
        @csrf
        
        <div class="row mb-4">
          <div class="col-md-6">
            <div class="form-group mb-3">
              <label for="name"><i class="fas fa-tag me-2"></i>Nombre del Servicio</label>
              <input type="text" class="form-control" id="name" name="name" value="{{ old('name') }}" 
                placeholder="Ingrese el nombre del servicio" required>
            </div>
          </div>
          <div class="col-md-6">
            <div class="form-group mb-3">
              <label for="cost"><i class="fas fa-dollar-sign me-2"></i>Costo</label>
              <input type="number" step="0.01" class="form-control" id="cost" name="cost" 
                value="{{ old('cost') }}" placeholder="0.00" required>
            </div>
          </div>
        </div>

        <div class="row mb-4">
          <div class="col-md-6">
            <div class="form-group mb-3">
              <label for="currency_id"><i class="fas fa-money-bill-wave me-2"></i>Moneda</label>
              <select class="form-control" id="currency_id" name="currency_id" required>
                <option value="">Seleccione una moneda</option>
                @foreach($currencies as $currency)
                  <option value="{{ $currency->id }}" {{ old('currency_id') == $currency->id ? 'selected' : '' }}>
                    {{ strtoupper($currency->title) }}
                  </option>
                @endforeach
              </select>
            </div>
          </div>
          <div class="col-md-6">
            <div class="form-group mb-3">
              <label for="is_active"><i class="fas fa-toggle-on me-2"></i>Estado</label>
              <select class="form-control" id="is_active" name="is_active">
                <option value="1" {{ old('is_active', '1') == '1' ? 'selected' : '' }}>Activo</option>
                <option value="0" {{ old('is_active') == '0' ? 'selected' : '' }}>Inactivo</option>
              </select>
            </div>
          </div>
        </div>

        <div class="form-group mb-4">
          <label for="description"><i class="fas fa-align-left me-2"></i>Descripción</label>
          <textarea class="form-control" id="description" name="description" rows="4" 
            placeholder="Ingrese una descripción del servicio">{{ old('description') }}</textarea>
        </div>

        <div class="text-end">
          <button type="submit" class="btn-primary">
            <i class="fas fa-save"></i> Guardar Servicio
          </button>
        </div>
      </form>
    </div>
  </div>
</div>
@endsection 