/* Vinh Phu KPI Quick - Modern Portal UI & Mobile UX
 * Aligned with UBND Xã Vĩnh Phú Application Portal (eCabinet theme)
 */

:root {
    --vp-quick-primary: #6f42c1;
    --vp-quick-primary-hover: #59359a;
    --vp-quick-success: #16a34a;
    --vp-quick-warning: #d97706;
    --vp-quick-danger: #dc2626;
    --vp-quick-bg: #f8fafc;
    --vp-quick-card-bg: #ffffff;
    --vp-quick-border: #e2e8f0;
    --vp-compact-nav-height: 40px;
}

html, body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    max-width: 100%;
}

body {
    background-color: var(--vp-quick-bg);
    color: #1e293b;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.has-sticky-bar {
    padding-bottom: 120px;
}

/* ==========================================================================
   TOP COMPACT BAR (Matching Dashboard)
   ========================================================================== */
.vp-compact-top-bar {
    width: 100%;
    height: 48px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    z-index: 100;
    white-space: nowrap;
}

.vp-compact-top-bar .btn,
.vp-header-btn,
.vp-btn-launcher,
.vp-btn-topbar-login,
.vp-btn-topbar-logout,
.vp-btn-back {
    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
    box-sizing: border-box !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    border-radius: 8px !important;
    padding: 0 12px;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-decoration: none;
}

.vp-btn-launcher i,
.vp-btn-topbar-login i,
.vp-btn-topbar-logout i,
.vp-btn-back i {
    font-size: 14px;
    line-height: 1;
}

.vp-btn-launcher {
    background: rgba(111, 66, 193, 0.08);
    color: #6f42c1;
    border: 1px solid rgba(111, 66, 193, 0.25);
}

.vp-btn-launcher:hover {
    background: #6f42c1;
    color: #ffffff;
    border-color: #6f42c1;
}

.vp-btn-topbar-login {
    background: #6f42c1;
    color: #ffffff;
    border: 1px solid #6f42c1;
}

.vp-btn-topbar-login:hover {
    background: #59359a;
    border-color: #59359a;
    color: #ffffff;
}

.vp-btn-topbar-logout {
    background: transparent;
    color: #dc2626;
    border: 1px solid #dc2626;
}

.vp-btn-topbar-logout:hover {
    background: #dc2626;
    color: #ffffff;
}

.vp-btn-back {
    background: #ffffff;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.vp-btn-back:hover {
    background: #f1f5f9;
    color: #1e293b;
    border-color: #94a3b8;
}

/* ==========================================================================
   GOVERNMENT BRANDING HEADER (Canonical 81px Horizontal Design Token)
   ========================================================================== */
.vinhphu-launcher-header,
.vp-dashboard-header {
    height: 81px !important;
    min-height: 81px !important;
    max-height: 81px !important;
    padding: 12px 16px !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
    border-bottom: 1px solid #e2e8f0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    user-select: none !important;
}

.vp-header-brand {
    display: inline-flex !important;
    align-items: center !important;
    gap: 16px !important;
    text-align: left !important;
}

.launcher-gov-logo,
.vp-gov-logo {
    height: 56px !important;
    max-height: 56px !important;
    width: auto !important;
    flex-shrink: 0 !important;
    object-fit: contain !important;
}

.vp-header-text {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
}

.launcher-agency-title,
.vp-agency-title {
    font-size: 13px !important;
    font-weight: 600 !important;
    letter-spacing: 0.04em !important;
    color: #475569 !important;
    text-transform: uppercase !important;
    line-height: 1.25 !important;
    margin-bottom: 2px !important;
}

.launcher-main-title,
.vp-dashboard-main-title {
    font-size: 20px !important;
    font-weight: 800 !important;
    color: #6f42c1 !important;
    letter-spacing: -0.01em !important;
    text-transform: uppercase !important;
    line-height: 1.2 !important;
}

.launcher-subtitle {
    display: none !important;
}

