/* BOM Extractor - Compiled CSS
   Shadcn UI Inspired Design */

/* Variables as CSS Custom Properties */
:root {
    --background: hsl(0, 0%, 100%);
    --foreground: hsl(222, 47%, 11%);
    --card: hsl(0, 0%, 100%);
    --card-foreground: hsl(222, 47%, 11%);
    --primary: hsl(222, 47%, 11%);
    --primary-foreground: hsl(210, 40%, 98%);
    --secondary: hsl(210, 40%, 96%);
    --secondary-foreground: hsl(222, 47%, 11%);
    --muted: hsl(210, 40%, 96%);
    --muted-foreground: hsl(215, 16%, 47%);
    --accent: hsl(210, 40%, 96%);
    --destructive: hsl(0, 84%, 60%);
    --success: hsl(142, 76%, 36%);
    --warning: hsl(38, 92%, 50%);
    --border: hsl(214, 32%, 91%);
    --ring: hsl(222, 47%, 11%);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--foreground);
    background-color: var(--muted);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 150ms ease;
}

a:hover {
    opacity: 0.8;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.25;
    color: var(--foreground);
}

h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

/* Utilities */
.text-muted { color: var(--muted-foreground); }
.text-center { text-align: center; }
.required { color: var(--destructive); }
.mt-lg { margin-top: 1.5rem; }
.mb-lg { margin-bottom: 1.5rem; }

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
.header {
    background: var(--background);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--foreground);
}

.logo svg { color: var(--primary); }
.logo:hover { color: var(--foreground); }

.nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    color: var(--muted-foreground);
    font-weight: 500;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

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

.cart-badge {
    position: absolute;
    top: -8px;
    right: -12px;
    background: var(--destructive);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-left: 1.5rem;
    border-left: 1px solid var(--border);
}

.user-name {
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

/* Main & Footer */
.main {
    flex: 1;
    padding: 2rem 0;
}

.footer {
    background: var(--background);
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    text-align: center;
}

.footer p {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin: 0;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 2rem;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.page-title { margin-bottom: 0.25rem; }
.page-subtitle {
    color: var(--muted-foreground);
    font-size: 0.875rem;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 150ms ease;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

.btn-primary:hover:not(:disabled) {
    opacity: 0.9;
}

.btn-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
    border-color: var(--border);
}

.btn-ghost {
    background: transparent;
    color: var(--foreground);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--muted);
}

.btn-danger {
    color: var(--destructive);
}

.btn-danger:hover:not(:disabled) {
    background: hsla(0, 84%, 60%, 0.1);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-full { width: 100%; }

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.card-body { padding: 1.5rem; }

.card-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--muted);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Project Card */
.project-card .card-header {
    padding: 1rem 1.5rem;
}

.project-description {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.meta-item svg { opacity: 0.7; }

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    white-space: nowrap;
}

.badge-success {
    background: hsla(142, 76%, 36%, 0.15);
    color: var(--success);
}

.badge-warning {
    background: hsla(38, 92%, 50%, 0.15);
    color: hsl(38, 92%, 35%);
}

.badge-muted {
    background: var(--muted);
    color: var(--muted-foreground);
}

/* Alerts */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.alert svg {
    flex-shrink: 0;
    margin-top: 1px;
}

.alert-error {
    background: hsla(0, 84%, 60%, 0.1);
    color: var(--destructive);
    border: 1px solid hsla(0, 84%, 60%, 0.2);
}

.alert-success {
    background: hsla(142, 76%, 36%, 0.1);
    color: var(--success);
    border: 1px solid hsla(142, 76%, 36%, 0.2);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--muted-foreground);
}

.empty-state .empty-icon {
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: var(--foreground);
}

.empty-state p { margin-bottom: 1.5rem; }

/* Forms */
.form-group { margin-bottom: 1.5rem; }

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--background);
    color: var(--foreground);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px hsla(222, 47%, 11%, 0.2);
}

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

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2rem;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin-top: 0.25rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* File Upload */
.file-upload {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    transition: border-color 150ms ease, background 150ms ease;
}

