/**
 * Supreme Repeater Field Styles
 * Styles for the repeater field interface in Oxygen builder
 */

/* Hide the data storage field (JSON textarea) from the Oxygen editor UI */
.oxygen-control-row:has(textarea[ng-model*="_data"]),
.oxygen-control-row:has(input[ng-model*="_data"]),
.oxygen-control-wrapper:has(textarea[ng-model*="_data"]),
.oxygen-control:has(textarea[ng-model*="_data"]) {
    display: none !important;
}

.supreme-repeater-container {
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    margin: 10px 0;
    overflow: hidden;
}

/* Header */
.supreme-repeater-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f9f9f9;
    border-bottom: 1px solid #ddd;
}

.supreme-repeater-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.supreme-repeater-add-btn {
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 3px;
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.2s;
}

.supreme-repeater-add-btn:hover {
    background: #005177;
}

.supreme-repeater-add-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Items container */
.supreme-repeater-items {
    max-height: 600px;
    overflow-y: auto;
}

.supreme-repeater-items:empty + .supreme-repeater-empty {
    display: block !important;
}

/* Empty state */
.supreme-repeater-empty {
    padding: 40px 20px;
    text-align: center;
    color: #666;
    font-style: italic;
    background: #fafafa;
}

.supreme-repeater-empty p {
    margin: 0;
    font-size: 14px;
}

/* Individual items */
.supreme-repeater-item {
    border-bottom: 1px solid #eee;
    background: #fff;
    transition: box-shadow 0.2s;
}

.supreme-repeater-item:last-child {
    border-bottom: none;
}

.supreme-repeater-item:hover {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.supreme-repeater-item.sortable-ghost {
    opacity: 0.5;
}

.supreme-repeater-item.sortable-chosen {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Item header */
.supreme-repeater-item-header {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #fafafa;
    cursor: pointer;
    user-select: none;
}

.supreme-repeater-item-order {
    margin-right: 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.supreme-repeater-move-up,
.supreme-repeater-move-down {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.2s;
    width: 20px;
    height: 20px;
}

.supreme-repeater-move-up:hover,
.supreme-repeater-move-down:hover {
    background: #e0e0e0;
    color: #333;
}

.supreme-repeater-move-up:disabled,
.supreme-repeater-move-down:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.supreme-repeater-move-up:disabled:hover,
.supreme-repeater-move-down:disabled:hover {
    background: none;
    color: #666;
}

.supreme-repeater-move-up .dashicons,
.supreme-repeater-move-down .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.supreme-repeater-item-title {
    flex: 1;
    font-weight: 600;
    color: #333;
    font-size: 13px;
}

.supreme-repeater-item-number {
    color: #0073aa;
}

.supreme-repeater-item-preview {
    color: #666;
    font-weight: normal;
    font-style: italic;
}

.supreme-repeater-item-controls {
    display: flex;
    gap: 5px;
}

.supreme-repeater-toggle,
.supreme-repeater-remove {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.supreme-repeater-toggle {
    color: #666;
}

.supreme-repeater-toggle:hover {
    background: #e0e0e0;
    color: #333;
}

.supreme-repeater-remove {
    color: #dc3232;
}

.supreme-repeater-remove:hover {
    background: #dc3232;
    color: white;
}

.supreme-repeater-toggle .dashicons,
.supreme-repeater-remove .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Item content */
.supreme-repeater-item-content {
    padding: 15px;
    background: #fff;
    display: none; /* Default to collapsed */
}

.supreme-repeater-item-content.expanded {
    display: block;
}

/* Field styling */
.supreme-repeater-field {
    margin-bottom: 15px;
}

.supreme-repeater-field:last-child {
    margin-bottom: 0;
}

.supreme-repeater-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.supreme-repeater-input,
.supreme-repeater-textarea,
.supreme-repeater-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 13px;
    background: #fff;
    transition: border-color 0.2s;
}

.supreme-repeater-input:focus,
.supreme-repeater-textarea:focus,
.supreme-repeater-select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px rgba(0, 115, 170, 0.2);
}

.supreme-repeater-textarea {
    resize: vertical;
    min-height: 60px;
}

/* Rich text field */
.supreme-repeater-richtext-wrapper {
    margin-top: 5px;
}

.supreme-repeater-richtext-btn {
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    color: #333;
    transition: background-color 0.2s;
}

.supreme-repeater-richtext-btn:hover {
    background: #e0e0e0;
    border-color: #bbb;
}

/* Media field */
.supreme-repeater-media-wrapper {
    display: flex;
    gap: 5px;
}

.supreme-repeater-media-input {
    flex: 1;
}

.supreme-repeater-media-btn {
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 8px 10px;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    transition: background-color 0.2s;
}

.supreme-repeater-media-btn:hover {
    background: #e0e0e0;
    border-color: #bbb;
}

.supreme-repeater-media-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.supreme-repeater-media-preview {
    margin-top: 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #f9f9f9;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.supreme-repeater-media-preview img {
    max-width: 100%;
    max-height: 80px;
    border-radius: 2px;
}

.supreme-repeater-media-preview:empty {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .supreme-repeater-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .supreme-repeater-item-header {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .supreme-repeater-item-title {
        flex-basis: 100%;
    }
    
    .supreme-repeater-media-wrapper {
        flex-direction: column;
    }
}

/* Animation for adding/removing items */
.supreme-repeater-item {
    animation: slideIn 0.3s ease-out;
}

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

/* Order button states */
.supreme-repeater-item:first-child .supreme-repeater-move-up {
    opacity: 0.3;
    cursor: not-allowed;
}

.supreme-repeater-item:last-child .supreme-repeater-move-down {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Dark mode support (if Oxygen has dark mode) */
.oxygen-dark-mode .supreme-repeater-container {
    background: #2c3e50;
    border-color: #34495e;
}

.oxygen-dark-mode .supreme-repeater-header {
    background: #34495e;
    border-color: #3c5a75;
}

.oxygen-dark-mode .supreme-repeater-title,
.oxygen-dark-mode .supreme-repeater-field label {
    color: #ecf0f1;
}

.oxygen-dark-mode .supreme-repeater-item-header {
    background: #34495e;
}

.oxygen-dark-mode .supreme-repeater-item-content {
    background: #2c3e50;
}

.oxygen-dark-mode .supreme-repeater-input,
.oxygen-dark-mode .supreme-repeater-textarea,
.oxygen-dark-mode .supreme-repeater-select {
    background: #34495e;
    border-color: #3c5a75;
    color: #ecf0f1;
}

.oxygen-dark-mode .supreme-repeater-empty {
    background: #34495e;
    color: #95a5a6;
}

/* Placeholder card styling for empty state */
.product-card-placeholder {
  opacity: 0.7;
  border: 2px dashed #ddd !important;
  background: #f9f9f9 !important;
}

.product-card-placeholder .placeholder-icon {
  width: 175px;
  height: 175px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eee;
  border-radius: 8px;
  color: #999;
}

.product-card-placeholder .placeholder-icon .dashicons {
  font-size: 48px;
  width: 48px;
  height: 48px;
}

.product-card-placeholder .card-title {
  color: #666 !important;
}

.product-card-placeholder .card-description {
  color: #888 !important;
  font-style: italic;
}