/* start here for data table in card view css*/
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: visible !important;
    }
}

@media (max-width: 768px) {
    td[class^="data-label-"]::before {
        content: attr(class);
    }
}


.loader-overlay {
    display: none;
    /* hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.150);
    /* slightly darker overlay for better visibility */
    z-index: 9999;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
    /* optional: adds blur effect */
    -webkit-backdrop-filter: blur(2px);
    /* Safari support */
}

.loader-overlay.show {
    display: flex !important;
    /* show when active, !important for override */
}

.spinner-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.spinner-border {
    width: 2rem;
    height: 2rem;
    border-width: 0.3em;
}

.loading-text {
    margin-top: 1rem;
    font-size: 1rem;
    font-weight: 500;
    color: #495057;
    text-align: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .spinner-container {
        padding: 1.5rem;
        min-width: 150px;
        min-height: 100px;
        border-radius: 8px;
    }

    .spinner-border {
        width: 2.5rem;
        height: 2.5rem;
        border-width: 0.25em;
    }

    .loading-text {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .spinner-container {
        padding: 1rem;
        min-width: 120px;
        min-height: 80px;
        border-radius: 6px;
    }

    .spinner-border {
        width: 2rem;
        height: 2rem;
        border-width: 0.2em;
    }

    .loading-text {
        font-size: 0.8rem;
        margin-top: 0.75rem;
    }
}

/* Ensure proper centering on all devices */
@media (orientation: landscape) and (max-height: 500px) {
    .spinner-container {
        padding: 1rem;
        min-height: 60px;
    }

    .loading-text {
        font-size: 0.8rem;
        margin-top: 0.5rem;
    }
}

/* Animation for smooth appearance */
.loader-overlay {
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.loader-overlay.show {
    opacity: 1;
}

/* Prevent body scroll when loader is active */
body.loader-active {
    overflow: hidden;
}

/* Shrink the clickable button container */
#carouselExampleIndicators .carousel-control-prev,
#carouselExampleIndicators .carousel-control-next {
    width: 30px;
    /* smaller width */
    top: 50%;
    /* vertically center */
    bottom: auto;
    /* remove default bottom: 0 */
    transform: translateY(-50%);
}

/* Shrink the icon itself */
#carouselExampleIndicators .carousel-control-prev-icon,
#carouselExampleIndicators .carousel-control-next-icon {
    width: 30px;
    /* icon width */
    height: 30px;
    /* icon height */
    background-size: 100% 100%;
    /* scale icon */
}

/* Optional: adjust left/right positions */
#carouselExampleIndicators .carousel-control-prev {
    left: 5px;
}

#carouselExampleIndicators .carousel-control-next {
    right: 5px;
}

.bg-secondary-dark {
    background-color: #646464;
    opacity: 0.6;
}

/* Modern date input styling - targets all date inputs globally */
input[type="date"] {
    cursor: pointer !important;
    position: relative;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: auto;
    color: transparent;
    background: transparent;
    cursor: pointer;
    z-index: 1;
}

input[type="date"]::-webkit-calendar-picker-indicator::after {
    content: '\1F4C5';
    /* Calendar emoji */
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    pointer-events: none;
}

/* Firefox date input styling */
input[type="date"]::-moz-focus-inner {
    padding: 0;
    border: 0;
}

/* Hover and focus states */
input[type="date"]:hover {
    border-color: #009ef7;
    transition: all 0.3s ease;
}

input[type="date"]:focus {
    border-color: #009ef7;
    box-shadow: 0 0 0 0.25rem rgba(0, 158, 247, 0.25);
}

/* Active state - ensure the entire input is clickable */
input[type="date"]:active {
    background-color: #f8f9fa;
}



/* Mobile Card Layout for PowerGrid */
@media (max-width: 768px) {

    /* Remove table layout */
    table.power-grid-table,
    table.power-grid-table thead,
    table.power-grid-table tbody,
    table.power-grid-table th,
    table.power-grid-table td,
    table.power-grid-table tr {
        display: block;
        width: 100%;
    }

    /* Hide headers */
    table.power-grid-table thead {
        display: none;
    }

    /* Each row as card */
    table.power-grid-table tr {
        background: #fff;
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 10px;
        padding: 10px;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    }

    /* Each cell stacked with label */
    table.power-grid-table td {
        display: flex;
        justify-content: space-between;
        padding: 8px 6px !important;
        border: none;
        border-bottom: 1px solid #F0F0F0;
    }

    table.power-grid-table td:last-child {
        border-bottom: none;
    }

    /* Show data-label as field label */
    table.power-grid-table td::before {
        content: attr(data-label);
        font-weight: bold;
        flex: 120px;
        padding-right: 10px;
        color: #333;
    }

    .pg-actions {
        justify-content: flex-end;
    }

    table.power-grid-table tr:first-child td {
        display: flex;
        border-bottom: 0;
        align-items: center;
    }

    .power-grid-table tr:first-child td {
        padding-top: 6px !important;
        padding-bottom: 6px !important;
    }

    table.power-grid-table tr:first-child td::before {
        /* content: none; */
    }

    .power-grid-table tr td .form-check {
        margin-top: 0;
    }

    table.power-grid-table tr td {
        white-space: normal !important;
    }

    table.power-grid-table tr td .pg-actions {
        display: none;
    }

    table.power-grid-table tr td span {
        text-align: right;
    }

    table.power-grid-table td:last-child .pg-actions {
        display: flex;
        justify-content: flex-end;
        text-align: right;
        flex-wrap: wrap-reverse;
    }

    table.power-grid-table td:last-child .pg-actions .btn.btn-icon {
        height: unset;
    }
}
