/* ═══════════════════════════════════════════════
   Module Overview Pages — Shared Styles
   HRMS-inspired dark cards, tabs, stat blocks
   ═══════════════════════════════════════════════ */

/* ── Page Shell ── */
.module-page {
    padding: 1.5rem 2rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* ── Page Header ── */
.module-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.module-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--cs-text-heading);
    margin: 0;
    display: flex;
    align-items: center;
}
.module-title .bi {
    font-size: 1.25rem;
    opacity: 0.7;
}
.module-subtitle {
    font-size: 0.875rem;
    color: var(--cs-text-muted);
    margin: 0.25rem 0 0;
}
.module-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}
.btn-primary-action {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    border-radius: 0.625rem;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(37,99,235,0.25);
    transition: all 0.15s ease;
    white-space: nowrap;
}
.btn-primary-action:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 4px 12px rgba(37,99,235,0.35);
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
}
.btn-secondary-action {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--cs-text-heading);
    background: var(--cs-card-bg);
    border: 1px solid var(--cs-border);
    border-radius: 0.625rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.btn-secondary-action:hover {
    background: var(--cs-bg-subtle);
    border-color: var(--cs-input-border);
    color: var(--cs-text-heading);
    text-decoration: none;
}

/* ── Tab Navigation ── */
.module-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--cs-border);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.module-tabs::-webkit-scrollbar { display: none; }

.module-tabs .tab {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--cs-text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    position: relative;
}
.module-tabs .tab:hover {
    color: var(--cs-text);
    background: var(--cs-bg-subtle);
}
.module-tabs .tab.active {
    color: var(--cs-primary);
    border-bottom-color: var(--cs-primary);
    font-weight: 600;
}
.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 999px;
    line-height: 1;
}
.tab-badge.warn { background: #fef3c7; color: #92400e; }
.tab-badge.danger { background: #fee2e2; color: #991b1b; }
.tab-badge.info { background: #dbeafe; color: #1e40af; }

/* ── Loading State ── */
.module-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem;
    color: var(--cs-text-muted);
    gap: 1rem;
}
.module-loading p { margin: 0; font-size: 0.875rem; }
.spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid var(--cs-border);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Stat Cards Grid ── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--cs-card-bg);
    border-radius: 0.875rem;
    border: 1px solid var(--cs-border);
    border-left: 3px solid var(--accent, #3b82f6);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.stat-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}
.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.stat-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--cs-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--cs-text-heading);
    line-height: 1.2;
}
.stat-hint {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 0.15rem;
}
.stat-change {
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 0.15rem;
}
.stat-change.up { color: #10b981; }
.stat-change.down { color: #ef4444; }

/* ── Content Grid ── */
.content-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}
.content-card {
    background: var(--cs-card-bg);
    border-radius: 0.875rem;
    border: 1px solid var(--cs-border);
    overflow: hidden;
    transition: box-shadow 0.15s ease;
}
.content-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.05);
}
.content-card.span-2 { grid-column: span 2; }
.content-card.span-full { grid-column: 1 / -1; }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--cs-border-light);
}
.card-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--cs-text-heading);
    margin: 0;
    display: flex;
    align-items: center;
}
.card-header h3 .bi {
    font-size: 0.85rem;
    opacity: 0.6;
}
.card-link {
    font-size: 0.75rem;
    font-weight: 600;
    color: #3b82f6;
    text-decoration: none;
}
.card-link:hover { text-decoration: underline; }

.card-body {
    padding: 1rem 1.25rem 1.25rem;
}

