/* CopyArt Pannello Operatori — v1.0.2 */
.ca-panel { max-width: 1200px; margin: 0 auto; padding: 1rem; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.ca-header { margin-bottom: 1.5rem; }
.ca-header h1 { margin: 0 0 0.75rem; font-size: 1.5rem; font-weight: 600; color: #1a1a2e; }

/* Nav */
.ca-nav { display: flex; gap: 0; border-bottom: 2px solid #e5e7eb; }
.ca-nav-link { padding: 0.5rem 1rem; text-decoration: none; color: #6b7280; font-weight: 500; font-size: 0.875rem; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s; }
.ca-nav-link:hover { color: #1a1a2e; }
.ca-nav-link.active { color: #2563eb; border-bottom-color: #2563eb; }

/* Stats */
.ca-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.ca-stat-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 1.25rem; text-align: center; }
.ca-stat-value { font-size: 1.75rem; font-weight: 700; color: #1a1a2e; }
.ca-stat-label { font-size: 0.8rem; color: #64748b; margin-top: 0.25rem; text-transform: uppercase; letter-spacing: 0.05em; }
.ca-stat-alert { border-color: #ef4444; background: #fef2f2; }
.ca-stat-alert .ca-stat-value { color: #dc2626; }

/* Sections */
.ca-section { margin-bottom: 1.5rem; }
.ca-section h2, .ca-section h3 { font-size: 1.1rem; font-weight: 600; color: #1a1a2e; margin: 0 0 0.75rem; }

/* Tables */
.ca-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.ca-table th { background: #f1f5f9; padding: 0.6rem 0.75rem; text-align: left; font-weight: 600; color: #475569; border-bottom: 2px solid #e2e8f0; }
.ca-table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid #f1f5f9; color: #334155; }
.ca-table tr:hover td { background: #f8fafc; }
.ca-table a { color: #2563eb; text-decoration: none; }
.ca-table a:hover { text-decoration: underline; }
.ca-table-compact th, .ca-table-compact td { padding: 0.4rem 0.5rem; font-size: 0.8rem; }

/* Badges */
.ca-badge { display: inline-block; padding: 0.2rem 0.5rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 500; }
.ca-badge-pending { background: #fef3c7; color: #92400e; }
.ca-badge-confirmed { background: #dbeafe; color: #1e40af; }
.ca-badge-in_production { background: #e0e7ff; color: #3730a3; }
.ca-badge-ready { background: #d1fae5; color: #065f46; }
.ca-badge-delivered { background: #f0fdf4; color: #166534; }
.ca-badge-cancelled { background: #fee2e2; color: #991b1b; }
.ca-badge-paid { background: #d1fae5; color: #065f46; }
.ca-badge-failed { background: #fee2e2; color: #991b1b; }
.ca-badge-sent { background: #fef3c7; color: #92400e; }
.ca-badge-read { background: #dbeafe; color: #1e40af; }
.ca-badge-resolved { background: #d1fae5; color: #065f46; }
.ca-badge-assigned { background: #e0e7ff; color: #3730a3; }
.ca-badge-done { background: #d1fae5; color: #065f46; }

/* Toolbar */
.ca-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; }
.ca-filter-form { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

/* Forms */
.ca-input, .ca-select { padding: 0.45rem 0.65rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.875rem; color: #1f2937; background: #fff; }
.ca-input:focus, .ca-select:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15); }
.ca-input-sm { max-width: 80px; }
textarea.ca-input { resize: vertical; width: 100%; }
.ca-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.ca-field { display: flex; flex-direction: column; gap: 0.3rem; }
.ca-field label { font-size: 0.8rem; font-weight: 500; color: #374151; }
.ca-field-full { grid-column: 1 / -1; }
.ca-form-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
.ca-inline-form { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-top: 0.5rem; }

/* Buttons */
.ca-btn { display: inline-flex; align-items: center; padding: 0.45rem 0.85rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.85rem; font-weight: 500; color: #374151; background: #fff; cursor: pointer; text-decoration: none; transition: all 0.15s; }
.ca-btn:hover { background: #f9fafb; border-color: #9ca3af; }
.ca-btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.ca-btn-primary:hover { background: #1d4ed8; }
.ca-btn-danger { color: #dc2626; border-color: #fca5a5; }
.ca-btn-danger:hover { background: #fef2f2; }
.ca-btn-sm { padding: 0.25rem 0.55rem; font-size: 0.78rem; }

/* Tabs */
.ca-tabs { display: flex; gap: 0; border-bottom: 2px solid #e5e7eb; margin-bottom: 1rem; }
.ca-tab { padding: 0.5rem 1rem; background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; font-size: 0.85rem; font-weight: 500; color: #6b7280; cursor: pointer; transition: all 0.2s; }
.ca-tab:hover { color: #1a1a2e; }
.ca-tab.active { color: #2563eb; border-bottom-color: #2563eb; }
.ca-tab-content { display: none; }
.ca-tab-content.active { display: block; }

/* Detail grid */
.ca-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.ca-detail { font-size: 0.875rem; color: #334155; }
.ca-detail strong { color: #1e293b; }
.ca-detail-full { grid-column: 1 / -1; }

/* Misc */
.ca-empty { color: #94a3b8; font-style: italic; padding: 1rem 0; }
.ca-note { color: #64748b; font-size: 0.8rem; font-style: italic; margin-top: 0.75rem; }
.ca-attr-group { border: 1px solid #e2e8f0; border-radius: 8px; padding: 1rem; margin-bottom: 0.75rem; }
.ca-attr-group h4 { margin: 0 0 0.5rem; font-size: 0.95rem; }
.ca-attr-group small { color: #94a3b8; }
.ca-order-item { border: 1px solid #e2e8f0; border-radius: 8px; padding: 1rem; margin-bottom: 0.75rem; }

/* ============================================= */
/* PUBLIC CATALOG — .ca-pub-*                    */
/* ============================================= */
.ca-pub { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #1f2937; }
.ca-pub-header { text-align: center; margin-bottom: 2rem; }
.ca-pub-header h1 { font-size: 1.75rem; font-weight: 700; color: #1a1a2e; margin: 0 0 0.5rem; }
.ca-pub-subtitle { color: #64748b; font-size: 1rem; margin: 0; }
.ca-pub-empty { text-align: center; color: #94a3b8; font-size: 1rem; padding: 3rem 1rem; }

/* Breadcrumb */
.ca-pub-breadcrumb { font-size: 0.85rem; color: #94a3b8; margin-bottom: 1.5rem; }
.ca-pub-breadcrumb a { color: #2563eb; text-decoration: none; }
.ca-pub-breadcrumb a:hover { text-decoration: underline; }
.ca-pub-sep { margin: 0 0.4rem; }

/* Categories grid */
.ca-pub-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.ca-pub-cat-card { display: block; text-decoration: none; color: inherit; border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; transition: box-shadow 0.2s, transform 0.2s; background: #fff; }
.ca-pub-cat-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.08); transform: translateY(-2px); }
.ca-pub-cat-thumb { height: 180px; background: #f1f5f9; overflow: hidden; }
.ca-pub-cat-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ca-pub-cat-placeholder { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 3rem; background: linear-gradient(135deg, #f1f5f9, #e2e8f0); }
.ca-pub-cat-info { padding: 1.25rem; }
.ca-pub-cat-info h2 { font-size: 1.15rem; font-weight: 600; margin: 0 0 0.4rem; color: #1a1a2e; }
.ca-pub-cat-info p { font-size: 0.85rem; color: #64748b; margin: 0 0 0.5rem; line-height: 1.4; }
.ca-pub-cat-count { font-size: 0.78rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.03em; }

/* Pills */
.ca-pub-pills { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.25rem; }
.ca-pub-pill { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.4rem 0.9rem; border-radius: 9999px; font-size: 0.85rem; font-weight: 500; text-decoration: none; border: 1px solid #d1d5db; color: #4b5563; background: #fff; transition: all 0.15s; }
.ca-pub-pill:hover { border-color: #2563eb; color: #2563eb; }
.ca-pub-pill.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.ca-pub-pill small { font-weight: 400; opacity: 0.7; }

/* Search */
.ca-pub-search { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; align-items: center; }
.ca-pub-search-input { flex: 1; min-width: 200px; padding: 0.5rem 0.75rem; border: 1px solid #d1d5db; border-radius: 8px; font-size: 0.9rem; }
.ca-pub-search-input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,0.15); }
.ca-pub-search-btn { padding: 0.5rem 1.2rem; border: none; border-radius: 8px; background: #2563eb; color: #fff; font-size: 0.85rem; font-weight: 500; cursor: pointer; }
.ca-pub-search-btn:hover { background: #1d4ed8; }
.ca-pub-search-clear { font-size: 0.85rem; color: #dc2626; text-decoration: none; }

/* Products grid */
.ca-pub-prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.25rem; }
.ca-pub-prod-card { display: block; text-decoration: none; color: inherit; border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; transition: box-shadow 0.2s, transform 0.2s; background: #fff; }
.ca-pub-prod-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.08); transform: translateY(-2px); }
.ca-pub-prod-thumb { height: 200px; background: #f1f5f9; overflow: hidden; }
.ca-pub-prod-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ca-pub-prod-placeholder { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 2.5rem; background: linear-gradient(135deg, #f1f5f9, #e2e8f0); }
.ca-pub-placeholder-lg { height: 100%; min-height: 300px; font-size: 4rem; }
.ca-pub-prod-info { padding: 1rem; }
.ca-pub-prod-info h3 { font-size: 1rem; font-weight: 600; margin: 0 0 0.3rem; color: #1a1a2e; }
.ca-pub-prod-info p { font-size: 0.82rem; color: #64748b; margin: 0 0 0.5rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ca-pub-prod-price { font-size: 0.9rem; color: #059669; font-weight: 600; }

/* Product detail — layout */
.ca-pub-product { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; margin-bottom: 2rem; }

/* Gallery (public) */
.ca-pub-product-gallery { position: sticky; top: 1rem; align-self: start; }
.ca-pub-gallery-main { border-radius: 12px; overflow: hidden; border: 1px solid #e2e8f0; background: #f8fafc; margin-bottom: 0.75rem; }
.ca-pub-gallery-main img { width: 100%; height: auto; display: block; max-height: 500px; object-fit: contain; }
.ca-pub-gallery-thumbs { display: flex; gap: 0.5rem; overflow-x: auto; padding: 2px 0; }
.ca-pub-gallery-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 2px solid transparent; cursor: pointer; opacity: 0.6; transition: all 0.15s; flex-shrink: 0; }
.ca-pub-gallery-thumb:hover { opacity: 0.85; }
.ca-pub-gallery-thumb.active { border-color: #2563eb; opacity: 1; }

/* Product info */
.ca-pub-product-info h1 { font-size: 1.5rem; font-weight: 700; color: #1a1a2e; margin: 0.25rem 0 0.75rem; }
.ca-pub-product-cat { display: inline-block; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: #2563eb; font-weight: 600; }
.ca-pub-product-price { font-size: 1.1rem; color: #059669; margin-bottom: 1rem; }
.ca-pub-product-price strong { font-size: 1.35rem; }
.ca-pub-product-price small { color: #94a3b8; font-size: 0.78rem; margin-left: 0.3rem; }
.ca-pub-product-short { color: #4b5563; line-height: 1.5; margin: 0 0 1.25rem; }

/* Attributes */
.ca-pub-product-attrs { margin-bottom: 1.25rem; }
.ca-pub-product-attrs h3 { font-size: 0.95rem; font-weight: 600; margin: 0 0 0.75rem; color: #1a1a2e; }
.ca-pub-attr-group { margin-bottom: 0.75rem; }
.ca-pub-attr-group strong { font-size: 0.85rem; color: #374151; }
.ca-pub-attr-group small { color: #94a3b8; font-size: 0.75rem; }
.ca-pub-attr-options { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
.ca-pub-attr-option { padding: 0.3rem 0.7rem; border-radius: 6px; font-size: 0.8rem; background: #f1f5f9; color: #334155; border: 1px solid #e2e8f0; }
.ca-pub-attr-option small { color: #64748b; font-size: 0.7rem; }
.ca-pub-attr-default { border-color: #2563eb; background: #eff6ff; }

/* Quantity prices */
.ca-pub-product-prices { margin-bottom: 1.25rem; }
.ca-pub-product-prices h3 { font-size: 0.95rem; font-weight: 600; margin: 0 0 0.5rem; color: #1a1a2e; }
.ca-pub-qty-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.ca-pub-qty-item { display: flex; flex-direction: column; align-items: center; padding: 0.5rem 0.9rem; border-radius: 8px; background: #f8fafc; border: 1px solid #e2e8f0; min-width: 80px; }
.ca-pub-qty-num { font-size: 0.85rem; font-weight: 600; color: #1a1a2e; }
.ca-pub-qty-price { font-size: 0.8rem; color: #059669; font-weight: 500; }

/* Urgency */
.ca-pub-product-urgency { margin-bottom: 1.5rem; }
.ca-pub-product-urgency h3 { font-size: 0.95rem; font-weight: 600; margin: 0 0 0.5rem; color: #1a1a2e; }
.ca-pub-urgency-list { display: flex; flex-direction: column; gap: 0.4rem; }
.ca-pub-urgency-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.75rem; border-radius: 8px; background: #f8fafc; border: 1px solid #e2e8f0; font-size: 0.85rem; }
.ca-pub-urgency-label { font-weight: 600; color: #1a1a2e; }
.ca-pub-urgency-days { color: #64748b; }
.ca-pub-urgency-extra { color: #dc2626; font-weight: 500; font-size: 0.8rem; }

/* CTA */
.ca-pub-product-cta { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid #e2e8f0; }
.ca-pub-btn-cta { display: inline-block; padding: 0.75rem 2rem; border-radius: 10px; font-size: 1rem; font-weight: 600; border: none; cursor: pointer; background: #2563eb; color: #fff; transition: background 0.15s; }
.ca-pub-btn-cta:hover:not(:disabled) { background: #1d4ed8; }
.ca-pub-btn-cta:disabled { opacity: 0.5; cursor: not-allowed; }
.ca-pub-product-cta small { display: block; margin-top: 0.5rem; color: #94a3b8; font-size: 0.8rem; }

/* Description */
.ca-pub-product-desc { margin-bottom: 1.5rem; padding: 1.25rem; border-radius: 12px; background: #f8fafc; border: 1px solid #e2e8f0; }
.ca-pub-product-desc h2 { font-size: 1.1rem; font-weight: 600; margin: 0 0 0.75rem; color: #1a1a2e; }
.ca-pub-product-desc p { line-height: 1.6; color: #4b5563; margin: 0.5rem 0; }

/* Responsive — public */
@media (max-width: 768px) {
    .ca-pub-product { grid-template-columns: 1fr; gap: 1.5rem; }
    .ca-pub-product-gallery { position: static; }
    .ca-pub-cat-grid { grid-template-columns: 1fr; }
    .ca-pub-prod-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .ca-pub-header h1 { font-size: 1.35rem; }
    .ca-pub-pills { gap: 0.35rem; }
    .ca-pub-pill { font-size: 0.78rem; padding: 0.3rem 0.7rem; }
}

/* Category cards (admin) */
.ca-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.ca-cat-card { display: flex; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; background: #fff; }
.ca-cat-card-thumb { width: 100px; min-height: 100px; flex-shrink: 0; background: #f1f5f9; overflow: hidden; }
.ca-cat-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ca-cat-card-placeholder { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 2rem; }
.ca-cat-card-info { padding: 10px; flex: 1; font-size: 0.85rem; }
.ca-cat-card-info strong { display: block; font-size: 0.95rem; margin-bottom: 2px; }
.ca-cat-card-info small { color: #94a3b8; }

/* Gallery (admin) */ { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.ca-gallery-item { border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; background: #f8fafc; }
.ca-gallery-item img { width: 100%; height: 150px; object-fit: cover; display: block; }
.ca-gallery-info { padding: 8px; }
.ca-thumb-preview { display: inline-block; }

/* Responsive */
@media (max-width: 768px) {
    .ca-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .ca-form-grid { grid-template-columns: 1fr; }
    .ca-toolbar { flex-direction: column; align-items: stretch; }
    .ca-table { font-size: 0.8rem; }
    .ca-table th, .ca-table td { padding: 0.4rem 0.5rem; }
    .ca-nav { overflow-x: auto; }
}
