<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Panel de control de OpenGnsys">
    <title>Panel de Control - OpenGnsys</title>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <style>
        :root {
            --primary-color: #2563eb;
            --primary-light: #3b82f6;
            --secondary-color: #1e40af;
            --success-color: #059669;
            --success-light: #10b981;
            --warning-color: #d97706;
            --danger-color: #dc2626;
            --danger-light: #ef4444;
            --background-color: #f8fafc;
            --text-color: #1e293b;
            --border-radius: 0.5rem;
            --transition: all 0.3s ease;
        }

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

        body {
            font-family: 'Inter', system-ui, -apple-system, sans-serif;
            background-color: var(--background-color);
            color: var(--text-color);
            line-height: 1.5;
            background-image: 
                radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.1) 0px, transparent 50%),
                radial-gradient(at 100% 100%, rgba(5, 150, 105, 0.1) 0px, transparent 50%);
            min-height: 100vh;
        }

        .navbar {
            background: #1e293b;
            padding: 1.5rem 2rem;
            position: fixed;
            width: 100%;
            top: 0;
            z-index: 1000;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            display: flex;
            align-items: center;
            justify-content: space-between;
            backdrop-filter: blur(10px);
        }

        .navbar-brand {
            display: flex;
            align-items: center;
        }

        .navbar-brand h1 {
            font-size: 1.5rem;
            font-weight: 700;
            color: white;
            margin: 0;
        }

        .navbar-actions {
            display: flex;
            gap: 1rem;
            align-items: center;
        }

        .action-btn {
            background: rgba(255, 255, 255, 0.1);
            color: white;
            border: 1px solid rgba(255, 255, 255, 0.2);
            padding: 0.75rem 1.25rem;
            border-radius: 25px;
            text-decoration: none;
            font-weight: 500;
            font-size: 0.9rem;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            display: flex;
            align-items: center;
            gap: 0.5rem;
            backdrop-filter: blur(10px);
        }

        .action-btn:hover {
            background: rgba(255, 255, 255, 0.2);
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
        }

        .action-btn.danger {
            background: rgba(220, 38, 38, 0.2);
            border-color: rgba(220, 38, 38, 0.4);
        }

        .action-btn.danger:hover {
            background: rgba(220, 38, 38, 0.3);
        }

        .action-btn i {
            font-size: 0.9rem;
        }

        .main-container {
            margin-top: 7rem;
            padding: 2rem;
            max-width: 1200px;
            margin-left: auto;
            margin-right: auto;
        }

        .welcome-section {
            text-align: center;
            margin-bottom: 3rem;
            position: relative;
        }

        .welcome-section h1 {
            font-size: 2.5rem;
            color: var(--text-color);
            margin-bottom: 1rem;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        .menu-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
            gap: 2rem;
            margin-bottom: 2rem;
            max-width: 800px;
            margin-left: auto;
            margin-right: auto;
        }

        .menu-item {
            background: white;
            border-radius: var(--border-radius);
            padding: 2.5rem;
            transition: var(--transition);
            box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
            min-height: 200px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            text-align: center;
            position: relative;
            overflow: hidden;
        }

        .menu-item::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            opacity: 0.1;
            transition: var(--transition);
        }

        .windows::before {
            background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
        }

        .linux::before {
            background: linear-gradient(135deg, var(--success-color), var(--success-light));
        }

        .apagar::before {
            background: linear-gradient(135deg, var(--danger-color), var(--danger-light));
        }

        .menu-item:hover {
            transform: translateY(-5px);
            box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
        }

        .menu-item:hover::before {
            opacity: 0.2;
        }

        .menu-item a {
            display: flex;
            align-items: center;
            gap: 1rem;
            text-decoration: none;
            color: var(--text-color);
            font-weight: 600;
            font-size: 1.5rem;
            margin-bottom: 1rem;
            padding: 1rem 2rem;
            border-radius: var(--border-radius);
            transition: var(--transition);
            position: relative;
            z-index: 1;
        }

        .menu-item i {
            font-size: 1.8rem;
        }

        .windows i { color: var(--primary-color); }
        .linux i { color: var(--success-color); }
        .apagar i { color: var(--danger-color); }

        .windows a:hover { 
            background-color: rgba(37, 99, 235, 0.1);
            color: var(--primary-color);
        }
        .linux a:hover { 
            background-color: rgba(5, 150, 105, 0.1);
            color: var(--success-color);
        }
        .apagar a:hover { 
            background-color: rgba(220, 38, 38, 0.1);
            color: var(--danger-color);
        }

        .menu-item p {
            color: #64748b;
            font-size: 1rem;
            max-width: 80%;
            margin: 0 auto;
            position: relative;
            z-index: 1;
        }

        .partitions-section {
            background: white;
            border-radius: var(--border-radius);
            padding: 2rem;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.2);
        }

        .partitions-section h2 {
            font-size: 1.5rem;
            margin-bottom: 1.5rem;
            color: var(--text-color);
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-weight: 700;
        }

        .partitions-table {
            width: 100%;
            border-collapse: separate;
            border-spacing: 0;
            background: white;
            border-radius: var(--border-radius);
            overflow: hidden;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
        }

        .partitions-table table {
            width: 100%;
        }

        .partitions-table thead {
            background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
            color: white;
            position: relative;
        }

        .partitions-table thead::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            height: 2px;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
        }

        .partitions-table th {
            padding: 1.25rem 1rem;
            text-align: left;
            font-weight: 600;
            font-size: 0.85rem;
            text-transform: uppercase;
            letter-spacing: 1px;
            position: relative;
        }

        .partitions-table th:not(:last-child)::after {
            content: '';
            position: absolute;
            right: 0;
            top: 25%;
            height: 50%;
            width: 1px;
            background: rgba(255, 255, 255, 0.2);
        }

        .partitions-table td {
            padding: 1.25rem 1rem;
            border-bottom: 1px solid #f1f5f9;
            vertical-align: middle;
            font-weight: 500;
            transition: all 0.2s ease;
        }

        .partitions-table td:last-child {
            text-align: center;
        }

        .partitions-table tbody tr {
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            position: relative;
        }

        .partitions-table tbody tr:hover {
            background: linear-gradient(135deg, #f8fafc, #f1f5f9);
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
            z-index: 1;
        }

        .partitions-table tbody tr:hover td {
            border-bottom-color: transparent;
        }

        .partitions-table tbody tr:last-child td {
            border-bottom: none;
        }

        .partition-boot-btn {
            background: linear-gradient(135deg, var(--success-color), var(--success-light));
            color: white;
            padding: 0.75rem 1.25rem;
            border-radius: 25px;
            text-decoration: none;
            font-weight: 600;
            font-size: 0.85rem;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            border: none;
            cursor: pointer;
            box-shadow: 0 4px 15px rgba(5, 150, 105, 0.3);
            position: relative;
            overflow: hidden;
        }

        .partition-boot-btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
            transition: left 0.5s;
        }

        .partition-boot-btn:hover {
            background: linear-gradient(135deg, var(--success-light), var(--success-color));
            transform: translateY(-3px);
            box-shadow: 0 8px 25px rgba(5, 150, 105, 0.4);
        }

        .partition-boot-btn:hover::before {
            left: 100%;
        }

        .partition-boot-btn i {
            font-size: 0.9rem;
            transition: transform 0.3s ease;
        }

        .partition-boot-btn:hover i {
            transform: scale(1.1);
        }

        .no-partitions {
            text-align: center;
            padding: 3rem 2rem;
            color: #64748b;
            font-style: italic;
            background: linear-gradient(135deg, #f8fafc, #f1f5f9);
            border-radius: var(--border-radius);
            border: 2px dashed #cbd5e1;
        }

        /* Estados especiales para diferentes tipos de particiones */
        .partition-os {
            font-weight: 600;
            color: var(--success-color);
        }

        .partition-no-os {
            color: #94a3b8;
            font-style: italic;
        }

        .partition-size {
            font-family: 'Monaco', 'Menlo', monospace;
            color: var(--primary-color);
            font-weight: 600;
        }

        .partition-type {
            text-transform: uppercase;
            font-size: 0.8rem;
            font-weight: 600;
            padding: 0.25rem 0.75rem;
            border-radius: 12px;
            background: #f1f5f9;
            color: #475569;
            display: inline-block;
        }

        @media (max-width: 768px) {
            .main-container {
                padding: 1rem;
            }

            .menu-grid {
                grid-template-columns: 1fr;
            }

            .partitions-table {
                font-size: 0.85rem;
            }

            .partitions-table th,
            .partitions-table td {
                padding: 0.75rem 0.5rem;
            }

            .partition-boot-btn {
                padding: 0.6rem 1rem;
                font-size: 0.8rem;
            }
        }
    </style>
</head>
<body>
    <nav class="navbar" role="navigation" aria-label="Navegación principal">
        <div class="navbar-brand">
            <h1>OpenGnsys</h1>
        </div>
        <div class="navbar-actions">
            <a href="command:reboot" class="action-btn">
                <i class="fas fa-sync"></i>
                Reiniciar
            </a>
            <a href="command:poweroff" class="action-btn danger">
                <i class="fas fa-power-off"></i>
                Apagar
            </a>
        </div>
    </nav>

    <main class="main-container">
        <section class="welcome-section">
            <img src="{{ asset('assets/img.png') }}" alt="Logo OpenGnsys">
            <h1>Bienvenido {{ ip }}</h1>
            {% if mac %}
                <p style="font-size: 1.2rem; color: #64748b; margin-top: 0.5rem;">
                    <i class="fas fa-network-wired"></i> MAC: <strong>{{ mac }}</strong>
                </p>
            {% endif %}
        </section>

        <section class="partitions-section">
            <h2><i class="fas fa-hdd"></i> Particiones del sistema</h2>
            
            {% if partitions|length > 0 %}
                <div class="partitions-table">
                    <table>
                        <thead>
                            <tr>
                                <th>Disco</th>
                                <th>Partición</th>
                                <th>Tamaño</th>
                                <th>Tipo</th>
                                <th>SO</th>
                                <th>Acciones</th>
                            </tr>
                        </thead>
                        <tbody>
                            {% for partition in partitions %}
                                <tr>
                                    <td><strong>{{ partition.diskNumber }}</strong></td>
                                    <td><span class="partition-type">{{ partition.partitionNumber }}</span></td>
                                    <td class="partition-size">{{ (partition.size / 1024)|number_format(2) }} MB</td>
                                    <td><span class="partition-type">{{ partition.filesystem }}</span></td>
                                    <td class="partition-os">{{ partition.operativeSystem ? partition.operativeSystem.name : '-' }}</td>
                                    <td>
                                        {% if partition.operativeSystem %}
                                            <a href="command+output:/opt/opengnsys/scripts/bootOs  {{ partition.diskNumber }} {{ partition.partitionNumber }}" 
                                               class="partition-boot-btn"
                                               role="button">
                                                <i class="fas fa-play"></i>
                                                Arrancar {{ partition.operativeSystem.name }}
                                            </a>
                                        {% endif %}
                                    </td>
                                </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>
            {% else %}
                <p class="no-partitions">No hay particiones disponibles.</p>
            {% endif %}
        </section>
    </main>
</body>
</html>
