/* ==========================================================================
   TechnicalDataCard Component Styles
   Story 28.13: Intake Form UX Improvements - R1: Technical Data Card
   Updated: Sprint S5 Story 28.21 - CSS Custom Properties integration

   Features:
   - Visually distinct from editable sections (cyan left border, light background)
   - "Solo lectura" badge in header
   - Essential fields with LiveLink indicators
   - Summary grid and expandable detailed fields
   - Responsive design
   - Uses shared CSS custom properties from field-grid-variables.css
   ========================================================================== */

/* ========== BASE COMPONENT ========== */

.technical-data-card {
    position: relative;
    background: linear-gradient(135deg, var(--field-bg-readonly) 0%, var(--field-bg-editable) 100%);
    border: var(--field-border-width) solid var(--field-border-color);
    border-left: var(--field-border-livelink-width) solid var(--color-livelink);
    border-radius: var(--field-border-radius-lg);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: var(--field-transition);
}

.technical-data-card:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.technical-data-card.empty {
    border-left-color: #9ca3af; /* Gray when no data */
}

/* ========== CARD HEADER ========== */

.technical-data-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(6, 182, 212, 0.04);
    border-bottom: 1px solid rgba(6, 182, 212, 0.1);
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease;
}

.technical-data-card .card-header:hover {
    background: rgba(6, 182, 212, 0.08);
}

.technical-data-card .header-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.technical-data-card .card-icon {
    color: #06b6d4;
    font-size: 18px;
}

.technical-data-card .card-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

/* ========== READ-ONLY BADGE ========== */

.technical-data-card .read-only-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 100px;
}

.technical-data-card .read-only-badge .oi {
    font-size: 9px;
}

/* ========== EXPAND TOGGLE ========== */

.technical-data-card .expand-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s ease;
}

.technical-data-card .expand-toggle:hover {
    background-color: rgba(6, 182, 212, 0.1);
    color: #06b6d4;
}

.technical-data-card .expand-toggle:focus-visible {
    outline: 2px solid #06b6d4;
    outline-offset: 2px;
}

/* ========== CARD BODY ========== */

.technical-data-card .card-body {
    padding: 12px 14px;
}

/* ========== COMPACT 4-COLUMN GRID (Story 28.13 UX, Updated S5) ========== */

.technical-data-card .compact-fields-grid {
    display: grid;
    grid-template-columns: repeat(var(--field-grid-columns), 1fr);
    gap: var(--field-grid-gap);
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: var(--field-border-width) solid var(--field-border-color);
}

.technical-data-card .compact-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--field-padding-compact);
    background-color: var(--field-bg-readonly);
    border-radius: var(--field-border-radius-lg);
    border: var(--field-border-width) solid var(--field-border-color);
}

.technical-data-card .compact-label {
    font-size: var(--field-label-size);
    font-weight: var(--field-label-weight);
    color: var(--field-label-color);
    text-transform: var(--field-label-transform);
    letter-spacing: var(--field-label-spacing);
}

.technical-data-card .compact-value {
    font-size: var(--field-value-size);
    font-weight: var(--field-value-weight);
    color: var(--field-value-color);
}

/* ========== SECONDARY INFO ROW ========== */

.technical-data-card .secondary-info-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #4b5563;
    padding: 4px 0;
}

.technical-data-card .secondary-info-row .info-item {
    display: inline;
}

.technical-data-card .secondary-info-row .info-item strong {
    font-weight: 600;
    color: #6b7280;
}

.technical-data-card .secondary-info-row .info-separator {
    color: #d1d5db;
    margin: 0 2px;
}

/* ========== EMPTY STATE ========== */

.technical-data-card .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    text-align: center;
    color: #9ca3af;
}

.technical-data-card .empty-state .oi {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.technical-data-card .empty-state p {
    margin: 0;
    font-size: 14px;
}

/* ========== LEGACY STYLES (kept for backwards compatibility) ========== */

.technical-data-card .essential-fields-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}

.technical-data-card .summary-grid {
    display: none; /* Replaced by secondary-info-row */
}

/* ========== DETAILED FIELDS SECTION ========== */

.technical-data-card .detailed-fields-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #e5e7eb;
}

.technical-data-card .show-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: #06b6d4;
    background: transparent;
    border: 1px solid #06b6d4;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.technical-data-card .show-more-btn:hover {
    background-color: rgba(6, 182, 212, 0.08);
}

.technical-data-card .show-more-btn:focus-visible {
    outline: 2px solid #06b6d4;
    outline-offset: 2px;
}

.technical-data-card .show-more-btn.expanded {
    background-color: rgba(6, 182, 212, 0.08);
}

/* ========== DETAILED FIELDS GRID ========== */

.technical-data-card .detailed-fields-grid {
    margin-top: 16px;
}

.technical-data-card .field-category {
    margin-bottom: 16px;
}

.technical-data-card .field-category:last-child {
    margin-bottom: 0;
}

.technical-data-card .category-title {
    margin: 0 0 8px 0;
    padding-bottom: 4px;
    font-size: 11px;
    font-weight: 700;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e5e7eb;
}

.technical-data-card .category-fields {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.technical-data-card .detailed-field-item {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 4px 0;
}

.technical-data-card .detailed-field-item .field-label {
    font-size: 10px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.technical-data-card .detailed-field-item .field-value {
    font-size: 12px;
    color: #374151;
}

/* ========== LAST REFRESHED ========== */

.technical-data-card .last-refreshed {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
    font-size: 11px;
    color: #9ca3af;
}

.technical-data-card .last-refreshed .oi {
    font-size: 10px;
}

/* ========== COLLAPSED STATE ========== */

.technical-data-card.collapsed .card-body {
    display: none;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 992px) {
    .technical-data-card .compact-fields-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .technical-data-card .essential-fields-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .technical-data-card .compact-fields-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .technical-data-card .essential-fields-row {
        grid-template-columns: 1fr;
    }

    .technical-data-card .category-fields {
        grid-template-columns: 1fr;
    }

    .technical-data-card .header-content {
        flex-wrap: wrap;
        gap: 8px;
    }

    .technical-data-card .read-only-badge {
        order: 3;
        flex-basis: 100%;
    }

    .technical-data-card .secondary-info-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .technical-data-card .secondary-info-row .info-separator {
        display: none;
    }
}

@media (max-width: 576px) {
    .technical-data-card .card-header {
        padding: 8px 10px;
    }

    .technical-data-card .card-body {
        padding: 10px;
    }

    .technical-data-card .card-title {
        font-size: 13px;
    }

    .technical-data-card .compact-fields-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
}

/* ========== ACCESSIBILITY: REDUCED MOTION ========== */

@media (prefers-reduced-motion: reduce) {
    .technical-data-card {
        transition: none;
    }

    .technical-data-card .card-header,
    .technical-data-card .expand-toggle,
    .technical-data-card .show-more-btn {
        transition: none;
    }
}

/* ========== PRINT STYLES ========== */

@media print {
    .technical-data-card {
        border: 1px solid #000;
        box-shadow: none;
        page-break-inside: avoid;
    }

    .technical-data-card .expand-toggle,
    .technical-data-card .show-more-btn {
        display: none;
    }

    .technical-data-card .detailed-fields-grid {
        display: block !important;
    }
}
