/* ============================================================
   Shared server-side grid design.
   Extracted from the User/Group list grids so every page that
   adopts the "server call per page" table looks uniform.
   Apply the `.server-grid` class to the <table>.
   ============================================================ */

:root {
    --grid-primary: #225687;
    --grid-primary-light: #e6eef6;
    --grid-primary-hover: #1b456b;
}

/* ============================================================
   STANDARD COMPONENTS (buttons, links, forms, modals)
   Applied app-wide so every page shares the same look.
   ============================================================ */

/* Buttons */
.btn-primary {
    border-radius: 10px;
    background-color: var(--grid-primary);
    border-color: var(--grid-primary);
    font-size: 15px;
}

    .btn-primary:hover,
    .btn-primary:active,
    .btn-primary:focus {
        background-color: var(--grid-primary-hover) !important;
        border-color: var(--grid-primary-hover) !important;
    }

.btn-secondary {
    border-radius: 10px;
    font-size: 15px;
}

.btn-outline-primary {
    border-radius: 10px;
    color: var(--grid-primary);
    border-color: var(--grid-primary);
}

    .btn-outline-primary:hover {
        background-color: var(--grid-primary);
        border-color: var(--grid-primary);
    }

/* Submit button style (used on create/update/report forms) */
.form-submit-style {
    background: var(--grid-primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 6px 16px;
    font-size: 13px;
    transition: all 0.2s ease;
}

    .form-submit-style:hover {
        background: var(--grid-primary-hover);
        color: #fff;
    }

/* Links */
.link-primary {
    color: var(--grid-primary) !important;
}

    .link-primary:hover {
        color: var(--grid-primary-hover) !important;
    }

/* Inputs */
.form-control,
.form-select {
    border-radius: 10px;
    font-size: 15px;
    padding: 0.5rem 0.65rem;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

    .form-control:focus,
    .form-select:focus {
        border-color: var(--grid-primary);
        box-shadow: 0 0 0 0.15rem rgba(34, 86, 135, 0.2);
    }

/* Labels */
.form-label {
    font-size: 12px;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 4px;
}

/* Section divider */
.section-divider {
    display: flex;
    align-items: center;
    margin: 0.2rem 0;
    color: var(--grid-primary);
    font-weight: 600;
    font-size: 13px;
}

    .section-divider hr {
        flex-grow: 1;
        border-top: 1px solid #e5e7eb;
    }

    .section-divider span {
        margin: 0 10px;
    }

/* Modals */
.modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: 0 20px 50px rgba(0,0,0,0.12);
    overflow: hidden;
}

.modal-header {
    border-bottom: 1px solid #f1f3f5;
    padding: 1rem 1.5rem;
    background: #fff;
}

.modal-title {
    font-weight: 600;
    color: var(--grid-primary) !important;
    font-size: 1.1rem;
}

.modal-header .btn-close {
    filter: none;
    opacity: 0.4;
    width: 0.7rem;
    height: 0.7rem;
    background-size: 0.7rem;
}

    .modal-header .btn-close:hover {
        opacity: 1;
    }

.modal-footer {
    border-top: 1px solid #f1f3f5;
    padding: 1rem 1.5rem;
    background: #fafbfc;
}

.modal.fade .modal-dialog {
    transform: translateY(20px) scale(0.98);
    transition: all 0.2s ease;
}

.modal.show .modal-dialog {
    transform: translateY(0) scale(1);
}

/* ===== FOOTER BUTTON PAIRS =====
   Every create/update/delete modal ends with a paired action:
   a `.form-submit-style` submit (border:none) next to a
   `.btn` cancel/close (1px border). Those class differences make
   the two buttons render at different heights. Force both children
   of the footer flex wrapper to one identical box so every pair
   lines up the same across all pages. */
.modal .d-flex.justify-content-end.w-100 > div {
    display: flex;
}

.modal .d-flex.justify-content-end.w-100 > div > .btn,
.modal .d-flex.justify-content-end.w-100 > div > .form-submit-style {
    height: 38px;
    min-width: 96px;
    padding: 0 1.1rem;
    font-size: 14px;
    line-height: 1;
    border-radius: 10px;
    border-width: 1px;
    border-style: solid;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.modal .d-flex.justify-content-end.w-100 > div > .form-submit-style {
    border-color: transparent;
}

/* ===== SEARCH BOX ===== */
.grid-search {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
    font-size: 15px;
}

    .grid-search:focus {
        border-color: var(--grid-primary);
        box-shadow: 0 0 0 0.15rem rgba(34, 86, 135, 0.25);
    }

/* ===== TABLE ===== */
.server-grid {
    font-size: 14px;
}

    .server-grid thead th {
        white-space: nowrap;
        user-select: none;
        font-weight: 600;
        border-bottom: none;
    }

    .server-grid thead th.sortable {
        cursor: pointer;
    }

    .server-grid td {
        padding: 0.5rem 0.6rem;
    }

    .server-grid tbody tr:hover {
        background-color: var(--grid-primary-light);
    }

    .server-grid tbody tr:nth-child(even) {
        background-color: #fafbfc;
    }

/* ===== SORT ARROWS ===== */
.sort-arrow {
    font-size: 0.75rem;
    color: #9ca3af;
    transition: 0.2s;
}

    .sort-arrow i {
        font-size: 0.75rem;
        margin-left: 4px;
        transition: transform 0.2s ease, color 0.2s ease;
    }

.server-grid th:hover .sort-arrow {
    color: var(--grid-primary);
}

.server-grid th.active-sort {
    color: var(--grid-primary);
}

.active-sort .fa-sort-up {
    color: var(--grid-primary);
    transform: translateY(-1px);
}

.active-sort .fa-sort-down {
    color: var(--grid-primary);
    transform: translateY(1px);
}

/* ===== PAGINATION ===== */
.grid-pagination .page-link {
    border-radius: 8px;
    margin: 0 2px;
    color: var(--grid-primary);
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
    cursor: pointer;
}

    .grid-pagination .page-link:hover {
        background-color: var(--grid-primary-light);
    }

.grid-pagination .page-item.active .page-link {
    background-color: var(--grid-primary);
    border-color: var(--grid-primary);
    color: #fff;
}

.grid-pagination .page-item.disabled .page-link {
    opacity: 0.5;
}

/* ===== BADGES ===== */
.bg-success-subtle {
    background-color: #e6f4ea !important;
}

.bg-danger-subtle {
    background-color: #fde8e8 !important;
}

/* ===== SKELETON LOADING ===== */
.skeleton-row {
    height: 14px;
    margin: 10px 0;
    border-radius: 6px;
    background: linear-gradient(90deg, #eee, #f5f5f5, #eee);
    animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }

    100% {
        background-position: 200px 0;
    }
}

@media (max-width: 768px) {
    .server-grid {
        font-size: 13px;
    }
}

/* ===== CARD PANEL (page wrapper) ===== */
.card-custom {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    border: none;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

    .card-custom:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 28px rgba(0,0,0,0.08);
    }

.card-header-custom {
    padding: 18px;
    position: relative;
}

    .card-header-custom h5 {
        font-weight: 700;
        color: var(--grid-primary);
        margin-bottom: 6px;
    }

.card-divider-custom hr {
    margin: 0 18.5px !important;
    height: 0.5px;
    color: #6e8296;
}

.card-body-custom {
    padding: 20px 18px 12px 18px;
}

.card-footer-custom {
    padding: 0 18px 18px 18px;
    border-top: none;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ===== MOBILE CARDS ===== */
.user-card {
    background: #fff;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.04);
    transition: 0.2s;
    border-left: 4px solid var(--grid-primary);
}

    .user-card:hover {
        transform: translateY(-2px);
    }

.user-card-header {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    margin-bottom: 6px;
}

.user-card-body div {
    font-size: 14px;
    color: #555;
}

/* ===== TOAST-STYLE ALERT ===== */
.alert-wrapper {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1055;
}

.alert-modern {
    display: flex;
    align-items: stretch;
    width: 320px;
    border-radius: 14px;
    overflow: hidden;
    background: #ffffffcc;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.12);
    animation: slideIn 0.3s ease;
    position: relative;
}

.alert-bar {
    width: 5px;
    background: var(--grid-primary);
}

.alert-content {
    padding: 12px 14px;
    flex: 1;
}

.alert-title {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 2px;
    color: var(--grid-primary);
}

.alert-message {
    font-size: 13px;
    color: #333;
}

.alert-close {
    border: none;
    background: transparent;
    font-size: 18px;
    padding: 10px;
    cursor: pointer;
    opacity: 0.5;
}

    .alert-close:hover {
        opacity: 1;
    }

.alert-success .alert-bar { background: #28a745; }
.alert-success .alert-title { color: #28a745; }
.alert-error .alert-bar { background: #dc3545; }
.alert-error .alert-title { color: #dc3545; }
.alert-warning .alert-bar { background: #f0ad4e; }
.alert-warning .alert-title { color: #f0ad4e; }
.alert-info .alert-bar { background: var(--grid-primary); }
.alert-info .alert-title { color: var(--grid-primary); }

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

td .badge {
    font-size: 12px;
    border-radius: 8px;
    padding: 4px 8px;
}
