/* Meter Specifications Database - Modern UI */
/* Inspired by Vercel/shadcn design system */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Neutral palette - shadcn-inspired */
    --background: #09090b;
    --background-secondary: #0c0c0f;
    --card: #18181b;
    --card-hover: #1f1f23;
    --border: #27272a;
    --border-hover: #3f3f46;
    --ring: #a1a1aa;

    /* Text colors */
    --foreground: #fafafa;
    --foreground-muted: #a1a1aa;
    --foreground-subtle: #71717a;

    /* Accent colors */
    --primary: #ffffff;
    --primary-foreground: #09090b;
    --accent: #27272a;
    --accent-hover: #3f3f46;

    /* Semantic colors */
    --success: #22c55e;
    --success-muted: rgba(34, 197, 94, 0.15);
    --warning: #eab308;
    --warning-muted: rgba(234, 179, 8, 0.15);
    --destructive: #ef4444;
    --destructive-muted: rgba(239, 68, 68, 0.15);
    --info: #3b82f6;
    --info-muted: rgba(59, 130, 246, 0.15);

    /* Spacing */
    --radius: 8px;
    --radius-lg: 12px;
    --radius-sm: 6px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Login Styles
   ============================================ */

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(to bottom, var(--background), var(--background-secondary));
}

.login-form {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 100%;
    max-width: 380px;
    text-align: center;
}

.login-form h2 {
    color: var(--foreground);
    margin-bottom: 8px;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.025em;
}

.login-subtitle {
    color: var(--foreground-subtle);
    margin-bottom: 24px;
    font-size: 0.875rem;
}

.login-form input {
    width: 100%;
    padding: 12px 14px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--background);
    color: var(--foreground);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--foreground-subtle);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.login-form input::placeholder {
    color: var(--foreground-subtle);
}

.login-form button {
    width: 100%;
    padding: 12px 16px;
    margin-top: 8px;
    background: var(--foreground);
    color: var(--background);
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.15s;
}

.login-form button:hover {
    opacity: 0.9;
}

.login-form button:active {
    opacity: 0.8;
}

.login-form .error {
    color: var(--destructive);
    margin-top: 16px;
    font-size: 0.875rem;
    min-height: 1.25rem;
}

/* ============================================
   Layout
   ============================================ */

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 12px 16px;
}

@media (min-width: 768px) {
    .container {
        padding: 16px 24px;
    }
}

/* ============================================
   Compact Header
   ============================================ */

header {
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    background: rgba(9, 9, 11, 0.9);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    max-width: 1600px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .header-inner {
        padding: 8px 24px;
    }
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--foreground);
    letter-spacing: -0.01em;
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--foreground-subtle);
}

.header-stats span:not(:empty) {
    padding: 2px 6px;
    background: var(--accent);
    border-radius: 4px;
}

.header-stats span:empty {
    display: none;
}

/* Logout Button */
.logout-btn {
    background: transparent;
    border: none;
    color: var(--foreground-subtle);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}

.logout-btn:hover {
    background: var(--accent);
    color: var(--foreground-muted);
}

/* ============================================
   Filters Panel
   ============================================ */

.filters-panel {
    background: var(--card);
    border-radius: var(--radius);
    padding: 8px 10px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
}

.filters-header {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-row-inline {
    flex: 1;
    min-width: 0;
}

.search-row-inline .search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    background: var(--background);
    color: var(--foreground);
    transition: all 0.15s;
}

.search-row-inline .search-input:focus {
    outline: none;
    border-color: var(--foreground-subtle);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05);
}

.search-row-inline .search-input::placeholder {
    color: var(--foreground-subtle);
}

.filter-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.toggle-filters {
    background: var(--accent);
    border: 1px solid var(--border);
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    color: var(--foreground-muted);
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s;
}

.toggle-filters:hover {
    background: var(--accent-hover);
    color: var(--foreground);
}

#filter-toggle-icon {
    font-size: 8px;
    opacity: 0.6;
}

.clear-filters {
    background: transparent;
    border: 1px solid var(--border);
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    color: var(--foreground-subtle);
    transition: all 0.15s;
}

.clear-filters:hover {
    background: var(--accent);
    border-color: var(--border-hover);
    color: var(--foreground-muted);
}

.search-row {
    margin-bottom: 16px;
}

.search-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
    background: var(--background);
    color: var(--foreground);
    transition: all 0.15s;
}

.search-input::placeholder {
    color: var(--foreground-subtle);
}

