/* =============================================================
   PayVoucher — Shared App Styles (based on all-payments.php UI)
   Use this file for a consistent, modern look across all pages.
   ============================================================= */

/* ---------- CSS Variables ---------- */
:root {
    --ap-bg:          #eef1f8;
    --ap-surface:     #ffffff;
    --ap-surface-2:   #f8faff;
    --ap-border:      #e4e9f4;
    --ap-text:        #64748b;
    --ap-text-strong: #0f172a;
    --ap-accent:      #4f6bff;
    --ap-accent-2:    #7c6bff;
    --ap-accent-soft: rgba(79, 107, 255, 0.07);
    --ap-success:     #0f9d6b;
    --ap-success-soft: rgba(15, 157, 107, 0.1);
    --ap-warning:     #d97706;
    --ap-danger:      #dc2626;
    --ap-radius:      16px;
    --ap-radius-sm:   10px;
    --ap-shadow:      0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.05);
    --ap-shadow-hover: 0 4px 10px rgba(15, 23, 42, 0.06), 0 14px 32px rgba(15, 23, 42, 0.08);
}

html.dark-mode {
    --ap-bg:          #0b0d13;
    --ap-surface:     #141824;
    --ap-surface-2:   #171c29;
    --ap-border:      rgba(255, 255, 255, 0.08);
    --ap-text:        #8b93a3;
    --ap-text-strong: #e7eaf2;
    --ap-accent-soft: rgba(124, 107, 255, 0.12);
    --ap-success-soft: rgba(15, 157, 107, 0.16);
    --ap-shadow:      0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.25);
    --ap-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.28), 0 16px 36px rgba(0, 0, 0, 0.32);
}

/* ---------- Base ---------- */
body {
    overflow-x: hidden;
    background: var(--ap-bg);
    color: var(--ap-text-strong);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    letter-spacing: -0.01em;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
    overflow-y: auto;
}

.main-content {
    margin-left: 280px;
    min-height: 100vh;
    background: var(--ap-bg);
    padding: 2rem 2.25rem;
    transition: margin-left 0.3s ease-in-out;
}

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 1.25rem; }
}

/* ---------- Page Header ---------- */
.ap-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.ap-page-heading {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.ap-page-icon {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--ap-accent) 0%, var(--ap-accent-2) 100%);
    color: #fff;
    font-size: 1.15rem;
    box-shadow: 0 8px 16px rgba(79, 107, 255, 0.28);
}

.ap-page-title {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--ap-text-strong);
    margin: 0;
    line-height: 1.2;
}

.ap-page-subtitle {
    font-size: 0.86rem;
    color: var(--ap-text);
    margin: 0.1rem 0 0;
}

/* ---------- Cards ---------- */
.ap-card {
    background: var(--ap-surface);
    border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius);
    box-shadow: var(--ap-shadow);
}

.ap-card-header {
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid var(--ap-border);
    border-radius: var(--ap-radius) var(--ap-radius) 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.ap-card-header h5 {
    font-weight: 700;
    font-size: 0.95rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--ap-text-strong);
}

.ap-card-header h5 i {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--ap-accent-soft);
    color: var(--ap-accent);
    font-size: 0.8rem;
}

.ap-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ap-card .card-body {
    padding: 1.4rem;
}

/* ---------- Forms / Filters ---------- */
.ap-filter-form .form-label,
#filterForm .form-label {
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ap-text);
    margin-bottom: 0.4rem;
}

.ap-filter-form .form-control,
.ap-filter-form .form-select,
.ap-form-control,
#filterForm .form-control,
#filterForm .form-select {
    border-radius: var(--ap-radius-sm);
    border: 1px solid var(--ap-border);
    padding: 0.55rem 0.85rem;
    font-size: 0.88rem;
    background: var(--ap-surface-2);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.ap-filter-form .form-control:focus,
.ap-filter-form .form-select:focus,
.ap-form-control:focus,
#filterForm .form-control:focus,
#filterForm .form-select:focus {
    border-color: var(--ap-accent);
    background: var(--ap-surface);
    box-shadow: 0 0 0 3px var(--ap-accent-soft);
    outline: none;
}

/* ---------- Buttons ---------- */
.btn {
    border-radius: var(--ap-radius-sm);
    font-weight: 600;
    font-size: 0.86rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--ap-accent) 0%, var(--ap-accent-2) 100%);
    border: none;
    box-shadow: 0 6px 14px rgba(79, 107, 255, 0.28);
}