.file-upload:hover,
.file-upload.dragging {
    border-color: var(--primary);
    background: hsla(222, 47%, 11%, 0.02);
}

.file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.file-upload-content {
    padding: 2rem;
    text-align: center;
}

.file-icon {
    color: var(--muted-foreground);
    margin-bottom: 1rem;
}

.file-text {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin-bottom: 0.25rem;
}

.file-link {
    color: var(--primary);
    font-weight: 500;
}

.file-hint {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin: 0;
}

.file-selected {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--muted);
    border-radius: var(--radius-md);
}

.file-selected svg { color: var(--success); }

.file-selected .file-name {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
}

.file-selected .file-remove {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--muted-foreground);
    cursor: pointer;
    line-height: 1;
}

.file-selected .file-remove:hover {
    color: var(--destructive);
}

/* Auth Styles */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header .auth-icon {
    color: var(--primary);
    margin-bottom: 1rem;
}

.auth-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.auth-subtitle {
    color: var(--muted-foreground);
    font-size: 0.875rem;
    margin: 0;
}

.auth-form { margin-bottom: 1.5rem; }

.auth-footer {
    text-align: center;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.auth-footer p { margin: 0; }

/* Tables */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.table th {
    font-weight: 500;
    color: var(--muted-foreground);
    background: var(--muted);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table tbody tr {
    transition: background 150ms ease;
}

.table tbody tr:hover {
    background: hsla(210, 40%, 96%, 0.5);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table-components th,
.table-components td {
    padding: 0.5rem 1rem;
}

.col-narrow {
    width: 1%;
    white-space: nowrap;
}

.col-description { max-width: 250px; }

.column-letter {
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--primary);
    color: var(--primary-foreground);
    border-radius: var(--radius-sm);
    margin-right: 0.25rem;
}

.part-number strong {
    display: block;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.875rem;
}

.part-number small {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.75rem;
}

.datasheet-link {
    display: inline-flex;
    align-items: center;
    color: var(--primary);
    margin-left: 0.25rem;
    opacity: 0.7;
}

.datasheet-link:hover { opacity: 1; }

.price-breaks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.price-break {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 0.25rem;
    background: var(--muted);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-family: 'SF Mono', Monaco, monospace;
}

.price-break .qty { color: var(--muted-foreground); }
.price-break .price { font-weight: 500; }

/* Mapping Grid */
.mapping-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.mapping-section,
.preview-section {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
}

.section-description {
    color: var(--muted-foreground);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--background);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--foreground);
}

.btn-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--muted-foreground);
    line-height: 1;
    padding: 0;
    width: 2rem;
    height: 2rem;
}

.btn-close:hover {
    color: var(--foreground);
}

.modal-body {
    padding: 1.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.checkbox-label input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    cursor: pointer;
}

/* Shared users list */
.shared-users-list {
    margin-top: 2rem;
}

.shared-users-list h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--foreground);
}

.shared-users-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.shared-users-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    background: var(--card);
}

.shared-users-list .user-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.shared-users-list .user-info strong {
    color: var(--foreground);
}

.shared-users-list .user-info span {
    color: var(--muted-foreground);
    font-size: 0.9rem;
}

.shared-users-list .badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.badge-admin {
    background: #e11d48;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-user {
    background: var(--muted);
    color: var(--muted-foreground);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
}

.shared-badge {
    color: var(--primary);
    font-weight: 500;
}

.shared-badge-inline {
    display: inline-flex;
    align-items: center;
    margin-left: 0.5rem;
    color: var(--primary);
    vertical-align: middle;
}

.shared-badge-inline svg {
    width: 16px;
    height: 16px;
}

.text-muted {
    color: var(--muted-foreground);
    font-style: italic;
}

.form-help {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: var(--card);
    border-bottom: 2px solid var(--border);
}

.table th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--foreground);
    font-size: 0.875rem;
}

.table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--foreground);
}

.table tbody tr:hover {
    background: var(--card);
}

/* Responsive */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .header-actions {
        flex-wrap: wrap;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .nav-user {
        display: none;
    }
}