.search-input:focus {
    outline: none;
    border-color: var(--foreground-subtle);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.filters-collapsible {
    display: none;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.filters-collapsible.show {
    display: block;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 6px;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-size: 10px;
    font-weight: 500;
    color: var(--foreground-subtle);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.filter-group select {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: inherit;
    background: var(--background);
    color: var(--foreground);
    cursor: pointer;
    transition: all 0.15s;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%2371717a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--foreground-subtle);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.filter-group select option {
    background: var(--card);
    color: var(--foreground);
}

/* Output filters inline with dropdowns */
.filter-group-outputs {
    grid-column: 1 / -1; /* Span all columns */
}

.filter-group-outputs .checkbox-grid {
    margin-top: 0;
}

.checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 10px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--foreground-muted);
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.checkbox-item:hover {
    background: var(--accent);
    border-color: var(--border-hover);
    color: var(--foreground);
}

.checkbox-item.checked {
    background: var(--foreground);
    border-color: var(--foreground);
    color: var(--background);
}

.checkbox-item input {
    display: none;
}

@media (min-width: 640px) {
    .filters-panel {
        padding: 10px 12px;
        margin-bottom: 10px;
    }

    .toggle-filters {
        display: none;
    }

    .filters-collapsible {
        display: block !important;
    }

    .filters-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
}

@media (min-width: 900px) {
    .filters-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (min-width: 1200px) {
    .filters-panel {
        padding: 12px 14px;
    }

    .filters-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* ============================================
   Results Table - Mobile Card Layout
   ============================================ */

.results-table {
    background: transparent;
}

.results-table table {
    display: block;
}

.results-table thead {
    display: none;
}

.results-table tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.results-table tr.expand-row {
    display: block;
    background: var(--card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 16px;
    transition: all 0.15s;
}

.results-table tr.expand-row:hover {
    border-color: var(--border-hover);
}

.results-table tr.expand-row::after {
    content: 'Tap for details';
    display: block;
    font-size: 11px;
    color: var(--foreground-subtle);
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.results-table tr.expand-row.expanded::after {
    content: 'Tap to collapse';
}

.results-table tr.expand-row.expanded {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom-color: transparent;
}

.results-table td {
    display: block;
    padding: 0;
    border: none;
    margin-bottom: 10px;
}

.results-table td:last-child {
    margin-bottom: 0;
}

.results-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--foreground-subtle);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.results-table td.manufacturer::before,
.results-table td:nth-child(2)::before {
    display: none;
}

.manufacturer {
    font-weight: 500;
    color: var(--foreground-muted);
    font-size: 13px;
}

.product-name {
    color: var(--foreground);
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -0.01em;
}

/* ============================================
   Category & Status Badges
   ============================================ */

.category-cell {
    min-width: 140px;
}

.category-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.category-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.meta-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
}

/* Water meter categories - all blue */
.category-ultrasonic {
    background: rgba(56, 189, 248, 0.15);
    color: #7dd3fc;
}

.category-inline {
    background: rgba(56, 189, 248, 0.15);
    color: #7dd3fc;
}

.category-module {
    background: rgba(168, 85, 247, 0.15);
    color: #c4b5fd;
}

/* Gas meter categories */
.category-gas {
    background: rgba(251, 146, 60, 0.15);
    color: #fdba74;
}

/* Electricity meter categories */
.category-utility-electricity,
.category-electricity {
    background: rgba(250, 204, 21, 0.15);
    color: #fde047;
}

.category-clamp-electricity {
    background: rgba(234, 179, 8, 0.15);
    color: #fbbf24;
}

/* Medium badges */
.medium-badge {
    background: var(--accent);
    color: var(--foreground-muted);
}

.medium-badge.medium-water {
    background: rgba(59, 130, 246, 0.12);
    color: #93c5fd;
}

.medium-badge.medium-gas {
    background: rgba(251, 146, 60, 0.12);
    color: #fdba74;
}

.medium-badge.medium-electric {
    background: rgba(250, 204, 21, 0.12);
    color: #fde047;
}

/* Status badges */
.status-badge {
    background: var(--accent);
}

.status-badge.status-available {
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
}

.status-badge.status-discontinued {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
}

.status-badge.status-legacy {
    background: rgba(234, 179, 8, 0.12);
    color: #fcd34d;
}

.status-badge.status-unknown {
    background: var(--accent);
    color: var(--foreground-subtle);
}

/* ============================================
   Specification Cells
   ============================================ */

.pipe-size,
.ct-rating {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Consolas', monospace;
    font-size: 13px;
    color: var(--foreground);
    background: var(--accent);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    line-height: 1.4;
}

.pipe-inches,
.pipe-dn {
    display: block;
}

.spec-size {
    min-width: 100px;
}

.spec-primary {
    display: block;
    color: var(--warning);
    font-weight: 500;
}

.spec-secondary {
    display: block;
    font-size: 12px;
    color: var(--foreground-subtle);
}

.spec-na {
    color: var(--foreground-subtle);
    font-style: italic;
}

/* Medium-based color coding for specifications */
.spec-water {
    color: #7dd3fc !important; /* Blue for water */
}

.spec-gas {
    color: #fdba74 !important; /* Orange for gas */
}

.spec-electric {
    color: #fde047 !important; /* Yellow for electric */
}

/* Subtle background tints for pipe size containers */
.pipe-size .spec-water,
.ct-rating .spec-water {
    color: #93c5fd;
}

.pipe-size .spec-gas,
.ct-rating .spec-gas {
    color: #fdba74;
}

.pipe-size .spec-electric,
.ct-rating .spec-electric {
    color: #fde047;
}

/* Secondary text (DN values) slightly muted but still color-coded */
.pipe-dn.spec-water {
    color: #7dd3fc;
    opacity: 0.85;
}

.pipe-dn.spec-gas {
    color: #fdba74;
    opacity: 0.85;
}

.pipe-dn.spec-electric {
    color: #fde047;
    opacity: 0.85;
}

.spec-secondary.spec-water {
    color: #7dd3fc;
    opacity: 0.75;
}

.spec-secondary.spec-gas {
    color: #fdba74;
    opacity: 0.75;
}

.spec-secondary.spec-electric {
    color: #fde047;
    opacity: 0.75;
}

/* ============================================
   Output Badges
   ============================================ */

.output-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.output-badge {
    display: inline-block;
    padding: 4px 10px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    color: var(--foreground-muted);
    white-space: nowrap;
    transition: all 0.15s;
}

/* Output type colors */
.output-badge.output-lorawan {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
}

.output-badge.output-modbus-rtu {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
}

.output-badge.output-modbus-tcp {
    background: rgba(56, 189, 248, 0.15);
    color: #7dd3fc;
}

.output-badge.output-pulse {
    background: rgba(34, 211, 238, 0.15);
    color: #67e8f9;
}

.output-badge.output-4-20ma {
    background: rgba(251, 146, 60, 0.15);
    color: #fdba74;
}

.output-badge.output-0-10v {
    background: rgba(234, 179, 8, 0.15);
    color: #fcd34d;
}

.output-badge.output-rs485 {
    background: rgba(167, 139, 250, 0.15);
    color: #c4b5fd;
}

.output-badge.output-ethernet {
    background: rgba(148, 163, 184, 0.15);
    color: #cbd5e1;
}

.output-badge.highlight {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

/* ============================================
   Desktop Table Layout
   ============================================ */

@media (min-width: 768px) {
    .results-table {
        background: var(--card);
        border-radius: var(--radius-lg);
        border: 1px solid var(--border);
        overflow-x: auto;
    }

    .results-table table {
        display: table;
        width: 100%;
        min-width: 900px;
        border-collapse: collapse;
    }

    .results-table thead {
        display: table-header-group;
    }

    .results-table tbody {
        display: table-row-group;
    }

    .results-table tr.expand-row {
        display: table-row;
        background: transparent;
        border-radius: 0;
        border: none;
        padding: 0;
    }

    .results-table tr.expand-row:hover {
        background: var(--card-hover);
    }

    .results-table tr.expand-row::after {
        display: none;
    }

    .results-table td::before {
        display: none;
    }

    .manufacturer {
        font-size: 13px;
        white-space: nowrap;
    }

    .product-name {
        font-size: 14px;
    }

    th {
        text-align: left;
        padding: 10px 8px;
        font-weight: 500;
        color: var(--foreground-muted);
        border-bottom: 1px solid var(--border);
        white-space: nowrap;
        text-transform: uppercase;
        font-size: 10px;
        letter-spacing: 0.05em;
        background: var(--background);
    }

    .results-table td {
        display: table-cell;
        padding: 10px 8px;
        border-bottom: 1px solid var(--border);
        vertical-align: top;
        font-size: 13px;
    }

    /* Compact specific columns */
    .actions-cell {
        white-space: nowrap;
        width: 70px;
    }

    .spec-size {
        white-space: nowrap;
        font-size: 12px;
    }

    .pdf-links {
        max-width: 120px;
    }

    .pdf-links .pdf-link {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }

    .output-details-cell {
        max-width: 150px;
        font-size: 12px;
    }

    .output-details-text {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    th.sortable {
        cursor: pointer;
        user-select: none;
        transition: all 0.15s;
    }

    th.sortable:hover {
        color: var(--foreground);
    }

    th.sortable::after {
        content: '';
        display: inline-block;
        width: 16px;
        height: 16px;
        vertical-align: middle;
        margin-left: 4px;
        opacity: 0.3;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2'%3E%3Cpath d='M7 15l5 5 5-5M7 9l5-5 5 5'/%3E%3C/svg%3E");
        background-size: contain;
    }

    th.sorted-asc::after {
        opacity: 1;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23fafafa' stroke-width='2'%3E%3Cpath d='M18 15l-6-6-6 6'/%3E%3C/svg%3E");
    }

    th.sorted-desc::after {
        opacity: 1;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23fafafa' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    }

    /* Compact badges for table view */
    .output-badges,
    .power-badges {
        gap: 4px;
    }

    .output-badge,
    .power-badge {
        padding: 2px 6px;
        font-size: 10px;
    }

    .category-badge {
        padding: 2px 8px;
        font-size: 11px;
    }

    .meta-badge {
        padding: 2px 6px;
        font-size: 10px;
    }
}

/* ============================================
   PDF & Contact Links
   ============================================ */

.pdf-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pdf-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--foreground-muted);
    text-decoration: none;
    font-size: 12px;
    transition: all 0.15s;
}

.pdf-link:hover {
    color: var(--foreground);
}

.pdf-icon {
    width: 14px;
    height: 14px;
    opacity: 0.6;
}

.no-results {
    padding: 60px 20px;
    text-align: center;
    color: var(--foreground-subtle);
}

.contact-info {
    font-size: 12px;
    color: var(--foreground-subtle);
}

.contact-info a {
    color: var(--foreground-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.contact-info a:hover {
    color: var(--foreground);
}

/* ============================================
   Power Badges
   ============================================ */

.power-cell {
    min-width: 100px;
}

.power-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.power-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.power-battery {
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
}

.power-ac {
    background: rgba(250, 204, 21, 0.12);
    color: #fde047;
}

.power-dc {
    background: rgba(59, 130, 246, 0.12);
    color: #93c5fd;
}

.power-poe {
    background: rgba(167, 139, 250, 0.12);
    color: #c4b5fd;
}

.power-loop {
    background: rgba(251, 146, 60, 0.12);
    color: #fdba74;
}

.power-solar {
    background: rgba(250, 204, 21, 0.12);
    color: #fde047;
}

.power-self {
    background: rgba(52, 211, 153, 0.12);
    color: #6ee7b7;
}

/* ============================================
   Outputs Cell Styles
   ============================================ */

.outputs-cell {
    min-width: 120px;
}

.output-details-cell {
    min-width: 150px;
    max-width: 200px;
}

.output-details-text {
    font-size: 12px;
    color: var(--foreground-subtle);
    line-height: 1.5;
    word-wrap: break-word;
}

.accessories-note {
    font-size: 11px;
    color: var(--warning);
    font-style: italic;
    margin-top: 4px;
}

/* ============================================
   Detail Row
   ============================================ */

.expand-row {
    cursor: pointer;
    transition: background 0.15s;
}

.detail-row {
    display: none;
}

.detail-row.show {
    display: block;
    background: var(--background-secondary);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    margin-top: -1px;
    padding: 16px;
    border: 1px solid var(--border);
    border-top: 1px solid var(--border);
}

.detail-cell {
    padding: 0;
    background: transparent;
    border: none;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.detail-section h4 {
    font-size: 11px;
    font-weight: 500;
    color: var(--foreground-subtle);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.detail-section p {
    font-size: 13px;
    margin-bottom: 4px;
    color: var(--foreground-muted);
}

.docs-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.docs-section h4 {
    font-size: 11px;
    font-weight: 500;
    color: var(--foreground-subtle);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.docs-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.doc-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground-muted);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.15s;
}

.doc-link:hover {
    background: var(--card-hover);
    border-color: var(--border-hover);
    color: var(--foreground);
}

.doc-link svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.6;
}

/* Product Page Button - Prominent link to manufacturer page */
.product-link-section {
    margin: 16px 0;
    padding: 16px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.product-page-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--foreground);
    color: var(--background);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius);
    transition: all 0.15s;
}

.product-page-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.product-page-btn svg {
    width: 18px;
    height: 18px;
}

/* Contact Section Styling */
.contact-section {
    min-width: 200px;
}

.contact-info-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.contact-item {
    font-size: 13px;
    color: var(--foreground-muted);
}

.contact-link {
    color: var(--foreground);
    text-decoration: none;
    font-weight: 500;
}

.contact-link:hover {
    text-decoration: underline;
}

.no-contact,
.no-docs {
    font-size: 13px;
    color: var(--foreground-subtle);
    font-style: italic;
}

@media (min-width: 768px) {
    .detail-row.show {
        display: table-row;
        border-radius: 0;
        margin-top: 0;
        padding: 0;
        border: none;
    }

    .detail-cell {
        background: var(--background-secondary);
        padding: 20px;
        border-left: 2px solid var(--foreground-subtle);
    }

    .detail-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }

    .docs-links {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .doc-link {
        padding: 8px 12px;
        font-size: 12px;
    }

    .doc-link svg {
        width: 14px;
        height: 14px;
    }
}

/* ============================================
   Actions Column
   ============================================ */

.actions-col {
    width: 80px;
    text-align: center;
}

.actions-cell {
    text-align: center;
    vertical-align: middle !important;
}


.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.action-buttons .btn-edit,
.action-buttons .btn-delete {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0;
    background: transparent;
}

.action-buttons .btn-edit {
    color: var(--foreground-muted);
}

.action-buttons .btn-edit:hover {
    background: var(--accent);
    border-color: var(--border-hover);
    color: var(--foreground);
}

.action-buttons .btn-delete {
    color: var(--foreground-subtle);
}

.action-buttons .btn-delete:hover {
    background: var(--destructive-muted);
    border-color: var(--destructive);
    color: var(--destructive);
}

.action-buttons .btn-edit svg,
.action-buttons .btn-delete svg {
    width: 16px;
    height: 16px;
}

/* ============================================
   Modal Styles
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-small {
    max-width: 420px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--card);
    z-index: 10;
}

.modal-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--foreground);
    letter-spacing: -0.01em;
}

.modal-close {
    background: none;
    border: none;
    color: var(--foreground-subtle);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    transition: all 0.15s;
}

.modal-close:hover {
    background: var(--accent);
    color: var(--foreground);
}

.modal-body {
    padding: 24px;
}

.modal-body p {
    color: var(--foreground-muted);
    margin-bottom: 12px;
}

.warning-text {
    color: var(--destructive) !important;
    font-size: 13px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: 0;
    background: var(--card);
}

/* ============================================
   Form Styles
   ============================================ */

#edit-form {
    padding: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 24px;
}

@media (min-width: 768px) {
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.form-section {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.form-section h3 {
    font-size: 12px;
    font-weight: 500;
    color: var(--foreground-subtle);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.form-group {
    margin-bottom: 14px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--foreground-muted);
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: var(--card);
    color: var(--foreground);
    transition: all 0.15s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--foreground-subtle);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.form-group input::placeholder {
    color: var(--foreground-subtle);
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--foreground-muted);
    padding: 8px 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}

.checkbox-group label:hover {
    background: var(--card-hover);
    border-color: var(--border-hover);
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--foreground);
}

.checkbox-group label:has(input:checked) {
    background: var(--accent);
    border-color: var(--border-hover);
    color: var(--foreground);
}

/* ============================================
   Buttons
   ============================================ */

.btn-cancel {
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--foreground-muted);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-cancel:hover {
    background: var(--accent);
    border-color: var(--border-hover);
    color: var(--foreground);
}

.btn-save {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    background: var(--foreground);
    color: var(--background);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-save:hover {
    opacity: 0.9;
}

.btn-delete {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    background: var(--destructive);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}

.modal-actions .btn-delete {
    width: auto;
    height: auto;
}

.modal-actions .btn-delete:hover {
    opacity: 0.9;
}

/* Mobile modal adjustments */
@media (max-width: 767px) {
    .modal-content {
        max-height: 100vh;
        border-radius: 0;
    }

    .modal {
        padding: 0;
    }

    .form-grid {
        padding: 16px;
        gap: 16px;
    }

    .modal-actions {
        flex-direction: column-reverse;
    }

    .modal-actions button {
        width: 100%;
    }
}