.btn-primary:hover {
    filter: brightness(1.05);
}

.btn-secondary {
    background: var(--ap-surface-2);
    border: 1px solid var(--ap-border);
    color: var(--ap-text-strong);
}

.btn-secondary:hover {
    background: var(--ap-border);
    color: var(--ap-text-strong);
}

.btn-warning {
    border: none;
    box-shadow: 0 6px 14px rgba(217, 119, 6, 0.22);
}

.btn-success {
    border: none;
    box-shadow: 0 6px 14px rgba(15, 157, 107, 0.24);
}

/* ---------- Tables ---------- */
.ap-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.87rem;
}

.ap-table thead th {
    background: #10162a;
    color: #eef1fb;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.95rem 1.1rem;
    white-space: nowrap;
    border: none;
}

.ap-table thead th:first-child { padding-left: 1.4rem; }
.ap-table thead th:last-child { padding-right: 1.4rem; text-align: right; }

.ap-table tbody td {
    padding: 0.95rem 1.1rem;
    border-bottom: 1px solid var(--ap-border);
    vertical-align: middle;
    color: var(--ap-text-strong);
}

.ap-table tbody td:first-child {
    padding-left: 1.4rem;
    color: var(--ap-text);
    font-weight: 500;
}

.ap-table tbody td:last-child { padding-right: 1.4rem; }

.ap-table tbody tr {
    transition: background .12s ease;
}

.ap-table tbody tr:last-child td { border-bottom: none; }
.ap-table tbody tr:hover { background: var(--ap-accent-soft); }

.ap-amount {
    font-weight: 700;
    color: var(--ap-success);
    white-space: nowrap;
    background: var(--ap-success-soft);
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    display: inline-block;
    font-size: 0.84rem;
}

.ap-actions {
    display: flex;
    gap: 0.35rem;
    flex-wrap: nowrap;
    justify-content: flex-end;
}

.btn-action {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    border: 1px solid var(--ap-border);
    background: var(--ap-surface-2);
    transition: transform .12s ease, box-shadow .12s ease;
}

.btn-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.1);
}

.ap-table .badge {
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.72rem;
    padding: 0.4rem 0.7rem;
    letter-spacing: 0.02em;
}

/* ---------- Empty / Skeleton States ---------- */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--ap-text);
}

.empty-state i {
    font-size: 2.75rem;
    margin-bottom: 1rem;
    opacity: 0.9;
    color: var(--ap-accent);
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: var(--ap-accent-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.empty-state div {
    font-weight: 600;
    font-size: 0.92rem;
    margin-top: 0.5rem;
}

.skeleton-row td {
    height: 54px;
    background: linear-gradient(90deg, transparent 0%, var(--ap-accent-soft) 50%, transparent 100%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---------- Pagination ---------- */
nav[aria-label="Payments pagination"] {
    border-top: 1px solid var(--ap-border);
}

.pagination {
    gap: 0.25rem;
}

.page-item .page-link {
    border-radius: 8px;
    border: 1px solid var(--ap-border);
    color: var(--ap-text-strong);
    font-weight: 600;
    font-size: 0.85rem;
    margin: 0 1px;
}

.page-item.active .page-link {
    background: linear-gradient(135deg, var(--ap-accent) 0%, var(--ap-accent-2) 100%);
    border-color: transparent;
    color: #fff;
}

.page-item.disabled .page-link { opacity: 0.45; }

.page-link:hover {
    background: var(--ap-accent-soft);
    color: var(--ap-accent);
}

/* ---------- Badges ---------- */
.records-badge {
    background: var(--ap-accent-soft) !important;
    color: var(--ap-accent) !important;
    font-weight: 700;
    border-radius: 999px;
    padding: 0.4rem 0.85rem;
    font-size: 0.78rem !important;
}

/* ---------- Department Column Helper ---------- */
.dept-col { display: none; }
body.show-dept-col .dept-col { display: table-cell; }

/* ---------- Utility ---------- */
.ap-text-muted { color: var(--ap-text) !important; }
.ap-bg-surface { background: var(--ap-surface) !important; }
.ap-bg-surface-2 { background: var(--ap-surface-2) !important; }
