@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;
    }

    .xray-editor {
        font-family: var(--fuente-principal);
        animation: fadeIn 0.5s ease-out;
    }

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

    .xray-header {
        background: var(--degradado-azul);
        color: white;
        border-radius: 12px;
        box-shadow: var(--sombra-media);
        padding: 1.5rem 2rem;
        position: relative;
        overflow: hidden;
    }

    .xray-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%);
    }

    .xray-header h2 {
        margin: 0;
        font-weight: 600;
        display: flex;
        align-items: center;
    }

    .xray-header h2:before {
        content: "\f49e";
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        margin-right: 10px;
    }

    .editor-sidebar {
        background: var(--degradado-azul);
        padding: 1.5rem;
        border-radius: 12px;
        min-height: 80vh;
        box-shadow: var(--sombra-media);
    }

    .filter-card {
        background: rgba(255, 255, 255, 0.9) !important;
        border-radius: 10px;
        padding: 0.5rem;
        cursor: pointer;
        transition: var(--transicion);
        border: 2px solid transparent;
    }

    .filter-card:hover {
        transform: translateY(-3px);
        box-shadow: var(--sombra-hover);
        border-color: var(--amarillo-primario);
    }

    .editor-tool-btn {
        border-radius: 50px;
        padding: 0.75rem 1rem;
        margin: 0.5rem 0;
        width: 100%;
        transition: var(--transicion);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        font-weight: 500;
    }

    .btn-outline-light:hover {
        background-color: var(--amarillo-primario);
        color: var(--azul-primario);
        border-color: var(--amarillo-primario);
        transform: translateY(-3px);
        box-shadow: var(--sombra-hover);
    }

    .btn-light {
        background: white;
        color: var(--azul-primario);
        border: none;
    }

    .btn-light:hover {
        background-color: var(--amarillo-primario);
        color: var(--azul-primario);
        transform: translateY(-3px);
        box-shadow: var(--sombra-hover);
    }

    #cropperContainer {
        background: #f8f9fa;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: var(--sombra-media);
        max-height: 80vh;
    }

    #previewImage {
        width: 100%;
        height: auto;
        object-fit: contain;
        background: repeating-conic-gradient(#f0f0f0 0% 25%, white 0% 50%) 50% / 20px 20px;
    }

    @media (max-width: 768px) {
        .editor-sidebar {
            min-height: auto;
            margin-bottom: 1.5rem;
        }
        
        #cropperContainer {
            max-height: 50vh;
        }
    }
</style>

