<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.DatePicker?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Priority?>
<?import javafx.scene.layout.Region?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>

<VBox spacing="12.0" style="-fx-font-size: 14px;" xmlns="http://javafx.com/javafx/25" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.example.petshopdesktop.controllers.ActivityLogController">
    <padding>
        <Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
    </padding>

    <children>

        <HBox alignment="CENTER_LEFT" spacing="12.0">
            <children>
                <Label text="Activity Logs" textFill="#2c3e50">
                    <font>
                        <Font name="System Bold" size="30.0" />
                    </font>
                </Label>
                <Region HBox.hgrow="ALWAYS" />
                <Button fx:id="btnRefresh" mnemonicParsing="false" onAction="#btnRefreshClicked"
                        prefHeight="36.0" prefWidth="100.0"
                        style="-fx-background-color: #4ECDC4; -fx-cursor: hand; -fx-background-radius: 8;"
                        text="Refresh" textFill="WHITE">
                    <font><Font name="System Bold" size="13.0" /></font>
                </Button>
            </children>
        </HBox>

        <HBox alignment="CENTER_LEFT" spacing="10.0">
            <children>
                <TextField fx:id="tfSearch" promptText="Search activity or user…"
                           prefHeight="36.0" HBox.hgrow="ALWAYS"
                           style="-fx-background-radius: 8; -fx-border-radius: 8; -fx-border-color: #e2e8f0;" />

                <ComboBox fx:id="cbRoleFilter" prefHeight="36.0" prefWidth="130.0"
                          style="-fx-background-radius: 8;" />

                <ComboBox fx:id="cbStoreFilter" prefHeight="36.0" prefWidth="160.0"
                          style="-fx-background-radius: 8;" />
            </children>
        </HBox>

        <HBox alignment="CENTER_LEFT" spacing="10.0">
            <children>
                <Label text="From" textFill="#64748b" />
                <DatePicker fx:id="dpStart" onAction="#onDateChanged" promptText="Start date" prefWidth="140.0" prefHeight="36.0" />
                <Label text="To" textFill="#64748b" />
                <DatePicker fx:id="dpEnd" onAction="#onDateChanged" promptText="End date" prefWidth="140.0" prefHeight="36.0" />
                <Region HBox.hgrow="ALWAYS" />
                <CheckBox fx:id="chkHideViewOnly" onAction="#onFilterChanged" text="Hide view-only" />
            </children>
        </HBox>

        <TableView fx:id="tvActivityLogs" style="-fx-background-color: white; -fx-background-radius: 12;" VBox.vgrow="ALWAYS">
            <columns>
                <TableColumn fx:id="colTimestamp" prefWidth="150.0" text="Timestamp" />
                <TableColumn fx:id="colUser" prefWidth="160.0" text="User" />
                <TableColumn fx:id="colRole" prefWidth="90.0" text="Role" />
                <TableColumn fx:id="colStore" prefWidth="140.0" text="Store" />
                <TableColumn fx:id="colActivity" prefWidth="560.0" text="Activity" />
            </columns>
        </TableView>

        <Label fx:id="lblStatus" text="" textFill="#64748b" visible="false" managed="true" />
        <Label fx:id="lblError" text="" textFill="#FF6B6B" wrapText="true" />

    </children>
</VBox>