/* ==========================================================================
   CONTAINER & LAYOUT
   ========================================================================== */
.vp-kpi-quick-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.vp-quick-container {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    box-sizing: border-box;
}

.vp-quick-fullwidth {
    width: calc(100% - 32px);
    max-width: none !important;
    margin: 0 auto;
    padding: 1.25rem 0;
    box-sizing: border-box;
}

@media (min-width: 1200px) {
    .vp-quick-fullwidth {
        width: calc(100% - 48px);
    }
}

/* ==========================================================================
   CARDS & TILES
   ========================================================================== */
.vinhphu-app-card {
    background: #ffffff;
    border: 1px solid #e2e8f0 !important;
    cursor: pointer;
    transition: all 0.25s ease-in-out;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-height: 220px;
}

.vinhphu-app-card .app-icon-badge {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    transition: transform 0.25s ease;
}

.vinhphu-app-card .app-title-wrap {
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-bottom: 8px;
}

.vinhphu-app-card .app-name {
    color: #1e293b;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.35;
    margin-bottom: 0 !important;
    text-align: center;
}

.vinhphu-app-card .app-desc {
    line-height: 1.45;
    color: #64748b;
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 0;
}

.vinhphu-app-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -6px rgba(111, 66, 193, 0.15), 0 4px 8px -4px rgba(0, 0, 0, 0.06) !important;
    border-color: #c4b5fd !important;
}

.vinhphu-app-card:hover .app-icon-badge {
    transform: scale(1.08);
}