<div class="container-fluid xray-editor">
    <div class="row mb-4">
        <div class="col-12">
            <div class="xray-header">
                <h2>{{ __('xray-editing.titleView') }}</h2>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="container-fluid">
            <div class="row">
                <!-- Sidebar de herramientas -->
                <div class="col-md-3 mb-4 mb-md-0">
                    <div class="editor-sidebar">
                        <div class="row">
                            <div class="col-12">
                                <input type="file" id="inputImage" accept="image/*" hidden>
                                <button id="upload" class="btn btn-outline-light editor-tool-btn">
                                    <img src="{{asset('img/upload-icon.png')}}" width="20" alt="">
                                    {{ __('Subir Radiografía') }}
                                </button>
                            </div>
                            
                            <div class="col-12">
                                <button id="restore" class="btn btn-outline-light editor-tool-btn">
                                    <img src="{{asset('img/restore-icon.png')}}" width="20" alt="">
                                    {{ __('Restaurar') }}
                                </button>
                            </div>

                            <div class="col-12">
                                <button id="cropButton" class="btn btn-light editor-tool-btn">
                                    <img src="{{asset('img/crop-icon.png')}}" width="20" alt="">
                                    {{ __('Recortar y guardar') }}
                                </button>
                            </div>

                            <!-- Filtros -->
                            <div class="col-12 mt-4">
                                <div class="row g-2">
                                    <div class="col-4">
                                            <div id="filter1" class="filter-card" style="background-color: #dde3e8;">
                                                <img src="{{asset('img/icon-xray.png')}}" width="100" alt="" style="filter:grayscale(1)">
                                            </div>
                                    </div>
                                    <div class="col-4">
                                        <div id="filter2" class="filter-card" style="background-color: #c5ccd4;">
                                                <img src="{{asset('img/icon-xray.png')}}" width="100" alt="" style="filter:sepia(1)">
                                        </div>
                                    </div>
                                    <div class="col-4">
                                        <div id="filter3" class="filter-card" style="background-color: #abb5c0;" >
                                                <img src="{{asset('img/icon-xray.png')}}" width="100" alt="" style="filter: invert(1);">
                                        </div>
                                    </div>
                                    <div class="col-4">
                                        <div id="filter4" class="filter-card" style="background-color: #dde3e8;">
                                             <img src="{{asset('img/icon-xray.png')}}" width="100" alt="" style="filter:grayscale(1) invert(1)">
                                        </div>
                                    </div>
                                    <div class="col-4">
                                        <div id="filter5" class="filter-card" style="background-color: #c5ccd4;">
                                             <img src="{{asset('img/icon-xray.png')}}" width="100" alt="" style="filter:sepia(1) invert(1)">
                                        </div>
                                    </div>
                                    <div class="col-4">
                                         <div id="filter6" class="filter-card" style="background-color: #abb5c0;" >
                                            <img src="{{asset('img/icon-xray.png')}}" width="100" alt="" style="filter:saturate(0.5) invert(1);">
                                        </div>
                                    </div>
                                </div>
                                <!-- Añade esto dentro del bloque de filtros existente -->
                                <div class="col-12 mt-4">
                                <div class="row g-2">
                                    <!-- Brillo aumentado -->
                                    <div class="col-4">
                                    <div id="filter7" class="filter-card" style="background-color: #f9e79f;">
                                        <img src="{{asset('img/icon-xray.png')}}" width="100" alt="" style="filter: brightness(1.5);">
                                    </div>
                                    </div>
                                    <!-- Contraste alto -->
                                    <div class="col-4">
                                    <div id="filter8" class="filter-card" style="background-color: #f5cba7;">
                                        <img src="{{asset('img/icon-xray.png')}}" width="100" alt="" style="filter: contrast(2);">
                                    </div>
                                    </div>
                                    <!-- Desenfoque suave -->
                                    <div class="col-4">
                                    <div id="filter9" class="filter-card" style="background-color: #d6eaf8;">
                                        <img src="{{asset('img/icon-xray.png')}}" width="100" alt="" style="filter: blur(2px);">
                                    </div>
                                    </div>
                                    <!-- Tonos fríos -->
                                    <div class="col-4">
                                    <div id="filter10" class="filter-card" style="background-color: #aed6f1;">
                                        <img src="{{asset('img/icon-xray.png')}}" width="100" alt="" style="filter: sepia(0.3) hue-rotate(180deg) saturate(1.2);">
                                    </div>
                                    </div>
                                    <!-- Tonos cálidos -->
                                    <div class="col-4">
                                    <div id="filter11" class="filter-card" style="background-color: #fadbd8;">
                                        <img src="{{asset('img/icon-xray.png')}}" width="100" alt="" style="filter: sepia(0.4) hue-rotate(-20deg) brightness(1.1);">
                                    </div>
                                    </div>
                                    <!-- Alto detalle (sharpness simulado) -->
                                    <div class="col-4">
                                    <div id="filter12" class="filter-card" style="background-color: #d5f5e3;">
                                        <img src="{{asset('img/icon-xray.png')}}" width="100" alt="" style="filter: contrast(1.2) brightness(1.1) saturate(1.3);">
                                    </div>
                                    </div>
                                </div>
                                </div>

                            </div>
                        </div>
                    </div>
                </div>

                <!-- Área de edición -->
                <div class="col-md-9">
                    <div id="cropperContainer">
                        <img id="previewImage" src="{{asset('img/icon-xray.png')}}">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    let xr = new XrayUtilities();
    xr.init();
</script>
@endsection