/* Container */
.history-container {
    width: 90%;
    max-width: 1000px;
    margin: 2rem auto;
    font-family: Arial, sans-serif;
    text-align: center;
    font-size: 20px;
}

/* Table-like structure */
.history-table {
    display: table;
    width: 100%;
    border-collapse: collapse;
}

/* Header row */
.history-header {
    display: table-row;
    background: #222;
    color: #fff;
    font-weight: bold;
}

.history-header div {
    display: table-cell;
    padding: 12px;
    text-align: center;
    border: 1px solid #444;
}

/* Data rows */
.history-row {
    display: table-row;
    border-bottom: 1px solid #ddd;
    position: relative;
    /* Ensure positioning for dropdown */
}

.history-row div {
    display: table-cell;
    padding: 12px;
    text-align: center;
    border: 1px solid #eee;
}

/* Button styling */
.view-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

.view-btn:hover {
    background-color: #1a57ca;
    box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.10);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .history-header {
        display: none;
    }

    .history-row {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #ddd;
        border-radius: 8px;
        position: relative;
        /* Ensure positioning for dropdown */
    }

    .history-row div {
        display: flex;
        justify-content: space-between;
        padding: 10px;
        border: none;
        border-bottom: 1px solid #eee;
    }

    .history-row div:last-child {
        border-bottom: none;
        justify-content: center;
    }

    .history-row div::before {
        content: attr(data-label);
        font-weight: bold;
        margin-right: 10px;
        color: #555;
        display: flex;
        align-items: center;
    }

    /* Debugging: Make sure the dropdown is visible */
    .dropdown-menu {
        display: none !important;
        position: absolute;
        top: 100%;
        /* Drop below the button */
        right: 0;
        left: auto;
        /* Ensure alignment */
        bottom: auto;
        background: #fff;
        border: 1px solid #ccc;
        border-radius: 4px;
        min-width: 100px;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        z-index: 100;
        /* Ensure it’s above the row */
        background-color: white;
        /* Ensure visibility */
        visibility: visible !important;
        /* Force visibility */
    }

    /* Show dropdown when toggled */
    .dropdown-menu.show {
        display: block !important;
    }

    /* Buttons inside dropdown */
    .dropdown-menu button {
        display: block;
        width: 100%;
        border: none;
        background: none;
        padding: 8px 12px;
        text-align: left;
        cursor: pointer;
        font-size: 16px;
    }

    /* Hover effect */
    .dropdown-menu button:hover {
        background: #f3f3f3;
    }

    /* Delete button */
    .delete-btn {
        color: red;
    }
}

/* ---------- Action Dropdown ---------- */
.action-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.dropdown-wrapper {
    position: relative;
    display: inline-block;
}

/* View button with arrow */
.view-btn.dropdown-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Dropdown menu - hidden by default */
.dropdown-menu {
    display: none !important;
    position: absolute;
    top: 110%;
    right: 0;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    min-width: 100px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

/* Show dropdown when toggled */
.dropdown-menu.show {
    display: block !important;
}

/* Buttons inside dropdown */
.dropdown-menu button {
    display: block;
    width: 100%;
    border: none;
    background: none;
    padding: 8px 12px;
    text-align: left;
    cursor: pointer;
    font-size: 16px;
}

/* Hover effect */
.dropdown-menu button:hover {
    background: #f3f3f3;
}

/* Delete button */
.delete-btn {
    color: red;
}

/* Toggle switch base */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* Slider background */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 24px;
}

/* Knob inside the slider */
.slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

/* ON state */
input:checked+.slider {
    background-color: #007bff;
}

input:checked+.slider::before {
    transform: translateX(24px);
}

/* Smooth transition for color and position */
.slider,
.slider::before {
    transition: all 0.3s ease-in-out;
}