.vp-quick-card {
    background: var(--vp-quick-card-bg);
    border: 1px solid var(--vp-quick-border);
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.vp-quick-card-header {
    background: #ffffff;
    padding: 1rem 1.25rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: #1e293b;
    border-bottom: 1px solid var(--vp-quick-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.vp-quick-card-body {
    padding: 1.25rem;
}

/* ==========================================================================
   BUTTONS & BRAND ACCENTS
   ========================================================================== */
.btn-purple {
    background-color: #6f42c1;
    border-color: #6f42c1;
    color: #ffffff;
    transition: all 0.2s ease;
}

.btn-purple:hover, .btn-purple:focus {
    background-color: #59359a;
    border-color: #59359a;
    color: #ffffff;
}

.btn-outline-purple {
    color: #6f42c1;
    border-color: #6f42c1;
    background-color: transparent;
    transition: all 0.2s ease;
}

.btn-outline-purple:hover, .btn-outline-purple:focus {
    background-color: #6f42c1;
    border-color: #6f42c1;
    color: #ffffff;
}

.btn-landing-cta {
    width: 240px;
    max-width: 100%;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.text-purple {
    color: #6f42c1 !important;
}

.bg-purple-subtle {
    background-color: #f3e8ff !important;
}

/* Touch Target Enhancements (>= 44px) - Exclude top bar buttons */
.form-control, .form-select, .btn:not(.vp-compact-top-bar .btn):not(.vp-btn-launcher):not(.vp-btn-topbar-logout):not(.vp-btn-topbar-login):not(.vp-btn-back) {
    min-height: 44px;
    font-size: 0.95rem;
    border-radius: 0.5rem;
}

.form-control:focus, .form-select:focus {
    border-color: #a855f7;
    box-shadow: 0 0 0 0.25rem rgba(111, 66, 193, 0.2);
}

.btn-icon-touch {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   MODAL TASK PICKER (CONTINUOUS MULTI-ADD)
   ========================================================================== */
.vp-task-picker-list {
    background: #ffffff;
    max-height: 480px;
    overflow-y: auto;
    overflow-x: hidden;
}

.vp-task-picker-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s ease, border-color 0.15s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 6px;
    margin-bottom: 2px;
    min-height: 44px;
    box-sizing: border-box;
}

.vp-task-picker-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.vp-task-picker-item:hover,
.vp-task-picker-item.active {
    background-color: #f3e8ff;
}

.vp-task-picker-item.is-added {
    background-color: #f0fdf4;
    border-left: 3px solid #16a34a;
}

.vp-task-picker-item-code {
    font-weight: 700;
    background: #ede9fe;
    color: #6f42c1;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.vp-task-picker-item.is-added .vp-task-picker-item-code {
    background: #dcfce7;
    color: #16a34a;
}

.vp-task-picker-item-coeff {
    font-size: 0.8rem;
    color: #64748b;
    flex-shrink: 0;
}

.vp-task-picker-item-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.925rem;
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.vp-task-picker-item-output {
    font-size: 0.8rem;
    color: #64748b;
    font-style: italic;
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.vp-task-picker-btn-add {
    min-width: 85px;
    height: 36px;
    min-height: 36px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.vp-task-picker-btn-add.btn-added {
    background-color: #dcfce7;
    color: #16a34a;
    border: 1px solid #86efac;
    cursor: default;
}

@media (max-width: 576px) {
    .vp-task-picker-item {
        min-height: 48px;
        padding: 8px 10px;
    }
    .vp-task-picker-item-name {
        font-size: 0.85rem;
    }
    .vp-task-picker-item-output {
        font-size: 0.75rem;
    }
    .vp-task-picker-btn-add {
        min-width: 76px;
        height: 36px;
        min-height: 36px;
        font-size: 13px;
        border-radius: 8px;
    }
}

/* ==========================================================================
   COMPACT DESKTOP TASK TABLE & RESPONSIVE ROWS
   ========================================================================== */
.vp-task-table-wrapper {
    background: #ffffff;
    border: 1px solid var(--vp-quick-border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.vp-task-table-header {
    background: #f8fafc !important;
    border-bottom: 2px solid var(--vp-quick-border, #e2e8f0) !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    color: #475569 !important;
    padding: 10px 12px !important;
}

.vp-task-row {
    border-bottom: 1px solid var(--vp-quick-border);
    background: #ffffff;
    transition: background-color 0.15s ease;
}

.vp-task-row:last-child {
    border-bottom: none;
}

.vp-task-row:hover {
    background-color: #fafbfc;
}

.vp-task-row .form-control-sm {
    height: 34px;
    min-height: 34px;
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

.vp-col-name .text-truncate {
    max-width: 460px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

@media (min-width: 1400px) {
    .vp-col-name .text-truncate {
        max-width: 650px;
    }
}

.vp-task-details-drawer {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background-color: #f8fafc;
}

.vp-task-code-badge {
    background-color: #f3e8ff;
    color: #6f42c1;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.825rem;
    display: inline-block;
}

/* Card highlight animation when target task is highlighted */
@keyframes vp-pulse-highlight {
    0% {
        box-shadow: 0 0 0 0 rgba(111, 66, 193, 0.6);
        background-color: #f3e8ff;
    }
    50% {
        box-shadow: 0 0 0 6px rgba(111, 66, 193, 0.2);
        background-color: #f3e8ff;
    }
    100% {
        box-shadow: 0 0 0 0 rgba(111, 66, 193, 0);
    }
}

.vp-row-highlight {
    animation: vp-pulse-highlight 1.2s ease 2;
}

/* Mobile responsive card layout for task rows */
@media (max-width: 767.98px) {
    .vp-task-table-wrapper {
        background: transparent;
        border: none;
        box-shadow: none;
    }

    .vp-task-row {
        background: #ffffff;
        border: 1px solid var(--vp-quick-border);
        border-radius: 10px;
        margin-bottom: 12px;
        padding: 12px !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    }

    .vp-task-row .vp-col-code,
    .vp-task-row .vp-col-name,
    .vp-task-row .vp-col-qty-asg,
    .vp-task-row .vp-col-qty-comp,
    .vp-task-row .vp-col-err,
    .vp-task-row .vp-col-late,
    .vp-task-row .vp-col-date,
    .vp-task-row .vp-col-coeff,
    .vp-task-row .vp-col-action {
        width: 100% !important;
        text-align: left !important;
    }

    .vp-col-name .text-truncate {
        max-width: 100%;
        white-space: normal;
    }
}

/* General criteria score input validation error */
.vp-general-score-input.is-invalid {
    border-color: #dc2626 !important;
    background-color: #fef2f2 !important;
}

.vp-general-score-error {
    font-size: 0.8rem;
    color: #dc2626;
    margin-top: 4px;
}

/* General Criteria Cards */
.vp-criteria-card {
    border-left: 4px solid #10b981;
}

/* Sticky Bottom Summary Bar */
.vp-quick-sticky-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--vp-quick-border);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
    padding: 0.75rem 0;
    z-index: 1040;
}

.vp-sticky-content {
    width: calc(100% - 32px);
    max-width: none;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

@media (min-width: 1200px) {
    .vp-sticky-content {
        width: calc(100% - 48px);
    }
}

.vp-score-summary {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.vp-score-number {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--vp-quick-primary);
}

/* Zero denominator warning banner */
.vp-zero-denominator-alert {
    background-color: #fffbeb;
    border-left: 4px solid #f59e0b;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    color: #92400e;
}

.vp-sticky-actions .btn {
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .vp-quick-container, .vp-quick-fullwidth {
        width: 100%;
        padding: 1rem 0.75rem;
    }
    .launcher-agency-title {
        font-size: 12px !important;
    }
    .launcher-main-title {
        font-size: 18px !important;
    }
    .launcher-subtitle {
        display: none !important;
    }
    .vp-sticky-content {
        width: 100%;
        padding: 0 0.75rem;
        flex-direction: column;
        align-items: stretch;
    }
    .vp-score-summary {
        justify-content: space-between;
    }
    .vp-sticky-actions {
        display: flex;
        gap: 0.5rem;
    }
    .vp-sticky-actions .btn {
        flex: 1;
    }
}

@media (max-width: 430px) {
    .vp-compact-top-bar {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
    .vp-btn-launcher,
    .vp-btn-topbar-logout,
    .vp-btn-topbar-login {
        padding: 0 8px !important;
        font-size: 13px !important;
    }
    .vp-header-brand {
        gap: 10px !important;
    }
    .launcher-agency-title {
        font-size: 11px !important;
    }
    .launcher-main-title {
        font-size: 16px !important;
    }
}

/* ==========================================================================
   NORMALIZED TABLE & FORM SYSTEM (WAVE KPI-UI-3)
   ========================================================================== */
.vp-quick-container table.table,
.vp-quick-fullwidth table.table,
#vpSummaryTable,
#vpBieu04Table {
    font-size: 14px;
}

.vp-quick-container table.table thead th,
.vp-quick-fullwidth table.table thead th,
#vpSummaryTable thead th,
#vpBieu04Table thead th {
    font-size: 13px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    padding: 10px 12px !important;
    border-bottom: 2px solid var(--vp-quick-border, #e2e8f0) !important;
    background-color: #f8fafc !important;
    color: #475569 !important;
}

.vp-quick-container table.table tbody td,
.vp-quick-fullwidth table.table tbody td,
#vpSummaryTable tbody td,
#vpBieu04Table tbody td {
    font-size: 14px !important;
    padding: 10px 12px !important;
    border-bottom: 1px solid #edf2f7 !important;
    vertical-align: middle !important;
}

.vp-quick-container table.table tbody tr:hover td,
.vp-quick-fullwidth table.table tbody tr:hover td,
#vpSummaryTable tbody tr:hover td,
#vpBieu04Table tbody tr:hover td {
    background-color: #f8fafc !important;
}

.vp-quick-container .form-label,
.vp-quick-fullwidth .form-label {
    font-size: 13px;
    font-weight: 600;
}

.vp-quick-container .form-control,
.vp-quick-container .form-select,
.vp-quick-fullwidth .form-control,
.vp-quick-fullwidth .form-select {
    font-size: 14px;
}


