/* Dashboard Custom CSS */

.dynamic-dashboard {
    padding: 0;
}

/* Card Border Customization — Brand palette */
.card.border-left-danger {
    border-left: 0.25rem solid var(--dp-status-danger);
}

.card.border-left-warning {
    border-left: 0.25rem solid var(--dp-status-warning);
}

.card.border-left-info {
    border-left: 0.25rem solid var(--dp-interactive-primary);
}

.card.border-left-success {
    border-left: 0.25rem solid var(--dp-status-success);
}

.card.border-left-primary {
    border-left: 0.25rem solid var(--dp-interactive-primary);
}

.card.border-left-secondary {
    border-left: 0.25rem solid var(--dp-text-tertiary);
}

/* Card Hover Effects — Golden ratio shadows */
.card:hover {
    transform: translateY(-2px);
    transition: all 0.3s ease;
    box-shadow: var(--card-shadow-hover, 0 0.382rem 1.058rem rgba(0, 0, 0, 0.12)) !important;
}

/* Button Customizations */
.btn-block {
    display: block;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn:hover {
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

/* Stats Card Enhancements */
.text-xs {
    font-size: 0.7rem;
}

/* ── Tầng 4 utility classes ─────────────────────────────────── */

/* Card helpers */
.card-fill-height {
    height: 100%;
}

.card-body-center-col {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.card-header-tabs-stretch {
    flex-direction: column;
    align-items: stretch;
    padding-bottom: 0;
}

/* Nav tabs flush (no bottom border on the tab list itself) */
.nav-tabs-flush {
    border-bottom: none;
    gap: 2px;
}

/* Inline code chip */
.code-inline-sm {
    font-size: 11px;
    background: var(--dp-surface-elevated);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Chart canvas fixed-height helpers */
.chart-canvas-260 {
    height: 260px;
    position: relative;
}

.chart-canvas-160 {
    height: 160px;
    position: relative;
}

/* KPI value secondary text */
.kpi-value-secondary {
    font-size: 14px;
    color: var(--dp-text-disabled, #94A3B8);
}

/* Section overline label */
.section-overline {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--dp-text-secondary);
}

/* Section analytics header label */
.section-title-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--dp-text-primary);
}

/* Status dot icon inside status-badge */
.status-dot-icon {
    font-size: 7px;
}

/* Text-small utility (12px, subordinate to body) */
.text-small {
    font-size: 12px;
}

/* Semantic colour utilities (complement Bootstrap) */
.text-cyan {
    color: var(--dp-interactive-primary, #007A82);
}

.text-high {
    color: var(--dp-risk-high, #DC2626);
}

/* Modal backdrop — removes need for inline style="display:block;background-color:..." */
.dp-modal-backdrop {
    display: block;
    background-color: rgba(0, 0, 0, 0.5);
}

/* Preview modal minimum width */
.modal-preview-min {
    min-width: 800px;
}

/* Preview modal half-height content */
.modal-content-half {
    height: 50%;
}

/* Preview modal body sizing */
.modal-body-preview {
    height: calc(50vh - 150px);
}

/* Preview iframe fills its container */
.preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Color picker swatch input */
.color-picker-swatch {
    max-width: 32px;
    padding: 2px;
}

/* Clickable KPI card */
.kpi-card--clickable {
    cursor: pointer;
}

/* Inherits parent color, adds underline */
.link-inherit-underline {
    color: inherit;
    text-decoration: underline;
}

.font-weight-bold {
    font-weight: 700;
}

.text-uppercase {
    text-transform: uppercase;
}

.text-gray-800 {
    color: var(--dp-text-primary);
}

.text-gray-300 {
    color: var(--dp-text-tertiary);
}

/* Alert Enhancements */
.alert {
    border: none;
    border-radius: 0.35rem;
}

.alert h4 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Quick Actions Grid */
.card-body .row {
    margin: 0;
}

.card-body .row [class*="col-"] {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* Loading Spinner for Permission Guards */
.permission-loading {
    text-align: center;
    padding: 2rem;
}

.permission-loading .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .card-body .row [class*="col-"] {
        margin-bottom: 1rem;
    }

    .btn-block {
        font-size: 0.8rem;
        padding: 0.5rem;
    }

    .card .fa-2x {
        font-size: 1.5em;
    }
}

/* Dashboard Section Transitions */
.dynamic-dashboard > div {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 40px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* User Dashboard Simple Enhancements */
.user-dashboard .icon-circle {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.user-dashboard .d-grid .btn {
    margin-bottom: 0.5rem;
}

/* Privacy Tip Card */
.alert-light {
    background-color: var(--dp-surface-secondary);
    border-color: var(--dp-border-default);
    color: var(--dp-text-secondary);
}

/* Dashboard Header Styling */
.dashboard-header {
    background: linear-gradient(135deg, var(--dp-chart-5) 0%, var(--dp-interactive-primary) 100%);
    color: var(--dp-text-inverse);
    padding: 2rem 0;
    margin-bottom: 2rem;
    border-radius: 0.5rem;
}

.dashboard-header h1 {
    margin: 0;
    font-weight: 300;
}

.dashboard-header .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Card Shadow Variants */
.shadow-sm-custom {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.shadow-custom {
    box-shadow: 0 0.15rem 1.75rem 0 rgba(0, 0, 0, 0.15);
}

.shadow-lg-custom {
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

/* Permission Badge Styling */
.permission-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
}

.permission-badge.bg-success {
    background-color: var(--dp-status-success) !important;
    color: var(--dp-text-inverse);
}

.permission-badge.bg-danger {
    background-color: var(--dp-status-danger) !important;
    color: var(--dp-text-inverse);
}

.permission-badge.bg-warning {
    background-color: var(--dp-status-warning) !important;
    color: var(--dp-text-on-warning);
}

.permission-badge.bg-info {
    background-color: var(--dp-status-info) !important;
    color: var(--dp-text-inverse);
}

/* ================================================================
   APPLE PHASE 2 — DASHBOARD POLISH
   Additive only. Do not duplicate apple-design-tokens.css rules.
   ================================================================ */

/* Reusable thin progress bar */
.progress-thin { height: 6px !important; border-radius: 9999px; overflow: hidden; }
.progress-thin .progress-bar { border-radius: inherit; }

/* Timeline marker dot — Apple style (6px solid circle in gutter) */
.timeline { position: relative; padding-left: 18px; }
.timeline::before {
    content: '';
    position: absolute;
    left: 5px; top: 6px; bottom: 6px;
    width: 2px;
    background: var(--dp-border-subtle);
    border-radius: 1px;
}
.timeline-item { position: relative; padding: 4px 0 16px 8px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-marker {
    position: absolute;
    left: -16px; top: 8px;
    width: 8px; height: 8px;
    border-radius: 50%;
    box-shadow: 0 0 0 3px var(--dp-surface-primary);
}
.timeline-title { font-size: 13.5px; font-weight: 600; margin: 0 0 2px; line-height: 1.35; }
.timeline-description { font-size: 12.5px; color: var(--dp-text-secondary); margin: 0 0 2px; line-height: 1.4; }

/* Kill any residual border on KPI cards (apple-vibrancy already handles, but
   some pages still apply Bootstrap utility .border that would re-introduce it) */
.kpi-card.border,
.kpi-card.border-top,
.kpi-card.border-left { border: none !important; }

/* Section heading inside dashboard (h6.card-title pattern) */
.card-header h6.card-title,
.card-header .card-title {
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: -0.005em;
    color: var(--dp-text-primary);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
/* Icons in card headers stay neutral muted — Apple HIG: color is communication */
.card-header h6.card-title > i,
.card-header .card-title > i {
    color: var(--dp-text-muted);
    font-size: 13px;
    opacity: 0.85;
}

/* No-data / empty state inside card body — softer Apple look */
.card-body > .text-center.py-3.text-muted,
.card-body > .text-center.py-4.text-muted,
.card-body > .text-center.py-5.text-muted {
    color: var(--dp-text-muted) !important;
}
.card-body > .text-center > i.fa-2x { color: var(--dp-text-muted); opacity: 0.5; }

/* Refresh button spinner alignment — micro detail */
.fa-sync-alt.fa-spin { color: inherit; }
