/* ===================================
   Categories Manager Styles
   ================================ */

/* Categories Grid */
.categories-container {
    margin-top: 2rem;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

/* Category Card */
.category-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #d4a574;
}

.category-card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: #f3f4f6;
}

.category-card-content {
    padding: 1.5rem;
}

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

.category-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    font-family: 'Playfair Display', serif;
    margin: 0;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.category-badge.visible {
    background: #d1fae5;
    color: #065f46;
}

.category-badge.hidden {
    background: #fee2e2;
    color: #991b1b;
}

.category-card-description {
    color: #6b7280;
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.category-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.category-card-slug {
    font-size: 0.75rem;
    color: #9ca3af;
    font-family: 'Courier New', monospace;
}

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

.category-action-btn {
    padding: 0.5rem;
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.category-action-btn:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.category-action-btn.edit:hover {
    background: #dbeafe;
    color: #1e40af;
}

.category-action-btn.delete:hover {
    background: #fee2e2;
    color: #dc2626;
}

.category-action-btn.publish:hover {
    background: #d1fae5;
    color: #059669;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state i {
    font-size: 4rem;
    color: #d1d5db;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #6b7280;
    margin-bottom: 2rem;
}

/* Category Modal Specific */
#categoryModal .modal-content,
#collectionModal .modal-content,
#productModal .modal-content {
    max-width: 600px;
    padding: 0;
}

#orderDetailsModal .modal-content {
    max-width: 800px !important;
    width: 95% !important;
    padding: 2rem 2.5rem;
}

/* Boutique visibility toggle */
.collection-toggles-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0.5rem 0 0.75rem;
    flex-wrap: wrap;
}

.boutique-toggle {
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    cursor: pointer !important;
    position: static !important;
    background: none !important;
    padding: 0 !important;
    margin: 0 !important;
    transform: none !important;
    pointer-events: auto !important;
    border: none !important;
    outline: none !important;
    font-family: inherit;
}

.boutique-toggle-track {
    display: block;
    width: 40px;
    min-width: 40px;
    height: 22px;
    background-color: #d1d5db;
    border-radius: 11px;
    position: relative;
    transition: background-color 0.3s;
    flex-shrink: 0;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
    border: none;
}

.boutique-toggle-thumb {
    display: block;
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background-color: #ffffff;
    border-radius: 50%;
    transition: left 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    box-sizing: border-box;
    padding: 0;
    margin: 0;
    border: none;
}

.boutique-toggle.is-active .boutique-toggle-track {
    background-color: #10b981;
}

.boutique-toggle.is-active .boutique-toggle-thumb {
    left: 21px;
}

.boutique-toggle-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: #6b7280;
    line-height: 1;
}

.boutique-toggle.is-active .boutique-toggle-text {
    color: #065f46;
}

/* Featured (homepage) toggle */
.featured-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    transition: all 0.25s ease;
    user-select: none;
}

.featured-toggle i {
    font-size: 0.9rem;
    color: #d1d5db;
    transition: all 0.25s ease;
}

.featured-toggle .featured-toggle-text {
    font-size: 0.8rem;
    font-weight: 500;
    color: #9ca3af;
    transition: all 0.25s ease;
}

.featured-toggle:hover {
    border-color: #fbbf24;
    background: #fffbeb;
}

.featured-toggle.is-active {
    border-color: #f59e0b;
    background: #fffbeb;
}

.featured-toggle.is-active i {
    color: #f59e0b;
}

.featured-toggle.is-active .featured-toggle-text {
    color: #92400e;
}

/* =================================== 
   FIX: Override floating labels from style.css
   Inside admin modals, labels must be ABOVE inputs
   =================================== */
.admin-panel .modal .form-group {
    position: relative;
    margin-bottom: 1.25rem;
}

.admin-panel .modal .form-group label {
    position: static !important;
    display: block !important;
    margin-bottom: 0.5rem !important;
    font-weight: 500 !important;
    color: #374151 !important;
    font-size: 0.9rem !important;
    pointer-events: auto !important;
    background: none !important;
    padding: 0 !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
}

.admin-panel .modal .form-group input:focus + label,
.admin-panel .modal .form-group input:not(:placeholder-shown) + label,
.admin-panel .modal .form-group textarea:focus + label,
.admin-panel .modal .form-group textarea:not(:placeholder-shown) + label {
    position: static !important;
    top: auto !important;
    left: auto !important;
    font-size: 0.9rem !important;
    color: #374151 !important;
    transform: none !important;
}

.admin-panel .modal .form-group input[type="text"],
.admin-panel .modal .form-group input[type="url"],
.admin-panel .modal .form-group input[type="number"],
.admin-panel .modal .form-group textarea,
.admin-panel .modal .form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    box-sizing: border-box;
    background: #fff;
}

