<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=768, initial-scale=1.0">
    <title>App Mantenimiento - Checklist del Equipo</title>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <style>
        :root {
            --primary: #1a3a5c;
            --primary-dark: #0f2840;
            --primary-light: #2d5a8a;
            --accent: #e91e63;
            --accent-light: #f8bbd9;
            --success: #10b981;
            --warning: #f59e0b;
            --danger: #ef4444;
            --info: #3b82f6;
            --gray-50: #f8fafc;
            --gray-100: #f1f5f9;
            --gray-200: #e2e8f0;
            --gray-300: #cbd5e1;
            --gray-400: #94a3b8;
            --gray-500: #64748b;
            --gray-600: #475569;
            --gray-700: #334155;
            --gray-800: #1e293b;
            --gray-900: #0f172a;
            --white: #ffffff;
            --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
            --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
            --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1);
            --radius: 16px;
            --radius-sm: 12px;
            --radius-xs: 8px;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
            background: var(--gray-100);
            min-height: 100vh;
            color: var(--gray-800);
            -webkit-font-smoothing: antialiased;
        }

        .tablet-frame {
            max-width: 768px;
            margin: 0 auto;
            min-height: 100vh;
            background: var(--gray-50);
            position: relative;
        }

        /* Header */
        .compact-header {
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
            padding: 16px 20px;
            position: sticky;
            top: 0;
            z-index: 100;
        }

        .header-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .back-btn {
            width: 44px;
            height: 44px;
            border-radius: 50%;
            background: rgba(255,255,255,0.15);
            border: none;
            color: var(--white);
            font-size: 1.1rem;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            text-decoration: none;
        }

        .header-title {
            flex: 1;
            text-align: center;
        }

        .header-title h1 {
            font-size: 1.1rem;
            font-weight: 600;
            color: var(--white);
        }

        .header-title p {
            font-size: 0.8rem;
            color: rgba(255,255,255,0.7);
        }

        .header-btn {
            width: 44px;
            height: 44px;
            border-radius: 50%;
            background: rgba(255,255,255,0.15);
            border: none;
            color: var(--white);
            font-size: 1.1rem;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
        }

        /* Equipment Info Card */
        .equipment-header {
            background: var(--white);
            margin: 20px;
            border-radius: var(--radius);
            padding: 20px;
            box-shadow: var(--shadow);
            display: flex;
            gap: 16px;
            align-items: center;
        }

        .equipment-icon-large {
            width: 64px;
            height: 64px;
            border-radius: var(--radius-sm);
            background: rgba(236, 72, 153, 0.1);
            color: #ec4899;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.75rem;
            flex-shrink: 0;
        }

        .equipment-details {
            flex: 1;
        }

        .equipment-details h2 {
            font-size: 1.25rem;
            font-weight: 700;
            color: var(--gray-800);
            margin-bottom: 4px;
        }

        .equipment-details .code {
            font-size: 0.85rem;
            color: var(--gray-500);
            margin-bottom: 8px;
        }

        .equipment-details .location {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 0.85rem;
            color: var(--gray-600);
        }

        .equipment-details .location i {
            color: var(--gray-400);
        }

        .progress-circle {
            width: 60px;
            height: 60px;
            position: relative;
        }

        .progress-circle svg {
            transform: rotate(-90deg);
        }

        .progress-circle .bg {
            fill: none;
            stroke: var(--gray-200);
            stroke-width: 6;
        }

        .progress-circle .progress {
            fill: none;
            stroke: var(--warning);
            stroke-width: 6;
            stroke-linecap: round;
            stroke-dasharray: 157;
            stroke-dashoffset: calc(157 - (157 * 40) / 100);
            transition: stroke-dashoffset 0.5s;
        }

        .progress-circle .percentage {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            font-size: 0.85rem;
            font-weight: 700;
            color: var(--gray-800);
        }

        /* Main Content */
        .main-content {
            padding: 0 20px 160px;
        }

        .section-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
        }

        .section-title {
            font-size: 1.1rem;
            font-weight: 700;
            color: var(--gray-800);
        }

        .section-progress {
            font-size: 0.85rem;
            color: var(--gray-500);
            font-weight: 500;
        }

        /* Checklist Items */
        .checklist-container {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .checklist-item {
            background: var(--white);
            border-radius: var(--radius);
            box-shadow: var(--shadow-sm);
            overflow: hidden;
            transition: all 0.3s;
        }

        .checklist-item.completed {
            border-left: 4px solid var(--success);
        }

        .checklist-item.in-progress {
            border-left: 4px solid var(--warning);
        }

        .checklist-item.pending {
            border-left: 4px solid var(--gray-300);
        }

        .checklist-item-header {
            padding: 16px;
            display: flex;
            align-items: center;
            gap: 14px;
            cursor: pointer;
        }

        .check-box {
            width: 28px;
            height: 28px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            font-size: 0.9rem;
        }

        .check-box.completed {
            background: var(--success);
            color: var(--white);
        }

        .check-box.in-progress {
            background: rgba(245, 158, 11, 0.1);
            color: var(--warning);
            border: 2px solid var(--warning);
        }

        .check-box.pending {
            background: var(--gray-100);
            color: var(--gray-400);
            border: 2px solid var(--gray-300);
        }

        .checklist-item-info {
            flex: 1;
            min-width: 0;
        }

        .checklist-item-title {
            font-size: 0.95rem;
            font-weight: 600;
            color: var(--gray-800);
            margin-bottom: 2px;
        }

        .checklist-item.completed .checklist-item-title {
            text-decoration: line-through;
            color: var(--gray-500);
        }

        .checklist-item-subtitle {
            font-size: 0.8rem;
            color: var(--gray-500);
        }

        .checklist-item-expand {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            background: var(--gray-100);
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--gray-500);
            font-size: 0.85rem;
            transition: all 0.2s;
        }

        .checklist-item.expanded .checklist-item-expand {
            transform: rotate(180deg);
        }

        /* Checklist Expanded Content */
        .checklist-item-content {
            padding: 0 16px 16px;
            display: none;
        }

        .checklist-item.expanded .checklist-item-content {
            display: block;
        }

        .content-divider {
            height: 1px;
            background: var(--gray-100);
            margin-bottom: 16px;
        }

        /* Estado Selector */
        .estado-selector {
            margin-bottom: 16px;
        }

        .estado-label {
            font-size: 0.8rem;
            font-weight: 600;
            color: var(--gray-600);
            margin-bottom: 10px;
            display: block;
        }

        .estado-options {
            display: flex;
            gap: 10px;
        }

        .estado-option {
            flex: 1;
            padding: 12px;
            border-radius: var(--radius-xs);
            border: 2px solid var(--gray-200);
            text-align: center;
            cursor: pointer;
            transition: all 0.2s;
            background: var(--white);
        }

        .estado-option:hover {
            border-color: var(--gray-300);
        }

        .estado-option.selected.ok {
            border-color: var(--success);
            background: rgba(16, 185, 129, 0.05);
        }

        .estado-option.selected.rma {
            border-color: var(--danger);
            background: rgba(239, 68, 68, 0.05);
        }

        .estado-option.selected.pendiente {
            border-color: var(--warning);
            background: rgba(245, 158, 11, 0.05);
        }

        .estado-option i {
            font-size: 1.25rem;
            margin-bottom: 6px;
            display: block;
        }

        .estado-option.ok i { color: var(--success); }
        .estado-option.rma i { color: var(--danger); }
        .estado-option.pendiente i { color: var(--warning); }

        .estado-option span {
            font-size: 0.8rem;
            font-weight: 600;
            color: var(--gray-600);
        }

        /* Observación Input */
        .observacion-group {
            margin-bottom: 16px;
        }

        .observacion-label {
            font-size: 0.8rem;
            font-weight: 600;
            color: var(--gray-600);
            margin-bottom: 8px;
            display: block;
        }

        .observacion-input {
            width: 100%;
            padding: 12px 14px;
            border: 1px solid var(--gray-200);
            border-radius: var(--radius-xs);
            font-size: 0.9rem;
            resize: none;
            font-family: inherit;
            transition: all 0.2s;
        }

        .observacion-input:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(26, 58, 92, 0.1);
        }

        /* Image Upload */
        .image-section {
            margin-bottom: 16px;
        }

        .image-label {
            font-size: 0.8rem;
            font-weight: 600;
            color: var(--gray-600);
            margin-bottom: 10px;
            display: block;
        }

        .image-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 10px;
        }

        .image-item {
            aspect-ratio: 1;
            border-radius: var(--radius-xs);
            overflow: hidden;
            position: relative;
        }

        .image-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .image-item .delete-btn {
            position: absolute;
            top: 4px;
            right: 4px;
            width: 24px;
            height: 24px;
            border-radius: 50%;
            background: rgba(0,0,0,0.6);
            color: var(--white);
            border: none;
            font-size: 0.7rem;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .image-add {
            aspect-ratio: 1;
            border: 2px dashed var(--gray-300);
            border-radius: var(--radius-xs);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s;
            background: var(--gray-50);
        }

        .image-add:hover {
            border-color: var(--primary);
            background: rgba(26, 58, 92, 0.05);
        }

        .image-add i {
            font-size: 1.5rem;
            color: var(--gray-400);
            margin-bottom: 4px;
        }

        .image-add span {
            font-size: 0.7rem;
            color: var(--gray-500);
        }

        /* Save Button in item */
        .item-save-btn {
            width: 100%;
            padding: 12px;
            background: var(--primary);
            border: none;
            border-radius: var(--radius-xs);
            color: var(--white);
            font-size: 0.9rem;
            font-weight: 600;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            transition: all 0.2s;
        }

        .item-save-btn:hover {
            background: var(--primary-dark);
        }

        /* Bottom Action Bar */
        .bottom-action-bar {
            position: fixed;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 100%;
            max-width: 768px;
            background: var(--white);
            border-top: 1px solid var(--gray-200);
            padding: 16px 20px;
            padding-bottom: calc(16px + env(safe-area-inset-bottom));
            z-index: 100;
        }

        .action-bar-content {
            display: flex;
            gap: 12px;
        }

        .btn-secondary {
            flex: 1;
            padding: 16px;
            background: var(--gray-100);
            border: none;
            border-radius: var(--radius-sm);
            color: var(--gray-700);
            font-size: 0.95rem;
            font-weight: 600;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            transition: all 0.2s;
        }

        .btn-secondary:hover {
            background: var(--gray-200);
        }

        .btn-primary-action {
            flex: 2;
            padding: 16px;
            background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
            border: none;
            border-radius: var(--radius-sm);
            color: var(--white);
            font-size: 0.95rem;
            font-weight: 600;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
            transition: all 0.2s;
        }

        .btn-primary-action:hover {
            box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
        }

        /* Responsive */
        @media (max-width: 480px) {
            .equipment-header {
                flex-direction: column;
                text-align: center;
            }

            .image-grid {
                grid-template-columns: repeat(3, 1fr);
            }

            .estado-options {
                flex-direction: column;
            }
        }
    </style>
</head>
<body>
    <div class="tablet-frame">
        <!-- Header -->
        <header class="compact-header">
            <div class="header-row">
                <a href="04-lista-equipos.html" class="back-btn">
                    <i class="fas fa-arrow-left"></i>
                </a>
                <div class="header-title">
                    <h1>Checklist del Equipo</h1>
                    <p>Vía 3 - Carril Sur</p>
                </div>
                <button class="header-btn">
                    <i class="fas fa-ellipsis-v"></i>
                </button>
            </div>
        </header>

        <!-- Equipment Info Card -->
        <div class="equipment-header">
            <div class="equipment-icon-large">
                <i class="fas fa-video"></i>
            </div>
            <div class="equipment-details">
                <h2>Cámara LPR</h2>
                <div class="code">CAM-V3-003</div>
                <div class="location">
                    <i class="fas fa-map-marker-alt"></i>
                    Peaje Boliche - Vía 3
                </div>
            </div>
            <div class="progress-circle">
                <svg width="60" height="60" viewBox="0 0 60 60">
                    <circle class="bg" cx="30" cy="30" r="25"/>
                    <circle class="progress" cx="30" cy="30" r="25"/>
                </svg>
                <span class="percentage">40%</span>
            </div>
        </div>

        <!-- Main Content -->
        <main class="main-content">
            <div class="section-header">
                <h2 class="section-title">Items de Revisión</h2>
                <span class="section-progress">4 de 10 completados</span>
            </div>

            <div class="checklist-container">
                <!-- Item 1 - Completado -->
                <div class="checklist-item completed">
                    <div class="checklist-item-header">
                        <div class="check-box completed">
                            <i class="fas fa-check"></i>
                        </div>
                        <div class="checklist-item-info">
                            <div class="checklist-item-title">Verificar conexión de alimentación</div>
                            <div class="checklist-item-subtitle">Estado: OK</div>
                        </div>
                        <div class="checklist-item-expand">
                            <i class="fas fa-chevron-down"></i>
                        </div>
                    </div>
                </div>

                <!-- Item 2 - Completado -->
                <div class="checklist-item completed">
                    <div class="checklist-item-header">
                        <div class="check-box completed">
                            <i class="fas fa-check"></i>
                        </div>
                        <div class="checklist-item-info">
                            <div class="checklist-item-title">Revisar cableado de datos</div>
                            <div class="checklist-item-subtitle">Estado: OK</div>
                        </div>
                        <div class="checklist-item-expand">
                            <i class="fas fa-chevron-down"></i>
                        </div>
                    </div>
                </div>

                <!-- Item 3 - Completado -->
                <div class="checklist-item completed">
                    <div class="checklist-item-header">
                        <div class="check-box completed">
                            <i class="fas fa-check"></i>
                        </div>
                        <div class="checklist-item-info">
                            <div class="checklist-item-title">Limpiar lente de cámara</div>
                            <div class="checklist-item-subtitle">Estado: OK - Con observación</div>
                        </div>
                        <div class="checklist-item-expand">
                            <i class="fas fa-chevron-down"></i>
                        </div>
                    </div>
                </div>

                <!-- Item 4 - Completado -->
                <div class="checklist-item completed">
                    <div class="checklist-item-header">
                        <div class="check-box completed">
                            <i class="fas fa-check"></i>
                        </div>
                        <div class="checklist-item-info">
                            <div class="checklist-item-title">Verificar enfoque automático</div>
                            <div class="checklist-item-subtitle">Estado: OK</div>
                        </div>
                        <div class="checklist-item-expand">
                            <i class="fas fa-chevron-down"></i>
                        </div>
                    </div>
                </div>

                <!-- Item 5 - En Proceso (Expandido) -->
                <div class="checklist-item in-progress expanded">
                    <div class="checklist-item-header" onclick="this.parentElement.classList.toggle('expanded')">
                        <div class="check-box in-progress">
                            <i class="fas fa-minus"></i>
                        </div>
                        <div class="checklist-item-info">
                            <div class="checklist-item-title">Revisar iluminación infrarroja</div>
                            <div class="checklist-item-subtitle">En proceso de revisión</div>
                        </div>
                        <div class="checklist-item-expand">
                            <i class="fas fa-chevron-down"></i>
                        </div>
                    </div>
                    <div class="checklist-item-content">
                        <div class="content-divider"></div>

                        <!-- Estado Selector -->
                        <div class="estado-selector">
                            <label class="estado-label">Estado del Item</label>
                            <div class="estado-options">
                                <div class="estado-option ok" onclick="selectEstado(this, 'ok')">
                                    <i class="fas fa-check-circle"></i>
                                    <span>OK</span>
                                </div>
                                <div class="estado-option rma selected" onclick="selectEstado(this, 'rma')">
                                    <i class="fas fa-exclamation-triangle"></i>
                                    <span>RMA</span>
                                </div>
                                <div class="estado-option pendiente" onclick="selectEstado(this, 'pendiente')">
                                    <i class="fas fa-clock"></i>
                                    <span>Pendiente</span>
                                </div>
                            </div>
                        </div>

                        <!-- Observación -->
                        <div class="observacion-group">
                            <label class="observacion-label">Observación</label>
                            <textarea class="observacion-input" rows="3" placeholder="Ingrese una observación sobre este item...">LED infrarrojo superior no enciende, requiere reemplazo.</textarea>
                        </div>

                        <!-- Imágenes -->
                        <div class="image-section">
                            <label class="image-label">Evidencia Fotográfica</label>
                            <div class="image-grid">
                                <div class="image-item">
                                    <img src="https://via.placeholder.com/150/1a3a5c/ffffff?text=Foto+1" alt="Evidencia 1">
                                    <button class="delete-btn"><i class="fas fa-times"></i></button>
                                </div>
                                <div class="image-item">
                                    <img src="https://via.placeholder.com/150/e91e63/ffffff?text=Foto+2" alt="Evidencia 2">
                                    <button class="delete-btn"><i class="fas fa-times"></i></button>
                                </div>
                                <div class="image-add" onclick="document.getElementById('imageInput').click()">
                                    <i class="fas fa-camera"></i>
                                    <span>Agregar</span>
                                </div>
                            </div>
                            <input type="file" id="imageInput" accept="image/*" capture="environment" style="display: none;">
                        </div>

                        <!-- Save Button -->
                        <button class="item-save-btn">
                            <i class="fas fa-save"></i>
                            Guardar Item
                        </button>
                    </div>
                </div>

                <!-- Item 6 - Pendiente -->
                <div class="checklist-item pending">
                    <div class="checklist-item-header" onclick="this.parentElement.classList.toggle('expanded')">
                        <div class="check-box pending">
                            <span></span>
                        </div>
                        <div class="checklist-item-info">
                            <div class="checklist-item-title">Verificar comunicación con servidor</div>
                            <div class="checklist-item-subtitle">Pendiente de revisión</div>
                        </div>
                        <div class="checklist-item-expand">
                            <i class="fas fa-chevron-down"></i>
                        </div>
                    </div>
                    <div class="checklist-item-content">
                        <div class="content-divider"></div>
                        <div class="estado-selector">
                            <label class="estado-label">Estado del Item</label>
                            <div class="estado-options">
                                <div class="estado-option ok" onclick="selectEstado(this, 'ok')">
                                    <i class="fas fa-check-circle"></i>
                                    <span>OK</span>
                                </div>
                                <div class="estado-option rma" onclick="selectEstado(this, 'rma')">
                                    <i class="fas fa-exclamation-triangle"></i>
                                    <span>RMA</span>
                                </div>
                                <div class="estado-option pendiente" onclick="selectEstado(this, 'pendiente')">
                                    <i class="fas fa-clock"></i>
                                    <span>Pendiente</span>
                                </div>
                            </div>
                        </div>
                        <div class="observacion-group">
                            <label class="observacion-label">Observación</label>
                            <textarea class="observacion-input" rows="3" placeholder="Ingrese una observación sobre este item..."></textarea>
                        </div>
                        <div class="image-section">
                            <label class="image-label">Evidencia Fotográfica</label>
                            <div class="image-grid">
                                <div class="image-add">
                                    <i class="fas fa-camera"></i>
                                    <span>Agregar</span>
                                </div>
                            </div>
                        </div>
                        <button class="item-save-btn">
                            <i class="fas fa-save"></i>
                            Guardar Item
                        </button>
                    </div>
                </div>

                <!-- Item 7 - Pendiente -->
                <div class="checklist-item pending">
                    <div class="checklist-item-header">
                        <div class="check-box pending">
                            <span></span>
                        </div>
                        <div class="checklist-item-info">
                            <div class="checklist-item-title">Comprobar captura de placas</div>
                            <div class="checklist-item-subtitle">Pendiente de revisión</div>
                        </div>
                        <div class="checklist-item-expand">
                            <i class="fas fa-chevron-down"></i>
                        </div>
                    </div>
                </div>

                <!-- Item 8 - Pendiente -->
                <div class="checklist-item pending">
                    <div class="checklist-item-header">
                        <div class="check-box pending">
                            <span></span>
                        </div>
                        <div class="checklist-item-info">
                            <div class="checklist-item-title">Verificar ángulo de captura</div>
                            <div class="checklist-item-subtitle">Pendiente de revisión</div>
                        </div>
                        <div class="checklist-item-expand">
                            <i class="fas fa-chevron-down"></i>
                        </div>
                    </div>
                </div>

                <!-- Item 9 - Pendiente -->
                <div class="checklist-item pending">
                    <div class="checklist-item-header">
                        <div class="check-box pending">
                            <span></span>
                        </div>
                        <div class="checklist-item-info">
                            <div class="checklist-item-title">Revisar carcasa y montaje</div>
                            <div class="checklist-item-subtitle">Pendiente de revisión</div>
                        </div>
                        <div class="checklist-item-expand">
                            <i class="fas fa-chevron-down"></i>
                        </div>
                    </div>
                </div>

                <!-- Item 10 - Pendiente -->
                <div class="checklist-item pending">
                    <div class="checklist-item-header">
                        <div class="check-box pending">
                            <span></span>
                        </div>
                        <div class="checklist-item-info">
                            <div class="checklist-item-title">Actualizar firmware si aplica</div>
                            <div class="checklist-item-subtitle">Pendiente de revisión</div>
                        </div>
                        <div class="checklist-item-expand">
                            <i class="fas fa-chevron-down"></i>
                        </div>
                    </div>
                </div>
            </div>
        </main>

        <!-- Bottom Action Bar -->
        <div class="bottom-action-bar">
            <div class="action-bar-content">
                <button class="btn-secondary">
                    <i class="fas fa-camera"></i>
                    Foto General
                </button>
                <button class="btn-primary-action">
                    <i class="fas fa-check-circle"></i>
                    Finalizar Equipo
                </button>
            </div>
        </div>
    </div>

    <script>
        function selectEstado(element, tipo) {
            const parent = element.closest('.estado-options');
            parent.querySelectorAll('.estado-option').forEach(opt => {
                opt.classList.remove('selected');
            });
            element.classList.add('selected');
        }

        // Toggle expandir/colapsar items
        document.querySelectorAll('.checklist-item-header').forEach(header => {
            header.addEventListener('click', function() {
                const item = this.closest('.checklist-item');
                if (!item.classList.contains('completed')) {
                    item.classList.toggle('expanded');
                }
            });
        });
    </script>
</body>
</html>
