import { Icon } from "@iconify/react";
import { useNavigate } from "react-router-dom";
import styled from "styled-components";
import { AuditoriaLogs } from "../components/organismos/auditoria/AuditoriaLogs";

export function ReporteAuditoria() {
  const navigate = useNavigate();

  return (
    <Container>
      <Header>
        <HeaderContent>
          <BackBtn onClick={() => navigate("/reportes")} title="Volver a Reportes">
            <Icon icon="lucide:arrow-left" />
          </BackBtn>
          <TitleSection>
            <MainTitle>
              <Icon icon="lucide:shield-check" />
              Logs de Auditoría
            </MainTitle>
            <Subtitle>
              Registro centralizado de todas las acciones y cambios en tu empresa
            </Subtitle>
          </TitleSection>
        </HeaderContent>
      </Header>
      <ContentSection>
        <AuditoriaLogs />
      </ContentSection>
    </Container>
  );
}

const Container = styled.div`background: ${({ theme }) => theme.body};`;

const Header = styled.div`
  background: linear-gradient(135deg, ${({ theme }) => theme.bg3} 0%, ${({ theme }) => theme.bg4} 100%);
  border-bottom: 1px solid ${({ theme }) => theme.bg4};
  padding: 0.6rem 1.5rem;
  @media (max-width: 768px) { padding: 0.5rem 1rem; }
`;

const HeaderContent = styled.div`
  max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 0.75rem;
`;

const BackBtn = styled.button`
  display: flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: 8px; border: 1px solid ${({ theme }) => theme.bg4};
  background: ${({ theme }) => theme.bg3}60; color: ${({ theme }) => theme.text}; cursor: pointer;
  transition: all 0.15s; flex-shrink: 0;
  svg { width: 1rem; height: 1rem; }
  &:hover { background: ${({ theme }) => theme.bg4}; }
`;

const TitleSection = styled.div`flex: 1;`;

const MainTitle = styled.h1`
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 1.4rem; font-weight: 700; color: ${({ theme }) => theme.text}; margin: 0 0 0.15rem 0;
  svg { color: #f88533; width: 1.4rem; height: 1.4rem; }
  @media (max-width: 768px) { font-size: 1.2rem; svg { width: 1.2rem; height: 1.2rem; } }
`;

const Subtitle = styled.p`
  font-size: 0.8rem; color: ${({ theme }) => theme.text}cc; margin: 0;
  @media (max-width: 768px) { font-size: 0.75rem; }
`;

const ContentSection = styled.div`
  max-width: 1200px; margin: 0 auto; padding: 0.75rem 1.5rem;
  @media (max-width: 768px) { padding: 0.75rem 1rem; }
`;
