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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f0f2f5;
    color: #1a1a1a;
}

.layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: #1e293b;
    color: #e2e8f0;
    padding: 20px 0;
    flex-shrink: 0;
}

.sidebar h2 {
    padding: 0 20px 20px;
    font-size: 18px;
    border-bottom: 1px solid #334155;
}

.tool-list {
    list-style: none;
    margin-top: 10px;
}

.tool-link {
    display: block;
    padding: 12px 20px;
    color: #94a3b8;
    text-decoration: none;
    transition: background 0.15s;
}

.tool-link:hover {
    background: #334155;
    color: #e2e8f0;
}

.tool-link.active {
    background: #3b82f6;
    color: #fff;
}

/* Main content */
.content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

h1 {
    font-size: 22px;
    margin-bottom: 20px;
}

/* Search */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-bar input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    max-width: 500px;
}

.search-bar button {
    padding: 10px 24px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.search-bar button:hover {
    background: #2563eb;
}

/* Search results */
.search-results {
    margin-bottom: 20px;
    max-height: 240px;
    overflow-y: auto;
    border-radius: 6px;
}

.search-results .product-item {
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.search-results .product-item:hover {
    background: #eff6ff;
    border-color: #3b82f6;
}

.search-results .product-item .product-id {
    font-size: 11px;
    color: #6b7280;
    font-family: monospace;
}

/* Product detail */
.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e5e7eb;
}

.section-header h2 {
    font-size: 18px;
}

.section-header .badge {
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 12px;
    background: #dbeafe;
    color: #1d4ed8;
}

.section-header .badge.status-active,
.section-header .badge.status-PUBLISHED {
    background: #dcfce7;
    color: #166534;
}

/* Attachment grid */
.attachment-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px 0;
    min-height: 60px;
}

.attachment-card {
    width: 180px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    cursor: grab;
    transition: box-shadow 0.15s, border-color 0.15s;
    position: relative;
}

.attachment-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #93c5fd;
}

.attachment-card.sortable-ghost {
    opacity: 0.4;
    border-color: #3b82f6;
}

.attachment-card.sortable-chosen {
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3);
}

.attachment-card img {
    width: 100%;
    height: 140px;
    object-fit: contain;
    background: #f9fafb;
    display: block;
}

.attachment-card .card-info {
    padding: 8px;
    font-size: 12px;
}

.attachment-card .order-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.attachment-card .type-badge {
    font-size: 10px;
    color: #6b7280;
    text-transform: uppercase;
}

.attachment-card .filename {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #374151;
}

/* Save button */
.save-bar {
    margin-top: 8px;
}

.save-btn {
    padding: 8px 20px;
    background: #10b981;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.save-btn:hover {
    background: #059669;
}

.save-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.save-btn.saved {
    background: #6b7280;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 24px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    z-index: 1000;
    animation: fadeIn 0.2s;
}

.toast.success {
    background: #10b981;
}

.toast.error {
    background: #ef4444;
}

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

/* Offer section */
.offer-section {
    margin-left: 20px;
    padding-left: 16px;
    border-left: 3px solid #e5e7eb;
}

.no-attachments {
    color: #9ca3af;
    font-style: italic;
    padding: 12px 0;
    font-size: 13px;
}

.loading {
    color: #6b7280;
    padding: 20px 0;
}
