/**
 * OMS Card Component Styles
 * Reusable card classes for XML widget styling
 * Usage: Add type="Info" (or Summary, KPI) to widget element in XML
 */

:root {
    --oms-primary: #115e8a;
    --oms-primary-light: #1976d2;
    --oms-primary-dark: #0d4763;
    --oms-success: #10B981;
    --oms-warning: #F59E0B;
    --oms-danger: #EF4444;
    --oms-info: #3B82F6;
    --oms-purple: #8B5CF6;
    --oms-gray-50: #F9FAFB;
    --oms-gray-100: #F3F4F6;
    --oms-gray-200: #E5E7EB;
    --oms-gray-300: #D1D5DB;
    --oms-gray-400: #9CA3AF;
    --oms-gray-500: #6B7280;
    --oms-gray-600: #4B5563;
    --oms-gray-700: #374151;
    --oms-gray-800: #1F2937;
    --oms-gray-900: #111827;
}

/* ===== BASE CARD SHELL ===== */
.card, .card-1 {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px !important;
    padding: 0;
    margin-bottom: 10px;
    margin-top: 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: all 0.2s ease-in-out;
    overflow: hidden;
}

/* Equal-height cards: columns containing card-info stretch to same height */
.row:has(> [class*="col-"] > .card-info) > [class*="col-"] {
    display: flex;
    flex-direction: column;
}

