/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #374151;
    background: linear-gradient(135deg, #f0fdf4 0%, #eff6ff 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.header {
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid #e5e7eb;
}

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

.header-info h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.25rem;
}

.header-info p {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-white {
    background: white;
    color: #1f2937;
    border: 1px solid #d1d5db;
}

.btn-white:hover {
    background: #f9fafb;
}

.btn-outline {
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-orange {
    background: #f97316;
    color: white;
}

.btn-orange:hover {
    background: #ea580c;
}

.btn-icon {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    background: white;
    color: #6b7280;
}

.btn-icon:hover {
    background: #f9fafb;
}

/* Stats Section */
.stats-section {
    background: white;
    border-bottom: 1px solid #e5e7eb;
}

.stats-grid {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 0.75rem 0;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #3b82f6;
}

.stat-value.stat-green {
    color: #059669;
}

.stat-value.stat-red {
    color: #dc2626;
}

.stat-value.stat-orange {
    color: #ea580c;
}

.stat-label {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* Main Content */
.main-content {
    padding: 2rem 0;
}

/* Inventory Grid */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.inventory-item {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
}

.inventory-item:hover {
    box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.item-content {
    padding: 1.5rem;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.item-title-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.item-icon {
    font-size: 1.5rem;
}

.item-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.25rem;
}

.item-id {
    font-size: 0.75rem;
    color: #6b7280;
}

.item-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.condition-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.condition-new, .condition-excellent {
    background: #dcfce7;
    color: #166534;
}

.condition-good {
    background: #dbeafe;
    color: #1e40af;
}

.condition-fair {
    background: #fef3c7;
    color: #92400e;
}

.condition-poor {
    background: #fed7aa;
    color: #c2410c;
}

.condition-broken {
    background: #fecaca;
    color: #991b1b;
}

.condition-expert {
    background: #e9d5ff;
    color: #7c2d12;
}

.condition-intermediate {
    background: #dbeafe;
    color: #1e40af;
}

.condition-beginner {
    background: #f3f4f6;
    color: #374151;
}

.match-badge {
    background: #fed7aa;
    color: #c2410c;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.item-description {
    color: #4b5563;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* Broken Asset Details */
.broken-details {
    background: #fef2f2;
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.broken-title {
    font-weight: 500;
    color: #7f1d1d;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.broken-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    font-size: 0.75rem;
}

.broken-section h5 {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.broken-what {
    color: #991b1b;
}

.broken-works {
    color: #166534;
}

.parts-value {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #991b1b;
}

.match-info {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #fed7aa;
    border-radius: 0.25rem;
    font-size: 0.75rem;
}

.match-title {
    font-weight: 500;
    color: #c2410c;
}

.match-description {
    color: #ea580c;
}

/* Item Details */
.item-details {
    margin-bottom: 1rem;
}

.detail-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.detail-row i {
    width: 0.75rem;
    text-align: center;
}

.pipeline-badge {
    background: #f3f4f6;
    color: #374151;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
}

.travel-distance {
    color: #ea580c;
    font-weight: 500;
}

/* Item Footer */
.item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.terms-badge {
    font-size: 0.875rem;
    font-weight: 500;
    color: #166534;
}

.rating-info {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: #6b7280;
}

/* Item Actions */
.item-actions {
    display: flex;
    gap: 0.5rem;
}

.item-actions .btn {
    flex: 1;
}

.item-actions .btn-icon {
    flex: none;
}

/* CTA Section */
.cta-section {
    background: linear-gradient(135deg, #3b82f6 0%, #059669 100%);
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: center;
    color: white;
}

.cta-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.cta-content p {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 1.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.cta-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.modal-backdrop.active {
    display: block;
}

.modal-content {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.5rem 0;
    margin-bottom: 1rem;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
}

.modal-close:hover {
    background: #f3f4f6;
}

.modal-body {
    padding: 0 1.5rem 1.5rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

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

    .form-row {
        grid-template-columns: 1fr;
    }

    .cta-actions {
        flex-direction: column;
        align-items: center;
    }

    .item-actions {
        flex-direction: column;
    }

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

@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }

    .item-content {
        padding: 1rem;
    }

    .modal-content {
        margin: 0.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.inventory-item {
    animation: fadeIn 0.3s ease-out;
}

/* Loading State */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    color: #6b7280;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