.admin-panel .modal .form-group input:focus,
.admin-panel .modal .form-group textarea:focus,
.admin-panel .modal .form-group select:focus {
    outline: none;
    border-color: #d4a574;
    box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1);
}

#collectionModal .modal-close,
#productModal .modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
}

#collectionModal .modal-header,
#productModal .modal-header {
    padding: 1.75rem 2rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 0;
}

#collectionModal .modal-header h2,
#productModal .modal-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    padding-right: 2rem;
    font-family: 'Playfair Display', serif;
}

#collectionModal .modal-body,
#productModal .modal-body {
    padding: 1.5rem 2rem 2rem;
    max-height: 65vh;
    overflow-y: auto;
}

#collectionModal small,
#productModal small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.admin-panel .modal input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.5rem;
    cursor: pointer;
    vertical-align: middle;
}

.admin-panel .modal .modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e5e7eb;
}

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

/* Loading State */
.categories-loading {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.categories-loading i {
    font-size: 2rem;
    margin-bottom: 1rem;
    animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
    .categories-grid {
        grid-template-columns: 1fr;
    }

    .category-card-content {
        padding: 1rem;
    }
}

/* ===================================
   PRODUCT REORDER FUNCTIONALITY
   ================================ */

/* Drag handle */
.drag-handle {
    display: none;
    cursor: grab;
    color: #9ca3af;
    padding: 0 4px;
    font-size: 0.9rem;
    flex-shrink: 0;
    transition: color 0.15s;
}

.drag-handle:active {
    cursor: grabbing;
}

.drag-handle:hover {
    color: #5B1013;
}

/* Product order number */
.product-order-number {
    display: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
    text-align: center;
    line-height: 22px;
}

/* Reorder mode active */
.reorder-mode .drag-handle {
    display: flex;
    align-items: center;
}

.reorder-mode .product-order-number {
    display: inline-block;
}

.reorder-mode .collection-product-item {
    cursor: grab;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
    background: #fff;
}

.reorder-mode .collection-product-item:hover {
    border-color: #5B1013;
    box-shadow: 0 2px 8px rgba(91, 16, 19, 0.1);
}

.reorder-mode .collection-product-item.dragging {
    opacity: 0.5;
    transform: scale(0.98);
    border-color: #5B1013;
    background: #fef2f2;
}

.drag-placeholder {
    background: #fef2f2;
    border: 2px dashed #5B1013;
    border-radius: 8px;
    margin-bottom: 4px;
}

/* Reorder active info bar */
.reorder-active .collection-products-header {
    background: linear-gradient(135deg, #fef2f2 0%, #fff5f5 100%);
    border-bottom: 2px solid #5B1013;
    padding: 0.75rem 1rem;
}

/* Collection products actions row */
.collection-products-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Reorder button */
.btn-collection-reorder {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    background: linear-gradient(135deg, #f0f5ff 0%, #e8eeff 100%);
    color: #3b5bdb;
    border: 1px solid #c5d2f0;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-collection-reorder:hover {
    background: linear-gradient(135deg, #3b5bdb 0%, #2b4bc8 100%);
    color: #fff;
    border-color: #3b5bdb;
}

/* Save order button */
.btn-collection-save-order {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-collection-save-order:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* Cancel order button */
.btn-collection-cancel-order {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-collection-cancel-order:hover {
    background: #e5e7eb;
    color: #374151;
}

/* Reset order button */
.btn-collection-reset-order {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    background: #fff;
    color: #ef4444;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-collection-reset-order:hover {
    background: #fef2f2;
    border-color: #ef4444;
}

/* Indicator when custom order is saved */
.collection-has-custom-order {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    color: #3b5bdb;
    background: #f0f5ff;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
    margin-left: 0.5rem;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .collection-products-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.4rem;
    }
    
    .btn-collection-reorder,
    .btn-collection-save-order,
    .btn-collection-cancel-order,
    .btn-collection-reset-order {
        justify-content: center;
        font-size: 0.75rem;
        padding: 0.5rem;
    }
    
    .collection-products-header {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* ================================
   COLLECTIONS REORDER LIST (panel)
   ================================ */

.col-reorder-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .5rem .75rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: grab;
    user-select: none;
    transition: box-shadow .15s, background .15s;
}
.col-reorder-item:hover {
    background: #fff;
    box-shadow: 0 2px 8px rgba(91,16,19,.1);
    border-color: #5B1013;
}
.col-reorder-item.col-reorder-dragging {
    opacity: .45;
    cursor: grabbing;
}
.col-reorder-handle {
    color: #9ca3af;
    font-size: .95rem;
    cursor: grab;
    flex-shrink: 0;
}
.col-reorder-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #5B1013;
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    text-align: center;
    line-height: 22px;
    flex-shrink: 0;
}
.col-reorder-img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}
.col-reorder-img.no-img {
    background: #e5e7eb;
}
.col-reorder-title {
    font-weight: 500;
    font-size: .92rem;
    flex: 1;
}