/* ── Data Table ── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}
.data-table th {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--cs-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--cs-border-light);
    text-align: left;
}
.data-table td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--cs-border-light);
    color: var(--cs-text);
}
.data-table tbody tr:hover { background: var(--cs-table-row-hover); }
.data-table .text-right { text-align: right; }
.data-table .text-center { text-align: center; }

.store-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}
.store-link:hover { text-decoration: underline; }
.store-code {
    display: block;
    font-size: 0.65rem;
    color: #94a3b8;
}

/* ── Badges ── */
.badge-warn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.375rem;
    height: 1.375rem;
    padding: 0 0.375rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
}
.badge-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.375rem;
    height: 1.375rem;
    padding: 0 0.375rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 999px;
    background: #fee2e2;
    color: #991b1b;
}
.badge-success {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.375rem;
    height: 1.375rem;
    padding: 0 0.375rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 999px;
    background: #d1fae5;
    color: #065f46;
}
.badge-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.375rem;
    height: 1.375rem;
    padding: 0 0.375rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 999px;
    background: #dbeafe;
    color: #1e40af;
}
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 999px;
}
.status-pending { background: #fef3c7; color: #92400e; }
.status-approved { background: #d1fae5; color: #065f46; }
.status-rejected { background: #fee2e2; color: #991b1b; }
.status-draft { background: #f1f5f9; color: #475569; }

/* ── Quick Actions ── */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}
.quick-action {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 0.625rem;
    color: var(--cs-text);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 0.12s ease;
}
.quick-action:hover {
    background: var(--cs-bg-subtle);
    color: var(--cs-text-heading);
    text-decoration: none;
}
.qa-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    flex-shrink: 0;
}

/* ── Alerts ── */
.alert-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    border-radius: 0.625rem;
    font-size: 0.8125rem;
}
.alert-item strong { display: block; color: var(--cs-text-heading); font-size: 0.8125rem; }
.alert-msg { display: block; color: var(--cs-text-muted); font-size: 0.75rem; margin-top: 0.1rem; }
.alert-critical { background: #fef2f2; border-left: 3px solid #ef4444; }
.alert-critical .bi { color: #ef4444; }
.alert-warning { background: #fffbeb; border-left: 3px solid #f59e0b; }
.alert-warning .bi { color: #f59e0b; }
.alert-info { background: #eff6ff; border-left: 3px solid #3b82f6; }
.alert-info .bi { color: #3b82f6; }

/* ── Empty state ── */
.empty-state-sm {
    padding: 2rem 1rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.8125rem;
}

.text-muted { color: #cbd5e1; }

/* ── Workflow Pipeline ── */
.pipeline {
    display: flex;
    gap: 0;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}
.pipeline-step {
    flex: 1;
    min-width: 120px;
    text-align: center;
    padding: 1rem 0.75rem;
    position: relative;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s ease;
    border-radius: 0.5rem;
}
.pipeline-step:hover { background: var(--cs-bg-subtle); text-decoration: none; color: inherit; }
.pipeline-count {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--cs-text-heading);
    line-height: 1.2;
}
.pipeline-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--cs-text-muted);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.pipeline-step + .pipeline-step::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    height: 50%;
    width: 1px;
    background: var(--cs-border);
}

/* ── Recent List ── */
.recent-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}
.recent-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.65rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    color: var(--cs-text);
    text-decoration: none;
    transition: background 0.12s ease;
}
.recent-item:hover { background: var(--cs-bg-subtle); text-decoration: none; color: inherit; }
.recent-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.recent-body {
    flex: 1;
    min-width: 0;
}
.recent-title {
    display: block;
    font-weight: 500;
    color: var(--cs-text-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.recent-meta {
    display: block;
    font-size: 0.7rem;
    color: #94a3b8;
}

/* ═══ Responsive ═══ */
@media (max-width: 1200px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .content-grid { grid-template-columns: 1fr 1fr; }
    .content-card.span-2 { grid-column: span 2; }
}

@media (max-width: 768px) {
    .module-page { padding: 1rem; }
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
    .content-grid { grid-template-columns: 1fr; }
    .content-card.span-2 { grid-column: span 1; }
    .content-card.span-full { grid-column: span 1; }
    .module-header { flex-direction: column; }
    .module-tabs .tab { padding: 0.65rem 0.75rem; font-size: 0.75rem; }
    .pipeline { flex-wrap: wrap; }
    .pipeline-step { min-width: 0; flex-basis: 33.33%; }
}

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .stat-card { padding: 1rem; }
    .pipeline-step { flex-basis: 50%; }
}
