/* Counter Field Styles */
.counter-field-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    max-width: 150px;
}

.counter-input {
    border: none !important;
    text-align: center;
    font-weight: 500;
    font-size: 16px;
    flex: 1;
    background: transparent;
    outline: none;
    padding: 8px 12px;
    min-width: 50px;
}

.counter-input:focus {
    box-shadow: none !important;
    border: none !important;
}

.counter-btn {
    background: #f8f9fa;
    border: none;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    user-select: none;
}

.counter-btn:hover {
    background: #e9ecef;
    color: #333;
}

.counter-btn:active {
    background: #dee2e6;
    transform: scale(0.95);
}

.counter-minus {
    border-right: 1px solid #ddd;
}

.counter-plus {
    border-left: 1px solid #ddd;
}

/* Responsive design */
@media (max-width: 768px) {
    .counter-field-wrapper {
        max-width: 120px;
    }
    
    .counter-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    .counter-input {
        font-size: 14px;
        padding: 6px 8px;
        min-width: 40px;
    }
}

/* Disabled state */
.counter-field-wrapper.disabled {
    opacity: 0.6;
    pointer-events: none;
}

/* Focus state for accessibility */
.counter-field-wrapper:focus-within {
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Custom styling for different themes */
.counter-field-wrapper.theme-primary {
    border-color: #007bff;
}

.counter-field-wrapper.theme-primary .counter-btn:hover {
    background: #007bff;
    color: white;
}

/* ============================================================================
   COUNTER GROUP STYLES
   ============================================================================ */

.counter-group-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 300px;
}

.counter-group-display {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    color: #333;
    transition: all 0.2s ease;
    text-align: left;
}

.counter-group-display:hover {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.counter-group-display:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

.counter-group-text {
    flex: 1;
    font-weight: 500;
}

.counter-group-arrow {
    margin-left: 8px;
    font-size: 12px;
    color: #666;
    transition: transform 0.2s ease;
}

.counter-group-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    padding: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.counter-group-panel.open {
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.counter-group-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.counter-group-item:last-child {
    border-bottom: none;
}

.counter-group-item-info {
    flex: 1;
    padding-right: 16px;
}

.counter-group-item-label {
    display: block;
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
}

.counter-group-item-desc {
    display: block;
    font-size: 12px;
    color: #666;
}

.counter-group-item-controls {
    display: flex;
    align-items: center;
    gap: 0;
}

.counter-group-item-controls .counter-btn {
    width: 32px;
    height: 32px;
    font-size: 16px;
}

.counter-group-item-controls .counter-input {
    width: 50px;
    text-align: center;
    border: none;
    padding: 6px;
    font-size: 14px;
    font-weight: 500;
}

.counter-group-actions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
    text-align: right;
}

.counter-group-actions .btn {
    padding: 8px 24px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.counter-group-actions .btn:hover {
    background: #0056b3;
}

/* Responsive design for counter groups */
@media (max-width: 768px) {
    .counter-group-wrapper {
        max-width: 100%;
    }
    
    .counter-group-display {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .counter-group-panel {
        padding: 12px;
    }
    
    .counter-group-item {
        padding: 10px 0;
    }
    
    .counter-group-item-controls .counter-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .counter-group-item-controls .counter-input {
        width: 40px;
        font-size: 13px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .counter-group-display {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .counter-group-panel {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .counter-group-item-label {
        color: #e2e8f0;
    }
    
    .counter-group-item-desc {
        color: #a0aec0;
    }
}

/* ============================================================================
   ADMIN COUNTER GROUP BUILDER STYLES
   ============================================================================ */

.counter-group-item-builder {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.counter-group-item-builder input {
    margin: 2px 0;
}

.counter-group-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 10px;
}

.counter-group-preview {
    padding: 0;
}

.counter-group-preview-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    gap: 10px;
    flex-wrap: wrap;
}

.counter-group-preview-item:last-child {
    border-bottom: none;
}

.counter-group-preview-item span {
    font-size: 12px;
    color: #666;
}

.counter-group-preview-item span:first-child {
    font-weight: 500;
    color: #333;
}

.btn-xs {
    padding: 2px 6px;
    font-size: 11px;
    border-radius: 2px;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: none;
    cursor: pointer;
}

.btn-danger:hover {
    background: #c82333;
}