.card:hover, .card-1:hover {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ===== CARD ACCENT COLORS (left border) ===== */
.card-accent-blue {
    border-left: 3px solid #1049AE !important;
}

.card-accent-lightblue {
    border-left: 3px solid #3b82f6 !important;
}

.card-accent-yellow {
    border-left: 3px solid #f59e0b !important;
}

.card-accent-green {
    border-left: 3px solid #16a34a !important;
}

.card-accent-red {
    border-left: 3px solid #dc2626 !important;
}

.card-accent-purple {
    border-left: 3px solid #7c3aed !important;
}

.card-accent-gray {
    border-left: 3px solid #6b7280 !important;
}

/* GLOBAL PENCIL EDIT BUTTON */
.pencil-edit-btn {
    background: transparent !important;
    border: none !important;
    color: #6b7280 !important;
    cursor: pointer;
    font-size: 0.875rem !important;
    padding: 0.5rem !important;
    border-radius: 4px;
    transition: all 0.2s;
    margin-right: 1rem;
    min-width: 28px;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pencil-edit-btn:hover {
    background-color: rgba(0, 0, 0, 0.05) !important;
    color: #1e6bb8 !important;
    transform: scale(1.1);
}

.pencil-edit-btn i,
.pencil-edit-btn .fa {
    font-size: 0.875rem !important;
    color: inherit;
}

/* ===================================================================
   CARD-INFO: Label/value detail cards with title row + edit button
   =================================================================== */

/* Card-info gets padding so content isn't flush against border */
.card-info {
    padding: 1rem 1.25rem !important;
    height: 100%;
    box-sizing: border-box;
}

/* Title element inside .card-info - target title-display div */
.card-info > .row:first-child [class*="col-"]:first-child .title-display {
    font-size: 1rem !important;
    font-weight: 700 !important;
    color: #1049AE !important;
    margin: 0 !important;
    padding: 0 !important;
    background: none !important;
    border: none !important;
    display: inline-block !important;
}

/* First row in card-info should display title and button inline */
.card-info > .row:first-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 0.6rem 0 !important;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

/* Field rows - single column layout with field flex */
.card-info .row:not(:first-child) {
    padding: 0.25rem 0;
}

.card-info .row:last-child {
    padding-bottom: 0;
}

/* Field component inside card-info: flex row for label/value side-by-side */
.card-info .field {
    display: flex !important;
    justify-content: space-between !important;
    align-items: baseline !important;
    gap: 0.5rem;
}

/* Field labels - left side */
.card-info .field-label {
    font-weight: 500 !important;
    color: #6b7280 !important;
    font-size: 0.85rem !important;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Hide empty field-label (e.g., Address card with no label attribute) */
.card-info .field-label:empty {
    display: none !important;
}

/* Field values - right side, right-aligned */
.card-info .field-value-container {
    text-align: right;
    flex: 1;
    min-width: 0;
    font-weight: 600;
}

.card-info .field-value {
    color: #1f2937;
    font-size: 0.813rem;
    text-align: right;
}

/* Masked fields inside card-info: same inline layout as regular fields */
.card-info .masked-field-wrapper {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: baseline !important;
    gap: 0.5rem;
}

.card-info .masked-field-label {
    font-weight: 500 !important;
    color: #6b7280 !important;
    font-size: 0.85rem !important;
    white-space: nowrap;
    flex-shrink: 0;
}

.card-info .masked-field-value-container {
    text-align: right;
    flex: 1;
    min-width: 0;
    font-weight: 600;
}

.card-info .masked-field-value {
    color: #1f2937;
    font-size: 0.813rem;
    text-align: right;
}

.card-info .masked-field-hoverable:hover {
    background-color: rgba(37, 99, 235, 0.05);
    border-radius: 4px;
    padding: 2px 4px;
}

.card-info .masked-field-hoverable:hover .masked-field-label {
    color: #2563eb;
}

/* ===================================================================
   CARD-SUMMARY: Grid/table cards with blue header row
   =================================================================== */

/* Title styling for summary cards */
.card-summary > .row:first-child [class*="col-"]:first-child .title-display {
    font-size: 1.10rem !important;
    font-weight: 700 !important;
    color: #1049ae !important;
    padding: 0 !important;
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
}

/* Help icon alignment inside summary header */
.card-summary > .row:first-child .help-info-icon,
.card-summary > .row:first-child .mud-tooltip-root {
    vertical-align: middle !important;
    display: inline-flex !important;
    align-items: center !important;
    margin-left: 4px !important;
}

/* First row in card-summary: gray header bar */
.card-summary > .row:first-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem !important;
    background: var(--oms-gray-50) !important;
    border-bottom: 1px solid #d1d5db;
}

/* View All button styling */
.card-summary > .row:first-child .btn.oms-primary {
    padding: 0.25rem 0.75rem !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    line-height: 1.25rem !important;
    border-radius: 4px !important;
    min-height: auto !important;
    height: auto !important;
}

/* Content area: zero padding for edge-to-edge grid */
.card-summary > .row:not(:first-child) {
    padding: 0 !important;
}

/* Only zero out col padding INSIDE the grid content area, not the title row */
.card-summary > .row:not(:first-child) > [class*="col-"] {
    padding: 0 !important;
}

/* Remove MudBlazor default borders/shadow inside summary cards */
.card-summary .mud-elevation-1 {
    box-shadow: none !important;
}

.card-summary .mud-table,
.card-summary .mud-data-grid,
.card-summary .mud-elevation-1,
.card-summary .border-solid {
    border: none !important;
}

/* Override MetaGrid table container width to prevent overflow */
.card-summary .mud-table-container {
    width: 100% !important;
    overflow-x: auto;
}

/* Table header background */
.card-summary .mud-table-head,
.card-summary .mud-drop-container > table.mud-table-root > thead.mud-table-head {
    background: #EBF5FB !important;
}

.card-summary .mud-table-head .mud-table-cell {
    font-weight: 600 !important;
    font-size: 0.813rem !important;
    color: #111827 !important;
}

/* Pagination toolbar styling */
.card-summary .mud-table-pagination,
.card-summary .mud-table-pagination-toolbar {
    background: var(--oms-gray-50) !important;
    border-top: 1px solid #e5e7eb;
}

/* ===================================================================
   CARD-KPI: Stat cards matching submission-overview mockup
   =================================================================== */
.card-kpi {
    padding: 14px 16px !important;
    border-radius: 8px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
}

/* Title row in KPI: no background bar, no border */
.card-kpi > .row:first-child {
    padding: 0 !important;
    margin: 0 !important;
    background: none !important;
    border: none !important;
}

/* Remove left padding from col inside KPI first row */
.card-kpi > .row:first-child > [class*="col-"] {
    padding-left: 0 !important;
}

/* Title = stat-label (small uppercase) */
.card-kpi > .row:first-child [class*="col-"]:first-child .title-display {
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    color: var(--oms-gray-500) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    padding: 0 !important;
    margin: 0 0 2px 0 !important;
    display: block !important;
    background: none !important;
    border: none !important;
}

/* Value rows */
.card-kpi .row:not(:first-child) {
    padding: 0 !important;
}

/* kpi-value = large bold metric */
.card-kpi .kpi-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--oms-gray-800);
    line-height: 1.3;
}

/* kpi-sub = small gray subtitle */
.card-kpi .kpi-sub {
    font-size: 0.7rem;
    color: var(--oms-gray-400);
    margin-top: 1px;
}

/* Field inside KPI cards (if used instead of literal) */
.card-kpi .field {
    display: block !important;
}

.card-kpi .field-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--oms-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.card-kpi .field-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--oms-gray-800);
}

/* ===================================================================
   CARD-DETAIL: Alternate detail card with tighter spacing
   =================================================================== */
.card-detail .row:not(:first-child) {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.card-detail .row:last-child {
    padding-bottom: 1rem;
}

.card-detail .card-label {
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
    min-width: 120px;
    display: inline-block;
}

.card-detail .card-value {
    color: #1f2937;
    font-size: 0.875rem;
}

/* ===================================================================
   RESPONSIVE
   =================================================================== */
@media (max-width: 768px) {
    .card, .card-1 {
        padding: 14px;
        min-height: auto;
    }
}
